From cd619d7a929f99d512a00cdff297b18051491e76 Mon Sep 17 00:00:00 2001 From: Peter-Jan Brone Date: Thu, 19 Mar 2020 15:38:34 +0100 Subject: [PATCH] Update Nginx config to use double siad setup (#97) * Update nginx conf to use double siad setup * Update documentation --- setup-scripts/README.md | 11 ++++++++--- setup-scripts/skynet-nginx.conf | 12 +++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/setup-scripts/README.md b/setup-scripts/README.md index 8a8281ae..ff207fba 100644 --- a/setup-scripts/README.md +++ b/setup-scripts/README.md @@ -57,13 +57,18 @@ 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 +It is recommended to run 2 `siad` nodes on the same server. One node to +prioritize downloads and one to prioritze uploads. This will drastically improve +performance of both up - and download. The setup scripts assume this double siad +setup and perform 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. +Note that running 2 `siad` nodes is not obligatory. You can run a portal with +just one `siad` node just fine. If you choose to do so, simply ignore the second +`siad` node and point everything to your single node instead. + 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. diff --git a/setup-scripts/skynet-nginx.conf b/setup-scripts/skynet-nginx.conf index 67ad55d0..f4d7c970 100644 --- a/setup-scripts/skynet-nginx.conf +++ b/setup-scripts/skynet-nginx.conf @@ -46,8 +46,18 @@ server { location /skynet/skyfile/ { client_max_body_size 1000M; # make sure to limit the size of upload to a sane value proxy_read_timeout 600; + # proxy this call to siad endpoint (make sure the ip is correct) - proxy_pass http://127.0.0.1:9980; + # + # note that we point uploads to port '9970', do this when you want to + # run in a configuration where you have two siad instances, one for + # downloads and one for uploads. This drastically improves the up - and + # download speed of your portal. When running your portal in this double + # siad setup, make sure only the download portal runs in 'portal mode'. + # The upload siad can be run in normal mode. Set the port to '9980' if + # you do not want to run your portal in the double siad setup. + proxy_pass http://127.0.0.1:9970; + proxy_set_header Expect $http_expect; add_header Access-Control-Allow-Origin *; proxy_hide_header Access-Control-Allow-Origin;