Skip to content

Commit

Permalink
Update compose and build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Feb 21, 2024
1 parent a05f4f7 commit f2d0ca6
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 59 deletions.
6 changes: 3 additions & 3 deletions Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

EXPOSE ${ASPNETCORE_HTTP_PORTS}
EXPOSE ${ASPNETCORE_HTTPS_PORTS}

RUN apt -y update && apt -y install curl
RUN mkdir -p /app/AppData
RUN chown app:app -R /app/AppData

WORKDIR /app
EXPOSE 5000
EXPOSE 5001


FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
Expand Down
19 changes: 7 additions & 12 deletions Server/Dockerfile.pipelines
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy
FROM mcr.microsoft.com/dotnet/aspnet:8.0

USER app

SHELL ["/bin/bash", "-c"]
EXPOSE ${ASPNETCORE_HTTP_PORTS}
EXPOSE ${ASPNETCORE_HTTPS_PORTS}

EXPOSE 5000
EXPOSE 5001
RUN apt -y update && apt -y install curl
RUN mkdir -p /app/AppData
RUN chown app:app -R /app/AppData

COPY /_immense.Remotely/Server/linux-x64/Server /app

WORKDIR /app

RUN \
apt-get -y update && \
apt-get -y install curl && \
mkdir -p /app/AppData && \
sed -i 's/DataSource=Remotely.db/DataSource=\/app\/AppData\/Remotely.db/' /app/appsettings.json

USER app
ENTRYPOINT ["dotnet", "Remotely_Server.dll"]

HEALTHCHECK --interval=5m --timeout=3s \
Expand Down
35 changes: 22 additions & 13 deletions Utilities/Publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ function Add-DataBlock($FilePath) {
$FS.Write($DataBlock, 0, $DataBlock.Length)
$FS.Close()
}

function Wait-ForExists($FilePath) {
while ((Test-Path -Path $FilePath) -eq $false){
Write-Host "Waiting for file: $FilePath"
Start-Sleep -Seconds 3
}
}
#endregion

