From 6268fb78e95e5659c1130c5b6f70ccdb1a7dbe46 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Tue, 14 Apr 2020 11:55:45 +0000 Subject: [PATCH] Update docs/InstallationNotes.md --- docs/InstallationNotes.md | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 docs/InstallationNotes.md diff --git a/docs/InstallationNotes.md b/docs/InstallationNotes.md new file mode 100644 index 0000000..78d7b4e --- /dev/null +++ b/docs/InstallationNotes.md @@ -0,0 +1,66 @@ +# Installation + +## Create user +```bash +sudo adduser --disabled-login comunic_rtc_proxy +``` + +## Install go & build project +As `comunic_rtc_proxy`, download & install go: +```bash +# Login as comunic_rtc_proxy +sudo -u comunic_rtc_proxy bash +cd + +# Download & extract go +wget https://dl.google.com/go/go1.14.2.linux-armv6l.tar.gz +tar -xf go1.14.2.linux-armv6l.tar.gz + +# Add Go to path +export PATH=$PATH:/home/comunic_rtc_proxy/go/bin +echo "export PATH=\$PATH:/home/comunic_rtc_proxy/go/bin" >> .bashrc + +# Generate go workspace +mkdir -p go_workspace/src +export GOPATH=$(pwd)/go_workspace +echo "export GOPATH=\$HOME/go_workspace" >> .bashrc + +# Get sources & compile them +cd $GOPATH +git clone https://gitlab.com/comunic/ComunicRTCProxy comunic_rtc_proxy +cd comunic_rtc_proxy/ + +go get +go build +``` + +## Generate custom configuration +Copy the default configuration file `config.yaml` into `config.custom.yaml` and customize it to fit your needs. + +## Install the proxy as a service +Create the file `/etc/systemd/system/comunic_rtc_proxy.service`: +```conf +[Unit] +Description=Comunic RTC proxy +After=syslog.target +After=network.target + +[Service] +RestartSec=2s +Type=simple +User=comunic_rtc_proxy +Group=comunic_rtc_proxy +WorkingDirectory=/home/comunic_rtc_proxy/ +ExecStart=/home/comunic_rtc_proxy/go_workspace/comunic_rtc_proxy/comunic_rtc_proxy /home/comunic_rtc_proxy/go_workspace/comunic_rtc_proxy/config.custom.yaml +Restart=always +Environment=USER=comunic_rtc_proxy + +[Install] +WantedBy=multi-user.target +``` + +Enable & start the new service: +```bash +sudo systemctl enable comunic_rtc_proxy.service +sudo systemctl start comunic_rtc_proxy.service +```