diff --git a/Server/Dockerfile b/Server/Dockerfile index 4c72e5de..742dbb40 100644 --- a/Server/Dockerfile +++ b/Server/Dockerfile @@ -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 diff --git a/Server/Dockerfile.pipelines b/Server/Dockerfile.pipelines index f26befcc..ea681691 100644 --- a/Server/Dockerfile.pipelines +++ b/Server/Dockerfile.pipelines @@ -1,22 +1,17 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy +FROM mcr.microsoft.com/dotnet/aspnet:8.0 -USER app +EXPOSE ${ASPNETCORE_HTTP_PORTS} +EXPOSE ${ASPNETCORE_HTTPS_PORTS} -SHELL ["/bin/bash", "-c"] - -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 \ diff --git a/Utilities/Publish.ps1 b/Utilities/Publish.ps1 index 75c8ba72..480344dd 100644 --- a/Utilities/Publish.ps1 +++ b/Utilities/Publish.ps1 @@ -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)) { @@ -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 @@ -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) { diff --git a/docker-compose/docker-compose-compat.yml b/docker-compose/docker-compose-compat.yml new file mode 100644 index 00000000..9e254095 --- /dev/null +++ b/docker-compose/docker-compose-compat.yml @@ -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; \ No newline at end of file diff --git a/docker-compose/docker-compose.dcproj b/docker-compose/docker-compose.dcproj index cfbe7b52..a6f988e0 100644 --- a/docker-compose/docker-compose.dcproj +++ b/docker-compose/docker-compose.dcproj @@ -11,6 +11,7 @@ remotely + docker-compose.yml diff --git a/docker-compose/docker-compose.override.yml b/docker-compose/docker-compose.override.yml index f9d111ea..3ecf084f 100644 --- a/docker-compose/docker-compose.override.yml +++ b/docker-compose/docker-compose.override.yml @@ -1,5 +1,10 @@ version: '3.4' +volumes: + remotely-data: + name: remotely-data + + services: remotely: environment: diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index be573190..4522280d 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -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 \ No newline at end of file + - Remotely_ConnectionStrings__PostgreSQL=Server=Host=localhost;Database=Remotely;Username=postgres; \ No newline at end of file diff --git a/docker-compose/launchSettings.json b/docker-compose/launchSettings.json index bd9dc563..4a00ead0 100644 --- a/docker-compose/launchSettings.json +++ b/docker-compose/launchSettings.json @@ -3,6 +3,9 @@ "Docker Compose": { "commandName": "DockerCompose", "commandVersion": "1.0", + "composeLaunchAction": "LaunchBrowser", + "composeLaunchServiceName": "remotely", + "composeLaunchUrl": "{Scheme}://localhost:{ServicePort}", "serviceActions": { "remotely": "StartDebugging" }