diff --git a/Remotely.sln b/Remotely.sln index 60c0b3ea3..1f64a816f 100644 --- a/Remotely.sln +++ b/Remotely.sln @@ -77,6 +77,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Immense.RemoteControl.Deskt EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Immense.RemoteControl.Desktop.UI", "submodules\Immense.RemoteControl\Immense.RemoteControl.Desktop.UI\Immense.RemoteControl.Desktop.UI.csproj", "{3095BA44-D5E0-42B4-9161-7F7AB8E68A10}" EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose\docker-compose.dcproj", "{90EC49B2-B56A-4ECD-8F63-2162DD140F7C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -279,6 +281,18 @@ Global {3095BA44-D5E0-42B4-9161-7F7AB8E68A10}.Release|x64.Build.0 = Release|Any CPU {3095BA44-D5E0-42B4-9161-7F7AB8E68A10}.Release|x86.ActiveCfg = Release|Any CPU {3095BA44-D5E0-42B4-9161-7F7AB8E68A10}.Release|x86.Build.0 = Release|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Debug|x64.ActiveCfg = Debug|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Debug|x64.Build.0 = Debug|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Debug|x86.ActiveCfg = Debug|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Debug|x86.Build.0 = Debug|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Release|Any CPU.Build.0 = Release|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Release|x64.ActiveCfg = Release|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Release|x64.Build.0 = Release|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Release|x86.ActiveCfg = Release|Any CPU + {90EC49B2-B56A-4ECD-8F63-2162DD140F7C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Server/DockerMain.sh b/Server/DockerMain.sh deleted file mode 100644 index ccb0da0d1..000000000 --- a/Server/DockerMain.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -echo "Entered main script." - -RemotelyData=/remotely-data - -AppSettingsVolume=/remotely-data/appsettings.json -AppSettingsSrc=/app/appsettings.json - -if [ ! -f "$AppSettingsVolume" ]; then - echo "Copying appsettings.json to volume." - cp "$AppSettingsSrc" "$AppSettingsVolume" -fi - -if [ -f "$AppSettingsSrc" ]; then - rm "$AppSettingsSrc" -fi - -ln -s "$AppSettingsVolume" "$AppSettingsSrc" - -echo "Starting Remotely server." -exec /usr/bin/dotnet /app/Remotely_Server.dll \ No newline at end of file diff --git a/Server/Dockerfile b/Server/Dockerfile index 6cda6a74b..d3f93b486 100644 --- a/Server/Dockerfile +++ b/Server/Dockerfile @@ -1,13 +1,12 @@ -FROM mcr.microsoft.com/dotnet/aspnet:7.0-jammy +FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy + +USER app SHELL ["/bin/bash", "-c"] EXPOSE 5000 +EXPOSE 5001 -ENV ASPNETCORE_ENVIRONMENT="Production" -ENV ASPNETCORE_URLS="http://*:5000" - -COPY /_immense.Remotely/Server/DockerMain.sh /src/DockerMain.sh COPY /_immense.Remotely/Server/linux-x64/Server /app WORKDIR /app @@ -16,13 +15,9 @@ RUN \ apt-get -y update && \ apt-get -y install curl && \ mkdir -p /remotely-data && \ - sed -i 's/DataSource=Remotely.db/DataSource=\/remotely-data\/Remotely.db/' /app/appsettings.json - -VOLUME "/remotely-data" - -RUN chmod +x "/src/DockerMain.sh" + sed -i 's/DataSource=Remotely.db/DataSource=\/app\/AppData\/Remotely.db/' /app/appsettings.json -ENTRYPOINT ["/src/DockerMain.sh"] +ENTRYPOINT ["dotnet", "Remotely_Server.dll"] HEALTHCHECK --interval=5m --timeout=3s \ CMD curl -f http://localhost:5000/api/healthcheck || exit 1 \ No newline at end of file diff --git a/Server/Dockerfile.local b/Server/Dockerfile.local index b6f0e6fcb..72287a035 100644 --- a/Server/Dockerfile.local +++ b/Server/Dockerfile.local @@ -1,31 +1,23 @@ -FROM mcr.microsoft.com/dotnet/aspnet:7.0-jammy +FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy + +USER app SHELL ["/bin/bash", "-c"] EXPOSE 5000 - -ENV ASPNETCORE_ENVIRONMENT="Production" -ENV ASPNETCORE_URLS="http://*:5000" +EXPOSE 5001 COPY ./bin/publish /app -WORKDIR /src - -COPY ./DockerMain.sh . - WORKDIR /app RUN \ apt-get -y update && \ apt-get -y install curl && \ mkdir -p /remotely-data && \ - sed -i 's/DataSource=Remotely.db/DataSource=\/remotely-data\/Remotely.db/' ./appsettings.json - -VOLUME "/remotely-data" - -RUN chmod +x "/src/DockerMain.sh" + sed -i 's/DataSource=Remotely.db/DataSource=\/app\/AppData\/Remotely.db/' ./appsettings.json -ENTRYPOINT ["/src/DockerMain.sh"] +ENTRYPOINT ["dotnet", "Remotely_Server.dll"] HEALTHCHECK --interval=5m --timeout=3s \ CMD curl -f http://localhost:5000/api/healthcheck || exit 1 \ No newline at end of file diff --git a/Server/Dockerfile.old b/Server/Dockerfile.old index 899b753d9..986b2d521 100644 --- a/Server/Dockerfile.old +++ b/Server/Dockerfile.old @@ -16,7 +16,7 @@ RUN \ libssl1.0 RUN \ - apt-get -y install aspnetcore-runtime-7.0 + apt-get -y install aspnetcore-runtime-8.0 RUN \ mkdir -p /app && \ diff --git a/Server/Dockerfile.rootless b/Server/Dockerfile.rootless index 436a6df41..3b288768e 100644 --- a/Server/Dockerfile.rootless +++ b/Server/Dockerfile.rootless @@ -16,7 +16,7 @@ RUN \ libssl1.0 RUN \ - apt-get -y install aspnetcore-runtime-7.0 + apt-get -y install aspnetcore-runtime-8.0 RUN \ adduser --disabled-password --gecos '' -u 2001 remotely && \ diff --git a/Server/Program.cs b/Server/Program.cs index 6c137943c..239139837 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -7,7 +7,6 @@ using Microsoft.AspNetCore.StaticFiles; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.FileProviders; -using Microsoft.OpenApi.Models; using Remotely.Server.Auth; using Remotely.Server.Data; using Remotely.Server.Hubs; @@ -29,6 +28,8 @@ var configuration = builder.Configuration; var services = builder.Services; +configuration.AddEnvironmentVariables("Remotely_"); + services .AddRazorComponents() .AddInteractiveServerComponents(); diff --git a/Server/Server.csproj b/Server/Server.csproj index 5c4c03d8a..76f3c56b3 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -9,6 +9,7 @@ Remotely.Server enable enable + ..\docker-compose.dcproj diff --git a/Server/wwwroot/Content/Install-Manjaro-x64.sh b/Server/wwwroot/Content/Install-Manjaro-x64.sh index 1de2d4250..d45992470 100644 --- a/Server/wwwroot/Content/Install-Manjaro-x64.sh +++ b/Server/wwwroot/Content/Install-Manjaro-x64.sh @@ -31,7 +31,7 @@ if [ -z "$ETag" ]; then fi pacman -Sy -pacman -S dotnet-runtime-7.0 --noconfirm +pacman -S dotnet-runtime-8.0 --noconfirm pacman -S libx11 --noconfirm pacman -S unzip --noconfirm pacman -S libc6 --noconfirm diff --git a/Server/wwwroot/Content/Install-Ubuntu-x64.sh b/Server/wwwroot/Content/Install-Ubuntu-x64.sh index 3e72d4a99..919293e47 100644 --- a/Server/wwwroot/Content/Install-Ubuntu-x64.sh +++ b/Server/wwwroot/Content/Install-Ubuntu-x64.sh @@ -39,7 +39,7 @@ wget -q https://packages.microsoft.com/config/ubuntu/$UbuntuVersion/packages-mic dpkg -i packages-microsoft-prod.deb apt-get update apt-get -y install apt-transport-https -apt-get -y install dotnet-runtime-7.0 +apt-get -y install dotnet-runtime-8.0 rm packages-microsoft-prod.deb apt-get -y install libx11-dev diff --git a/Utilities/signtool.exe b/Utilities/signtool.exe index 5c5c622a6..4cfa1a3d6 100644 Binary files a/Utilities/signtool.exe and b/Utilities/signtool.exe differ diff --git a/docker-compose/docker-compose.dcproj b/docker-compose/docker-compose.dcproj new file mode 100644 index 000000000..6be91d1de --- /dev/null +++ b/docker-compose/docker-compose.dcproj @@ -0,0 +1,20 @@ + + + + 2.1 + remotely + Linux + False + 90ec49b2-b56a-4ecd-8f63-2162dd140f7c + LaunchBrowser + {Scheme}://localhost:{ServicePort} + server + + + + docker-compose.yml + + + + + \ No newline at end of file diff --git a/docker-compose/docker-compose.override.yml b/docker-compose/docker-compose.override.yml new file mode 100644 index 000000000..0cde41cf8 --- /dev/null +++ b/docker-compose/docker-compose.override.yml @@ -0,0 +1,51 @@ +version: '3.4' + +services: + server: + build: + context: ../Server + dockerfile: Dockerfile.local + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_HTTP_PORTS=5000 + - ASPNETCORE_HTTPS_PORTS=5001 + - 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 + ports: + - "5000" + - "5001" + volumes: + - ${APPDATA}/Microsoft/UserSecrets:/home/app/.microsoft/usersecrets:ro + - ${APPDATA}/ASP.NET/Https:/home/app/.aspnet/https:ro + - remotely-data:/app/AppData + +volumes: + remotely-data: + name: remotely-data \ No newline at end of file diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml new file mode 100644 index 000000000..5ce84f900 --- /dev/null +++ b/docker-compose/docker-compose.yml @@ -0,0 +1,45 @@ +version: '3.4' + +services: + remotely: + image: immybot/remotely + volumes: + - /remotely-data:/app/AppData + build: + context: ../Server + dockerfile: Dockerfile + ports: + - "5000:5000" + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_HTTP_PORTS=5000 + - ASPNETCORE_HTTPS_PORTS=5001 + - 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 diff --git a/docker-compose/launchSettings.json b/docker-compose/launchSettings.json new file mode 100644 index 000000000..bd9dc5637 --- /dev/null +++ b/docker-compose/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "Docker Compose": { + "commandName": "DockerCompose", + "commandVersion": "1.0", + "serviceActions": { + "remotely": "StartDebugging" + } + } + } +} \ No newline at end of file