Skip to content

Commit

Permalink
Update scripts. Add docker compose.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Feb 20, 2024
1 parent 8a5c5d0 commit 2af48bf
Show file tree
Hide file tree
Showing 15 changed files with 160 additions and 52 deletions.
14 changes: 14 additions & 0 deletions Remotely.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 0 additions & 22 deletions Server/DockerMain.sh

This file was deleted.

17 changes: 6 additions & 11 deletions Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
20 changes: 6 additions & 14 deletions Server/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Server/Dockerfile.old
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion Server/Dockerfile.rootless
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
3 changes: 2 additions & 1 deletion Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +28,8 @@
var configuration = builder.Configuration;
var services = builder.Services;

configuration.AddEnvironmentVariables("Remotely_");

services
.AddRazorComponents()
.AddInteractiveServerComponents();
Expand Down
1 change: 1 addition & 0 deletions Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<RootNamespace>Remotely.Server</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>


Expand Down
2 changes: 1 addition & 1 deletion Server/wwwroot/Content/Install-Manjaro-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Server/wwwroot/Content/Install-Ubuntu-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified Utilities/signtool.exe
Binary file not shown.
20 changes: 20 additions & 0 deletions docker-compose/docker-compose.dcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerComposeProjectName>remotely</DockerComposeProjectName>
<DockerTargetOS>Linux</DockerTargetOS>
<DockerPublishLocally>False</DockerPublishLocally>
<ProjectGuid>90ec49b2-b56a-4ecd-8f63-2162dd140f7c</ProjectGuid>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
<DockerServiceName>server</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>
51 changes: 51 additions & 0 deletions docker-compose/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions docker-compose/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"profiles": {
"Docker Compose": {
"commandName": "DockerCompose",
"commandVersion": "1.0",
"serviceActions": {
"remotely": "StartDebugging"
}
}
}
}

0 comments on commit 2af48bf

Please sign in to comment.