Merge pull request #54 from NebulousLabs/2020-03-add-upload-siad-systemd

Add upload siad support
This commit is contained in:
Marcin Jachymiak 2020-03-03 10:44:55 -05:00 committed by GitHub
commit 67b38fff66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 1 deletions

View File

@ -55,10 +55,28 @@ done so.
To enable the service: `systemctl --user enable siad.service` To enable the service: `systemctl --user enable siad.service`
### Running 2 siad instances
In some cases, portal operators may want to run 2 `siad` nodes on the same
server. One node to prioritize downloads and one to prioritze uploads The
scripts here also do the initial setup for a 2nd `siad` instance running as a
systemd service `siad-upload.service` in the `~/siad-upload/` directory with
environment variables in `sia-upload.env`. You must fill out the correct values
for those environment variables.
The `bashrc` file in this repository also provides an alias `siac-upload` that
loads the correct environment variables and sets the correct ports to interact
with the 2nd `siad` node.
`siac` is used to operate node 1, and `siac-upload` is used to operate node 2.
To enable the 2nd service: `systemctl --user enable siad-upload.service`
### Useful Commands ### Useful Commands
To start the service: `systemctl --user start siad` To start the service: `systemctl --user start siad`
To stop it: `systemctl --user stop siad` To stop it: `systemctl --user stop siad`
To check the status of it: `systemctl --user status siad` To check the status of it: `systemctl --user status siad`
To check standard err/standard out: `journalctl --user-unit siad` To check standard err/standard out: `journalctl --user-unit siad`

View File

@ -116,3 +116,5 @@ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/
set -o allexport set -o allexport
source ~/.sia/sia.env source ~/.sia/sia.env
set +o allexport set +o allexport
alias siac-upload="source ~/.sia/source-upload.sh; siac --addr 'localhost:9970'"

View File

@ -65,10 +65,13 @@ cd ../
yarn yarn
yarn build yarn build
# Enable the systemd service # Setup systemd files
cd $cwd cd $cwd
mkdir -p ~/.config/systemd/user mkdir -p ~/.config/systemd/user
cp siad.service ~/.config/systemd/user/siad.service cp siad.service ~/.config/systemd/user/siad.service
cp siad-upload.service ~/.config/systemd/user/siad-upload.service
# Setup files for storing environment variables
mkdir -p ~/.sia mkdir -p ~/.sia
cp sia.env ~/.sia/ cp sia.env ~/.sia/
cp sia.env ~/.sia/sia-upload.env

View File

@ -0,0 +1,13 @@
[Unit]
Description=siad-upload
[Service]
Type=simple
WorkingDirectory=/home/user/siad-upload
EnvironmentFile=/home/user/.sia/sia-upload.env
ExecStart=/home/user/go/bin/siad --api-addr "localhost:9970" --host-addr ":9972" --rpc-addr ":9971"
ExecStop=/home/user/go/bin/siac --api-addr "localhost:9970" --host-addr ":9972" --rpc-addr ":9971" stop
Restart=on-failure
[Install]
WantedBy=default.target

6
setup-scripts/source-upload.sh Executable file
View File

@ -0,0 +1,6 @@
#! /usr/bin/env bash
set -e
set -o allexport
source ~/.sia/sia-upload.env
set +o allexport