if ([string]::IsNullOrWhiteSpace($MSBuildPath) -or !(Test-Path -Path $MSBuildPath)) {
Expand Down Expand Up @@ -107,6 +114,8 @@ if ((Test-Path -Path "$Root\Agent\bin\publish\linux-x64") -eq $true) {
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime win-x64 --self-contained --configuration Release --output "$Root\Agent\bin\publish\win-x64" "$Root\Agent"
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime linux-x64 --self-contained --configuration Release --output "$Root\Agent\bin\publish\linux-x64" "$Root\Agent"
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime win-x86 --self-contained --configuration Release --output "$Root\Agent\bin\publish\win-x86" "$Root\Agent"
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime osx-x64 --self-contained --configuration Release --output "$Root\Agent\bin\publish\osx-x64" "$Root\Agent"
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime osx-arm64 --self-contained --configuration Release --output "$Root\Agent\bin\publish\osx-arm64" "$Root\Agent"

New-Item -Path "$Root\Agent\bin\publish\win-x64\Desktop\" -ItemType Directory -Force
New-Item -Path "$Root\Agent\bin\publish\win-x86\Desktop\" -ItemType Directory -Force
Expand Down Expand Up @@ -154,31 +163,31 @@ if ($SignAssemblies) {
&"$Root\Utilities\signtool.exe" sign /fd SHA256 /f "$CertificatePath" /p $CertificatePassword /t http://timestamp.digicert.com "$Root\Server\wwwroot\Content\Remotely_Installer.exe"
}

# Compress Core clients.
# Compress Agents.
$PublishDir = "$Root\Agent\bin\publish\win-x64"
Compress-Archive -Path "$PublishDir\*" -DestinationPath "$PublishDir\Remotely-Win-x64.zip" -Force
while ((Test-Path -Path "$PublishDir\Remotely-Win-x64.zip") -eq $false){
Write-Host "Waiting for archive to finish: $PublishDir\Remotely-Win-x64.zip"
Start-Sleep -Seconds 3
}
Wait-ForExists -FilePath "$PublishDir\Remotely-Win-x64.zip"
Move-Item -Path "$PublishDir\Remotely-Win-x64.zip" -Destination "$Root\Server\wwwroot\Content\Remotely-Win-x64.zip" -Force

$PublishDir = "$Root\Agent\bin\publish\win-x86"
Compress-Archive -Path "$PublishDir\*" -DestinationPath "$PublishDir\Remotely-Win-x86.zip" -Force
while ((Test-Path -Path "$PublishDir\Remotely-Win-x86.zip") -eq $false){
Write-Host "Waiting for archive to finish: $PublishDir\Remotely-Win-x86.zip"
Start-Sleep -Seconds 3
}
Wait-ForExists -FilePath "$PublishDir\Remotely-Win-x86.zip"
Move-Item -Path "$PublishDir\Remotely-Win-x86.zip" -Destination "$Root\Server\wwwroot\Content\Remotely-Win-x86.zip" -Force

$PublishDir = "$Root\Agent\bin\publish\linux-x64"
Compress-Archive -Path "$PublishDir\*" -DestinationPath "$PublishDir\Remotely-Linux.zip" -Force
while ((Test-Path -Path "$PublishDir\Remotely-Linux.zip") -eq $false){
Write-Host "Waiting for archive to finish: $PublishDir\Remotely-Win-x86.zip"
Start-Sleep -Seconds 3
}
Wait-ForExists -FilePath "$PublishDir\Remotely-Linux.zip"
Move-Item -Path "$PublishDir\Remotely-Linux.zip" -Destination "$Root\Server\wwwroot\Content\Remotely-Linux.zip" -Force

$PublishDir = "$Root\Agent\bin\publish\osx-x64"
Compress-Archive -Path "$PublishDir\*" -DestinationPath "$PublishDir\Remotely-MacOS-x64.zip" -Force
Wait-ForExists -FilePath "$PublishDir\Remotely-MacOS-x64.zip"
Move-Item -Path "$PublishDir\Remotely-MacOS-x64.zip" -Destination "$Root\Server\wwwroot\Content\Remotely-MacOS-x64.zip" -Force

$PublishDir = "$Root\Agent\bin\publish\osx-arm64"
Compress-Archive -Path "$PublishDir\*" -DestinationPath "$PublishDir\Remotely-MacOS-arm64.zip" -Force
Wait-ForExists -FilePath "$PublishDir\Remotely-MacOS-arm64.zip"
Move-Item -Path "$PublishDir\Remotely-MacOS-arm64.zip" -Destination "$Root\Server\wwwroot\Content\Remotely-MacOS-arm64.zip" -Force


if ($RID.Length -gt 0 -and $OutDir.Length -gt 0) {
Expand Down
35 changes: 35 additions & 0 deletions docker-compose/docker-compose-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3.4'

# This compose file is compatible with existing Remotely containers prior to 2024.
# In this file, the data volume is mapped to /remotely-data on the host. In the
# new file, a Docker volume is used.
# For new installations, it's recommended to use the docker-compose.yml file.
# You can migrate to the new version by copying your existing Remotelydb file
# to the Docker volume and restarting the container.

services:
remotely:
image: immybot/remotely:latest
volumes:
- /remotely-data:/app/AppData
build:
context: ../
dockerfile: Server/Dockerfile
ports:
- "5000:5000"
- "5001:5001"
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_HTTP_PORTS=5000
- ASPNETCORE_HTTPS_PORTS=5001
# Other ASP.NET Core configurations can be overridden here, such as Logging.
# See https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0

# Values for DbProvider are SQLite, SQLServer, and PostgreSQL.
- Remotely_ApplicationOptions__DbProvider=SQLite
# This path shouldn't be changed. It points to the Docker volume.
- Remotely_ConnectionStrings__SQLite=Data Source=/app/AppData/Remotely.db
# If using SQL Server, change the connection string to point to your SQL Server instance.
- Remotely_ConnectionStrings__SQLServer=Server=(localdb)\\mssqllocaldb;Database=Remotely-Server-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true
# If using PostgreSQL, change the connection string to point to your PostgreSQL instance.
- Remotely_ConnectionStrings__PostgreSQL=Server=Host=localhost;Database=Remotely;Username=postgres;
1 change: 1 addition & 0 deletions docker-compose/docker-compose.dcproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<DockerServiceName>remotely</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose-compat.yml" />
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
Expand Down
5 changes: 5 additions & 0 deletions docker-compose/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: '3.4'

volumes:
remotely-data:
name: remotely-data


services:
remotely:
environment:
Expand Down
32 changes: 1 addition & 31 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,4 @@ services:
# If using SQL Server, change the connection string to point to your SQL Server instance.
- Remotely_ConnectionStrings__SQLServer=Server=(localdb)\\mssqllocaldb;Database=Remotely-Server-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true
# If using PostgreSQL, change the connection string to point to your PostgreSQL instance.
- Remotely_ConnectionStrings__PostgreSQL=Server=Host=localhost;Database=Remotely;Username=postgres;

- Remotely_ApplicationOptions__AllowApiLogin=false
#- Remotely_ApplicationOptions__BannedDevices__0=
- Remotely_ApplicationOptions__DataRetentionInDays=90
- Remotely_ApplicationOptions__DBProvider=SQLite
- Remotely_ApplicationOptions__EnableRemoteControlRecording=false
- Remotely_ApplicationOptions__EnableWindowsEventLog=false
- Remotely_ApplicationOptions__EnforceAttendedAccess=false
- Remotely_ApplicationOptions__ForceClientHttps=false
#- Remotely_ApplicationOptions__KnownProxies__0=
- Remotely_ApplicationOptions__MaxConcurrentUpdates=10
- Remotely_ApplicationOptions__MaxOrganizationCount=1
- Remotely_ApplicationOptions__MessageOfTheDay=
- Remotely_ApplicationOptions__RedirectToHttps=true
- Remotely_ApplicationOptions__RemoteControlNotifyUser=true
- Remotely_ApplicationOptions__RemoteControlRequiresAuthentication=true
- Remotely_ApplicationOptions__RemoteControlSessionLimit=3
- Remotely_ApplicationOptions__Require2FA=false
- Remotely_ApplicationOptions__SmtpDisplayName=
- Remotely_ApplicationOptions__SmtpEmail=
- Remotely_ApplicationOptions__SmtpHost=
- Remotely_ApplicationOptions__SmtpLocalDomain=
- Remotely_ApplicationOptions__SmtpCheckCertificateRevocation=true
- Remotely_ApplicationOptions__SmtpPassword=
- Remotely_ApplicationOptions__SmtpPort=587
- Remotely_ApplicationOptions__SmtpUserName=
- Remotely_ApplicationOptions__Theme=Dark
#- Remotely_ApplicationOptions__TrustedCorsOrigins__0=
- Remotely_ApplicationOptions__UseHsts=false
- Remotely_ApplicationOptions__UseHttpLogging=false
- Remotely_ConnectionStrings__PostgreSQL=Server=Host=localhost;Database=Remotely;Username=postgres;
3 changes: 3 additions & 0 deletions docker-compose/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"Docker Compose": {
"commandName": "DockerCompose",
"commandVersion": "1.0",
"composeLaunchAction": "LaunchBrowser",
"composeLaunchServiceName": "remotely",
"composeLaunchUrl": "{Scheme}://localhost:{ServicePort}",
"serviceActions": {
"remotely": "StartDebugging"
}
Expand Down

0 comments on commit f2d0ca6

Please sign in to comment.