Skip to content

Commit

Permalink
Add Server.Installer project.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 14, 2021
1 parent ebdbe46 commit 1b5bc77
Show file tree
Hide file tree
Showing 26 changed files with 1,723 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# CA1416: Validate platform compatibility
dotnet_diagnostic.CA1416.severity = none

# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,5 @@ Server/wwwroot/Content/Win-x86/*
.vscode/launch.json
.vscode/tasks.json
Server/.config/dotnet-tools.json
/Server/Properties/ServiceDependencies/*
/Server/Properties/ServiceDependencies/*
Server.Installer/Properties/launchSettings.json
2 changes: 1 addition & 1 deletion Desktop.Linux/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public async Task Init()
{
try
{
if (Libc.geteuid() != 0)
if (!EnvironmentHelper.IsDebug && Libc.geteuid() != 0)
{
await MessageBox.Show("Please run with sudo.", "Sudo Required", MessageBoxType.OK);
Environment.Exit(0);
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Remotely
A remote control and remote scripting solution, built with .NET Core, SignalR Core, and WebRTC.
A remote control and remote scripting solution, built with .NET 5, Blazor, SignalR Core, and WebRTC.

[![Build Status](https://dev.azure.com/translucency/Remotely/_apis/build/status/Remotely-ReleaseBuild?branchName=master)](https://dev.azure.com/translucency/Remotely/_build/latest?definitionId=17&branchName=master)
![GitHub Build](https://github.com/lucent-sea/Remotely/workflows/GitHub%20Build/badge.svg)
Expand All @@ -26,29 +26,29 @@ Subreddit: https://www.reddit.com/r/remotely_app/


## Disclaimer
Hosting a Remotely server requires building and running an ASP.NET Core web app behind IIS (Windows), Nginx (Ubuntu), or Caddy Server (any OS). It's expected that the person deploying and maintaining the server is familiar with this process.
Hosting a Remotely server requires running an ASP.NET Core web app behind IIS (Windows), Nginx (Ubuntu), or Caddy Server (any OS). It's expected that the person deploying and maintaining the server is familiar with this process. Since this is a hobby project that I develop in between working full time and raising a family, there simply isn't time available to provide support in this capacity.

It's *highly* encouraged that you get comfortable building and deploying from source. This allows you to hard-code your server's hostname into the desktop client and the installer, which makes for a better experience for the end user. I've tried to make this as easy as possible using the GitHub Actions workflows mentioned below. You can begin using these immediately, or use them as a reference for creating your own customized build process. You can also use Azure Pipelines for free (which I personally use).
## Build Instructions
GitHub Actions allows you to build and deploy Remotely for free from their cloud servers. Since the Windows agent can only be built on Windows, and the Mac agent can only be built on Mac, using a build platform like GitHub Actions or Azure Pipelines is the only reasonable way to build the whole project. The definitions for the build processes are located in `/.github/workflows/` folder.

## Build Instructions (GitHub)
GitHub Actions allows you to build and deploy Remotely for free from their cloud servers. The definitions for the build processes are located in `/.github/workflows/` folder.
I've created a cross-platform command line tool that will leverage the GitHub Actions REST API to build the project and install it on your private server. This process will also embed your server's URL into the clients, so that they won't need to prompt the end user to enter it.

After forking the repo, follow the instructions in the workflow YML file. The easiest workflow to use is the Build.yml worfklow, and I'd recommend starting with that one. It will produce a build artifact (ZIP package) identical to what was on the Releases page, only the clients will have your server URL hard-coded.

### Instructions for using the Build workflow:
### Instructions for using the Remotely_Server_Installer CLI tool:
- Fork the repo if you haven't already.
- If you've already forked the repo, you need to keep your repo updated with mine. This doesn't happen automatically.
- This can be done via the command line if you've cloned your repo locally. Refer to [GitHub's docs](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork) on how to do this. Otherwise, see below for how to do it completely through the GitHub website.
- On the GitHub page for your repo, you'll see a message that says, "This branch is ## commits behind lucent-sea:master".
- Click the "Pull request" link next to it.
- On the next page, click the "switching the base" link. Now it's pulling from my repo into yours.
- Create and complete the pull request to update your repo.
- Now go to the Actions tab.
- Click the "Build" workflow.
- Click "Run workflow".
- Enter the Server URL where your Remotely app will be running (e.g. https://app.remotely.one).
- If you're going to host on Windows, change the Server Runtime Identifier to `win-x64`.
- Click "Run workflow".
- When it's finished, there will be a build artifact for download that contains the server and clients.
- Create a Personal Access Token that the installer will use to authenticate with GitHub.
- Located here: https://github.com/settings/tokens
- Save the PAT when it's displayed. It will only be shown once.
- On your server, download the latest server installer executable (Linux or Windows) from [my releases page](https://github.com/lucent-sea/Remotely/releases).
- Run the app with elevation (e.g. sudo or "Run as admin").
- Follow the prompts to build and install the server.
- Use `--help` argument to see all the command line arguments.
- If values are provided for all arguments, it will run non-interactive.


## Hosting a Server (Windows)
Expand Down
17 changes: 14 additions & 3 deletions Remotely.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Agent", "Agent\Agent.csproj
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{2CAC9A2B-1402-465F-83F8-958B4E081CA3}"
ProjectSection(SolutionItems) = preProject
Utilities\CentOS_Server_Install.sh = Utilities\CentOS_Server_Install.sh
Utilities\Example_Apache_Config.txt = Utilities\Example_Apache_Config.txt
Example_Nginx_Config.txt = Example_Nginx_Config.txt
Utilities\Get-PSCommands.ps1 = Utilities\Get-PSCommands.ps1
Utilities\Get-WindowsCommands.ps1 = Utilities\Get-WindowsCommands.ps1
Utilities\Install-RemotelyServer.ps1 = Utilities\Install-RemotelyServer.ps1
Utilities\Publish.ps1 = Utilities\Publish.ps1
Utilities\signtool.exe = Utilities\signtool.exe
Utilities\Ubuntu_Server_Install.sh = Utilities\Ubuntu_Server_Install.sh
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{D96B47F6-EF3E-4AF6-A1BE-006D531DDBA4}"
Expand Down Expand Up @@ -49,6 +46,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "Server\Server.csproj", "{75EC5DCD-DC76-4799-8623-206B1F73CA95}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.Installer", "Server.Installer\Server.Installer.csproj", "{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -167,6 +166,18 @@ Global
{75EC5DCD-DC76-4799-8623-206B1F73CA95}.Release|x64.Build.0 = Release|Any CPU
{75EC5DCD-DC76-4799-8623-206B1F73CA95}.Release|x86.ActiveCfg = Release|Any CPU
{75EC5DCD-DC76-4799-8623-206B1F73CA95}.Release|x86.Build.0 = Release|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Debug|x64.ActiveCfg = Debug|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Debug|x64.Build.0 = Debug|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Debug|x86.ActiveCfg = Debug|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Debug|x86.Build.0 = Debug|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Release|Any CPU.Build.0 = Release|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Release|x64.ActiveCfg = Release|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Release|x64.Build.0 = Release|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Release|x86.ActiveCfg = Release|Any CPU
{BE7799D6-204C-4D35-83E7-7FB24DEBAE94}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
19 changes: 19 additions & 0 deletions Server.Installer/Models/CliParams.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server.Installer.Models
{
public class CliParams
{
public bool? CreateNew { get; set; }
public string GitHubPat { get; set; }
public string GitHubUsername { get; set; }
public string InstallDirectory { get; set; }
public string Reference { get; set; }
public Uri ServerUrl { get; set; }
public WebServerType? WebServer { get; set; }
}
}
28 changes: 28 additions & 0 deletions Server.Installer/Models/GitHubArtifactsResponsePayload.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server.Installer.Models
{
public class ArtifactsResponsePayload
{
public int total_count { get; set; }
public Artifact[] artifacts { get; set; }
}

public class Artifact
{
public int id { get; set; }
public string node_id { get; set; }
public string name { get; set; }
public int size_in_bytes { get; set; }
public string url { get; set; }
public string archive_download_url { get; set; }
public bool expired { get; set; }
public DateTime created_at { get; set; }
public DateTime expires_at { get; set; }
public DateTime updated_at { get; set; }
}
}
19 changes: 19 additions & 0 deletions Server.Installer/Models/WebServerType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Server.Installer.Models
{
public enum WebServerType
{
UbuntuCaddy,
UbuntuNginx,
CentOsCaddy,
CentOsNginx,
IisWindows
}
}

0 comments on commit 1b5bc77

Please sign in to comment.