mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
78 lines
1.8 KiB
Bash
78 lines
1.8 KiB
Bash
#!/bin/bash
|
|
echo "Thanks for trying Remotely!"
|
|
echo
|
|
|
|
AppRoot=$(dirname $(readlink -f $0))
|
|
HostName=""
|
|
|
|
echo "Using $AppRoot as the Remotely website's content directory."
|
|
|
|
UbuntuVersion=$(lsb_release -r -s)
|
|
|
|
|
|
# Install .NET Core Runtime.
|
|
wget -q https://packages.microsoft.com/config/ubuntu/$UbuntuVersion/packages-microsoft-prod.deb
|
|
dpkg -i packages-microsoft-prod.deb
|
|
add-apt-repository universe
|
|
apt-get update
|
|
apt-get -y install apt-transport-https
|
|
apt-get -y install aspnetcore-runtime-5.0
|
|
rm packages-microsoft-prod.deb
|
|
|
|
|
|
# Install other prerequisites.
|
|
apt-get -y install unzip
|
|
apt-get -y install acl
|
|
apt-get -y install libc6-dev
|
|
apt-get -y install libgdiplus
|
|
|
|
|
|
# Install Caddy
|
|
apt install -y debian-keyring debian-archive-keyring apt-transport-https
|
|
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
|
|
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
|
|
apt update
|
|
apt install caddy
|
|
|
|
|
|
# Configure Caddy
|
|
caddyConfig="
|
|
$HostName {
|
|
reverse_proxy 127.0.0.1:5000
|
|
}
|
|
"
|
|
|
|
echo "$caddyConfig" > /etc/caddy/Caddyfile
|
|
|
|
|
|
# Create Remotely service.
|
|
|
|
serviceConfig="[Unit]
|
|
Description=Remotely Server
|
|
|
|
[Service]
|
|
WorkingDirectory=$AppRoot
|
|
ExecStart=/usr/bin/dotnet $AppRoot/Remotely_Server.dll
|
|
Restart=always
|
|
# Restart service after 10 seconds if the dotnet service crashes:
|
|
RestartSec=10
|
|
SyslogIdentifier=remotely
|
|
Environment=ASPNETCORE_ENVIRONMENT=Production
|
|
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target"
|
|
|
|
echo "$serviceConfig" > /etc/systemd/system/remotely.service
|
|
|
|
|
|
# Enable service.
|
|
systemctl enable remotely.service
|
|
# Start service.
|
|
systemctl restart remotely.service
|
|
|
|
|
|
# Restart caddy
|
|
systemctl restart caddy
|
|
|
|
echo "Installation completed." |