From 3125cf9f5fda65e300b53602be4ff6c497d5b96b Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Sun, 19 Feb 2017 09:38:38 +0200 Subject: [PATCH 1/6] deploy: set default db_storage_path --- deployment/deploy.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/deploy.bash b/deployment/deploy.bash index 8e27d17..47c114e 100644 --- a/deployment/deploy.bash +++ b/deployment/deploy.bash @@ -48,7 +48,7 @@ npm install npm install -g pm2 openssl req -subj "/C=IT/ST=Pool/L=Daemon/O=Mining Pool/CN=mining.pool" -newkey rsa:2048 -nodes -keyout cert.key -x509 -out cert.pem -days 36500 mkdir ~/pool_db/ -cp config_example.json config.json +sed -r "s/(\"db_storage_path\": ).*/\1\"\/home\/$CURUSER\/pool_db\/\",/" config_example.json > config.json cd ~ git clone https://github.com/mesh0000/poolui.git cd poolui From 7ad91e0f6c991c72a9f41b468638fd5233a77c33 Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Sun, 19 Feb 2017 14:32:45 +0200 Subject: [PATCH 2/6] deploy: slightly cleaner caddy installation --- deployment/deploy.bash | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deployment/deploy.bash b/deployment/deploy.bash index 47c114e..cf43c5a 100644 --- a/deployment/deploy.bash +++ b/deployment/deploy.bash @@ -57,10 +57,10 @@ npm install ./node_modules/gulp/bin/gulp.js build cd build sudo ln -s `pwd` /var/www -cd /tmp/ -wget -O caddy.tar.gz 'https://caddyserver.com/download/build?os=linux&arch=amd64&features=cors' -tar -xf caddy.tar.gz -sudo cp caddy /usr/local/bin +CADDY_DOWNLOAD_DIR=$(mktemp -d) +cd $CADDY_DOWNLOAD_DIR +curl -sL "https://caddyserver.com/download/build?os=linux&arch=amd64&features=cors" | tar -xz caddy init/linux-systemd/caddy.service +sudo mv caddy /usr/local/bin sudo chown root:root /usr/local/bin/caddy sudo chmod 755 /usr/local/bin/caddy sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy @@ -74,13 +74,13 @@ sudo chmod 0770 /etc/ssl/caddy sudo cp ~/nodejs-pool/deployment/caddyfile /etc/caddy/Caddyfile sudo chown www-data:www-data /etc/caddy/Caddyfile sudo chmod 444 /etc/caddy/Caddyfile -sudo cp /tmp/init/linux-systemd/caddy.service /etc/systemd/system/ +sudo sh -c "sed 's/ProtectHome=true/ProtectHome=false/' init/linux-systemd/caddy.service > /etc/systemd/system/caddy.service" sudo chown root:root /etc/systemd/system/caddy.service sudo chmod 744 /etc/systemd/system/caddy.service -sudo sed -i 's/ProtectHome=true/ProtectHome=false/' /etc/systemd/system/caddy.service sudo systemctl daemon-reload sudo systemctl enable caddy.service sudo systemctl start caddy.service +rm -rf $CADDY_DOWNLOAD_DIR cd ~ sudo env PATH=$PATH:`pwd`/.nvm/versions/node/v6.9.2/bin `pwd`/.nvm/versions/node/v6.9.2/lib/node_modules/pm2/bin/pm2 startup systemd -u $CURUSER --hp `pwd` cd ~/nodejs-pool From cc37da5eab912a1cbed75261c074f78f5c988b1e Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Tue, 21 Feb 2017 09:55:43 +0200 Subject: [PATCH 3/6] deploy: download blockchain to temporary dir --- deployment/deploy.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deployment/deploy.bash b/deployment/deploy.bash index cf43c5a..e5bb76c 100644 --- a/deployment/deploy.bash +++ b/deployment/deploy.bash @@ -34,9 +34,10 @@ sudo git apply ~/nodejs-pool/deployment/fluffy.patch sudo make -j 4 sudo cp ~/nodejs-pool/deployment/monero.service /lib/systemd/system/ sudo useradd -m monerodaemon -d /home/monerodaemon -wget -O /tmp/blockchain.raw https://downloads.getmonero.org/blockchain.raw -sudo -u monerodaemon /usr/local/src/monero/build/release/bin/monero-blockchain-import --input-file /tmp/blockchain.raw --batch-size 20000 --database lmdb#fastest --verify off --data-dir /home/monerodaemon/.bitmonero -rm -f /tmp/blockchain.raw +BLOCKCHAIN_DOWNLOAD_DIR=$(mktemp -d) +wget -O $BLOCKCHAIN_DOWNLOAD_DIR/blockchain.raw https://downloads.getmonero.org/blockchain.raw +sudo -u monerodaemon /usr/local/src/monero/build/release/bin/monero-blockchain-import --input-file $BLOCKCHAIN_DOWNLOAD_DIR/blockchain.raw --batch-size 20000 --database lmdb#fastest --verify off --data-dir /home/monerodaemon/.bitmonero +rm -rf $BLOCKCHAIN_DOWNLOAD_DIR sudo systemctl daemon-reload sudo systemctl enable monero sudo systemctl start monero From 8bb4eb6d6175cb207ab91e7ad32d5605db01c80b Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Tue, 21 Feb 2017 17:01:50 +0200 Subject: [PATCH 4/6] deploy: limit make jobs to the number of processing units available --- deployment/deploy.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/deploy.bash b/deployment/deploy.bash index e5bb76c..7abc513 100644 --- a/deployment/deploy.bash +++ b/deployment/deploy.bash @@ -31,7 +31,7 @@ sudo git clone https://github.com/monero-project/monero.git cd monero sudo git checkout 15eb2bcf6f2132c5410e937186b6a3121147d628 sudo git apply ~/nodejs-pool/deployment/fluffy.patch -sudo make -j 4 +sudo make -j$(nproc) sudo cp ~/nodejs-pool/deployment/monero.service /lib/systemd/system/ sudo useradd -m monerodaemon -d /home/monerodaemon BLOCKCHAIN_DOWNLOAD_DIR=$(mktemp -d) From c8ce0e9fd9e2dd544d8b7481c17acd017ceb7d85 Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Tue, 21 Feb 2017 18:13:53 +0200 Subject: [PATCH 5/6] deployment: add newline at EOF --- config_example.json | 2 +- deployment/caddyfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config_example.json b/config_example.json index 8900670..cf3ea8a 100644 --- a/config_example.json +++ b/config_example.json @@ -11,4 +11,4 @@ "user": "pool", "password": "98erhfiuehw987fh23d" } -} \ No newline at end of file +} diff --git a/deployment/caddyfile b/deployment/caddyfile index c5bd7df..e2331b7 100644 --- a/deployment/caddyfile +++ b/deployment/caddyfile @@ -12,4 +12,4 @@ } gzip mime .manifest text/cache-manifest -} \ No newline at end of file +} From 3e549eaee3b841d596c22574ce2cfd6fad4185c0 Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Tue, 21 Feb 2017 18:28:06 +0200 Subject: [PATCH 6/6] README: no need to set db_storage_path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 563f4c4..48433a1 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Deployment via Installer 2. Run the [deploy script](https://raw.githubusercontent.com/Snipa22/nodejs-pool/master/deployment/deploy.bash) as a **NON-ROOT USER**. This is very important! This script will install the pool to whatever user it's running under! Also. Go get a coffee, this sucker bootstraps the monero installation. 3. Once it's complete, change as `config.json` appropriate. It is pre-loaded for a local install of everything, running on 127.0.0.1. This will work perfectly fine if you're using a single node setup. You will also want to run: source ~/.bashrc This will activate NVM and get things working for the following pm2 steps. 4. You'll need to change the API end point for the frontend code in the `poolui/app/utils/services.js` -- This will usually be `http:///api` unless you tweak caddy! -5. Change the `db_storage_path` in `config.json` for your database directory to: `/home//pool_db/` The directory's already been created during startup. Or change as appropriate! Just make sure your user has write permissions, then run: `pm2 restart api` to reload the API for usage You'll also want to set `bind_ip` to the external IP of the pool server, and hostname to the resolvable hostname for the pool server. `pool_id` is mostly used for multi-server installations to provide unique identifiers in the backend. +5. Check `config.json` and change as appropriate. The default database directory `/home//pool_db/` is already been created during startup. If you change the `db_storage_path` just make sure your user has write permissions for new path. Run: `pm2 restart api` to reload the API for usage. You'll also want to set `bind_ip` to the external IP of the pool server, and `hostname` to the resolvable hostname for the pool server. `pool_id` is mostly used for multi-server installations to provide unique identifiers in the backend. 6. Hop into the web interface (Should be at `http:///#/admin`), then login with `Administrator/Password123`, **MAKE SURE TO CHANGE THIS PASSWORD ONCE YOU LOGIN**. *<- This step is currently not active, we're waiting for the frontend to catch up! Head down to the Manual SQL Configuration to take a look at what needs to be done by hand for now*. 7. From the admin panel, you can configure all of your pool's settings for addresses, payment thresholds, etc. 8. Once you're happy with the settings, go ahead and start all the pool daemons, commands follow.