-
-
Save felixcheruiyot/7a1656c075e7b8cf957faa0df8d6a805 to your computer and use it in GitHub Desktop.
Revisions
-
Stadicus revised this gist
Sep 24, 2019 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -232,7 +232,11 @@ $ npm install -g lightning-charge ### if you get an error, try this $ sudo npm install --unsafe-perm -g lightning-charge ``` See this issue if installation hangs on installing a certain package (maybe due to git:// url) https://github.com/npm/npm/issues/18448#issuecomment-365163151 ``` ### check operations (optional) ### in "bitcoin" user session $ charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN defaults: --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning/charge.db --port 9112 -
Stadicus revised this gist
Aug 27, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,7 +61,7 @@ Description=sPRUNED Bitcoin node After=network.target [Service] ExecStart=/home/bitcoin/spruned/venv/bin/spruned --network bitcoin.mainnet --rpcuser xxx --rpcpassword xxx Type=simple User=bitcoin Restart=on-failure -
Stadicus revised this gist
Aug 23, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,7 +61,7 @@ Description=sPRUNED Bitcoin node After=network.target [Service] ExecStart=/home/bitcoin/spruned/venv/bin/spruned --network bitcoin.mainnet --rpcuser xxx --rpcpassword xxx --cache-size 5000 Type=simple User=bitcoin Restart=on-failure -
Stadicus revised this gist
Aug 10, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,7 @@ $ python setup.py install $ exit ### systemd startup $ sudo nano /etc/systemd/system/spruned.service ``` ``` # sPRUNED: systemd unit -
Stadicus revised this gist
Aug 10, 2018 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,10 @@ ## UFW & basic stuff Login as "root" ``` $ apt update $ apt upgrade $ apt install ufw fail2ban $ ufw app list $ ufw default deny incoming $ ufw default allow outgoing @@ -19,10 +23,6 @@ $ ufw enable $ systemctl enable ufw $ ufw status ### create sudo user $ adduser stadicus $ adduser stadicus sudo -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,7 @@ $ ufw status $ apt update $ apt upgrade $ apt install fail2ban ### create sudo user $ adduser stadicus -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -286,4 +286,6 @@ $ sudo certbot --nginx -d your.domainname.com ### open nginx block and change "443" to "9001" $ sudo nano /etc/nginx/sites-available/charged $ sudo systemctl reload nginx ### check https://your.domainname.com:9001 in your browser ``` -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -116,6 +116,7 @@ $ sudo make install ### systemd startup $ sudo nano /etc/systemd/system/lightning.service ``` ``` # c-Lightning: systemd unit # /etc/systemd/system/lightning.service @@ -135,6 +136,7 @@ RestartSec=10 [Install] WantedBy=multi-user.target ``` ``` ### c-lightning configuration sudo mkdir /home/bitcoin/.lightning sudo nano /home/bitcoin/.lightning/config @@ -240,6 +242,7 @@ $ curl localhost:9112 ### as sudo user $ sudo nano /etc/systemd/system/charged.service` ``` ``` # Lightning Charge: systemd unit # /etc/systemd/system/charged.service @@ -260,7 +263,6 @@ RestartSec=10 [Install] WantedBy=multi-user.target ``` ``` ### start & enable $ sudo systemctl start lightning @@ -269,7 +271,6 @@ $ sudo systemctl enable lightning $ sudo tail -f ``` ## Enable SSL https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 ``` -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 60 additions and 72 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ # E-Commerce c-lightning node on Digital Ocean ## Prerequisites * based on small Digital Ocean VPS (1CPU / 1GB RAM) with Ubuntu 16.04 * SSH keys are recommended, but not described here * (sub) domain name necessary for SSL certificate ## UFW & basic stuff Login as "root" ``` $ ufw app list $ ufw default deny incoming $ ufw default allow outgoing @@ -18,29 +18,39 @@ $ ufw allow 9001 comment 'allow Lightning Charge HTTPS' $ ufw enable $ systemctl enable ufw $ ufw status $ apt update $ apt upgrade ### create sudo user $ adduser stadicus $ adduser stadicus sudo ### create service user $ adduser bitcoin $ exit ``` ## sPRUNED https://github.com/gdassori/spruned ``` ### with sudo user $ sudo apt install libleveldb-dev python3-dev git virtualenv gcc g++ $ sudo su - bitcoin ### with bitcoin user $ git clone https://github.com/gdassori/spruned.git $ cd spruned $ virtualenv -p python3.5 venv $ . venv/bin/activate $ pip install -r requirements.txt $ python setup.py install $ exit ### systemd startup $ sudo nano /etc/systemd/system/spruned.service` ``` ``` # sPRUNED: systemd unit # /etc/systemd/system/spruned.service @@ -59,8 +69,8 @@ RestartSec=5 [Install] WantedBy=multi-user.target ``` ``` ### start and enable the new service $ sudo systemctl start spruned $ sudo systemctl status spruned $ sudo systemctl enable spruned @@ -71,13 +81,15 @@ $ sudo tail -f /home/bitcoin/.spruned/spruned.log https://bitcoin.org/en/download ``` ### with sudo user $ mkdir download && cd download $ wget https://bitcoin.org/bin/bitcoin-core-0.16.1/bitcoin-0.16.1-x86_64-linux-gnu.tar.gz $ tar -xvf bitcoin-0.16.1-x86_64-linux-gnu.tar.gz $ sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.16.1/bin/bitcoin-cli $ cd $ rm -rf download ### bitcoin-cli configuration $ sudo mkdir /home/bitcoin/.bitcoin $ sudo nano /home/bitcoin/.bitcoin/bitcoin.conf ``` @@ -90,10 +102,8 @@ rpcpassword=xxx ## c-lightning https://github.com/ElementsProject/lightning ``` ### with admin user $ sudo apt-get install -y autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev python python3 net-tools zlib1g-dev $ cd $ git clone https://github.com/ElementsProject/lightning.git $ cd lightning @@ -102,10 +112,9 @@ $ git checkout tags/v0.6 $ ./configure $ make $ sudo make install ### systemd startup $ sudo nano /etc/systemd/system/lightning.service ``` # c-Lightning: systemd unit # /etc/systemd/system/lightning.service @@ -120,34 +129,13 @@ ExecStart=/usr/local/bin/lightningd --pid-file=/home/bitcoin/.lightning/lightnin PIDFile=/home/bitcoin/.lightning/lightning.pid User=bitcoin Type=forking Restart=always RestartSec=10 [Install] WantedBy=multi-user.target ``` ### c-lightning configuration sudo mkdir /home/bitcoin/.lightning sudo nano /home/bitcoin/.lightning/config ``` @@ -161,18 +149,16 @@ bitcoin-rpcconnect=localhost bitcoin-rpcport=8332 log-file=/home/bitcoin/.lightning/lightning.log ``` ``` ### set bitcoin as owner, start and enable $ sudo chown -R bitcoin:bitcoin /home/bitcoin/.lightning/ $ sudo systemctl start lightning $ sudo systemctl status lightning $ sudo systemctl enable lightning $ sudo tail -f /home/bitcoin/.lightning/lightning.log ``` ``` ### Check setup $ sudo su - bitcoin $ bitcoin-cli getblockchaininfo { @@ -197,13 +183,14 @@ $ lightning-cli newaddr https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04 ``` ### as sudo user $ sudo apt-get install nginx $ sudo ufw allow "Nginx Full" $ systemctl status nginx ### point domain name to this server and check Nginx website with your browser ### configure Nginx $ sudo nano /etc/nginx/sites-available/charged ``` ``` @@ -221,50 +208,50 @@ server { } ``` ``` ### enable Nginx block $ sudo rm /etc/nginx/sites-enabled/default $ sudo ln /etc/nginx/sites-available/charged /etc/nginx/sites-enabled/charged $ sudo nginx -t $ sudo systemctl reload nginx ``` ## Node.js ``` ### as sudo user $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - $ sudo apt-get install -y nodejs build-essential ``` ## Lightning Charge ``` ### sometimes, this step caused some errors. Not sure why $ npm install -g lightning-charge ### if you get an error, try this $ sudo npm install --unsafe-perm -g lightning-charge ### check operations (optional) ### in "bitcoin" user session $ charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN defaults: --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning/charge.db --port 9112 ### different user session on the same machine: $ curl localhost:9112 ``` ``` ### as sudo user $ sudo nano /etc/systemd/system/charged.service` ``` # Lightning Charge: systemd unit # /etc/systemd/system/charged.service [Unit] Description=Lightning Charge After=lightning.service Requires=lightning.service [Service] WorkingDirectory=/home/bitcoin/.lightning ExecStartPre=/bin/sh -c 'sleep 30' ExecStart=/usr/bin/charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning/charge.db --port 9112 User=bitcoin Type=simple Restart=always @@ -273,12 +260,13 @@ RestartSec=10 [Install] WantedBy=multi-user.target ``` ``` ### start & enable $ sudo systemctl start lightning $ sudo systemctl status lightning $ sudo systemctl enable lightning $ sudo tail -f ``` @@ -290,11 +278,11 @@ $ sudo apt update $ sudo apt install python-certbot-nginx $ sudo certbot --nginx -d your.domainname.com ### when asked, do not redirect HTTPS traffic at the moment ### check website again, using https://.... ### open nginx block and change "443" to "9001" $ sudo nano /etc/nginx/sites-available/charged $ sudo systemctl reload nginx ``` -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 17 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -244,7 +244,7 @@ $ sudo npm install --unsafe-perm -g lightning-charge To check operations (optional): ``` # in "bitcoin" user session $ charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN defaults: --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning/charge.db --port 9112 # different user session on the same machine: $ curl localhost:9112 @@ -259,17 +259,28 @@ As admin user: [Unit] Description=Lightning Charge After=lightning.service [Service] WorkingDirectory=/home/bitcoin/.lightning ExecStartPre=/bin/sh -c 'sleep 30' ExecStart=/usr/bin/charged --api-token 8d6i%3hkd!7asd_hgd87 --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning/charge.db --port 9112 User=bitcoin Type=simple Restart=always RestartSec=10 [Install] WantedBy=multi-user.target ``` Start & enable: ``` $ sudo systemctl start lightning $ sudo systemctl status lightning $ sudo systemctl enable lightning $ sudo tail -f /home/bitcoin/.lightning/lightning.log ``` ## Enable SSL https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -237,6 +237,9 @@ sudo apt-get install -y nodejs build-essential ## Lightning Charge ``` $ npm install -g lightning-charge # if you get an error, try this $ sudo npm install --unsafe-perm -g lightning-charge ``` To check operations (optional): ``` -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -231,7 +231,7 @@ $ sudo systemctl reload nginx as admin user ``` curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs build-essential ``` ## Lightning Charge -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 3 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -228,23 +228,14 @@ $ sudo systemctl reload nginx ``` ## Node.js as admin user ``` curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs ``` ## Lightning Charge ``` $ npm install -g lightning-charge ``` To check operations (optional): -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 13 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,8 @@ $ ufw default deny incoming $ ufw default allow outgoing $ ufw allow OpenSSH $ ufw allow 9735 comment 'allow Lightning' $ ufw allow 9000 comment 'allow Lightning Charge HTTP' $ ufw allow 9001 comment 'allow Lightning Charge HTTPS' $ ufw enable $ systemctl enable ufw $ ufw status @@ -218,8 +220,12 @@ server { } } ``` ``` $ sudo rm /etc/nginx/sites-enabled/default $ sudo ln /etc/nginx/sites-available/charged /etc/nginx/sites-enabled/charged $ sudo nginx -t $ sudo systemctl reload nginx ``` ## Node.js Installation of node.js for user "bitcoin" only, using the Node Version Manager (nvm) @@ -281,4 +287,9 @@ $ sudo certbot --nginx -d your.domainname.com # when asked, do not redirect HTTPS traffic at the moment # check website again, using https://.... # open nginx block and change "443" to "9001" $ sudo nano /etc/nginx/sites-available/charged $ sudo systemctl reload nginx ``` -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 52 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -199,7 +199,27 @@ $ sudo apt-get install nginx $ sudo ufw allow "Nginx Full" $ systemctl status nginx ``` * setup domain name to this new server and check Nginx website with your browser ``` $ sudo nano /etc/nginx/sites-available/charged ``` ``` server { listen 9000; server_name your.domainname.com; location / { proxy_pass http://127.0.0.1:9112; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` sudo ln /etc/nginx/sites-available/charged /etc/nginx/sites-enabled/charged ## Node.js Installation of node.js for user "bitcoin" only, using the Node Version Manager (nvm) @@ -210,17 +230,46 @@ Install as user "bitcoin" ``` $ sudo su - bitcoin $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - ### $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash $ nvm install node $ exit ``` ## Lightning Charge Install as user "bitcoin" ``` $ sudo su - bitcoin $ npm install -g lightning-charge ``` To check operations (optional): ``` # in "bitcoin" user session $ charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN defaults: --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning-charge/charge.db --port 9112 # different user session on the same machine: $ curl localhost:9112 ``` As admin user: `$ sudo nano /etc/systemd/system/charged.service` ``` # Lightning Charge: systemd unit # /etc/systemd/system/charged.service [Unit] Description=Lightning Charge Requires=lightning.service After=lightning.service [Service] ExecStart=/home/bitcoin/.nvm/versions/node/v10.7.0/bin/charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN defaults: --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning-charge/charge.db --port 9112 User=bitcoin Group=bitcoin Type=forking Restart=on-failure RestartSec=10 ``` ## Enable SSL https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 -
Stadicus revised this gist
Jul 26, 2018 . 1 changed file with 66 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ ## Prerequisites * based on small VPS with Ubuntu 16.04 * set up directly with SSH keys, work with your own sudo user (not root) * (sub) domain name necessary for SSL certificate ## UFW ``` @@ -159,15 +160,76 @@ bitcoin-rpcport=8332 log-file=/home/bitcoin/.lightning/lightning.log ``` Set bitcoin as owner, start and enable unit ``` $ sudo chown -R bitcoin:bitcoin /home/bitcoin/.lightning/ $ sudo systemctl start lightning $ sudo systemctl status lightning $ sudo systemctl enable lightning $ sudo tail -f /home/bitcoin/.lightning/lightning.log ``` ## Check setup ``` $ sudo su - bitcoin $ bitcoin-cli getblockchaininfo { "blocks": 533666, "pruned": false, "chainwork": null, "headers": 533666, "bestblockhash": "0000000000000000001b65cc396bfdd8cff3a712f2f31b5ee7feb963314a5acd", "difficulty": null, "mediantime": 1532556068, "chain": "main", "warning": "spruned 0.0.2a3, emulating bitcoind v0.16", "verificationprogress": 100 } $ lightning-cli -h $ lightning-cli connect [email protected]:9735 ## get a random node from 1ml.com $ lightning-cli listpeers $ lightning-cli newaddr ``` ## Nginx https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04 ``` $ sudo apt-get install nginx $ sudo ufw allow "Nginx Full" $ systemctl status nginx ``` setup domain name to this new server and check Nginx website with your browser ## Node.js Installation of node.js for user "bitcoin" only, using the Node Version Manager (nvm) * https://github.com/nodesource/distributions * https://github.com/creationix/nvm#long-term-support Install as user "bitcoin" ``` $ sudo su - bitcoin $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash $ nvm install node $ exit ``` ## Lightning Charge ``` $ charged --api-token REPLACE_WITH_YOUR_SECRET_TOKEN defaults: --ln-path /home/bitcoin/.lightning --db-path /home/bitcoin/.lightning-charge/charge.db --port 9112 ``` In a different user session on the same machine, check if the service is running: `$ curl localhost:9112 ` ## Enable SSL https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 ``` $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt update $ sudo apt install python-certbot-nginx $ sudo certbot --nginx -d your.domainname.com # when asked, do not redirect HTTPS traffic at the moment # check website again, using https://.... ``` -
Stadicus revised this gist
Jul 25, 2018 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -143,6 +143,21 @@ RestartSec=10 [Install] WantedBy=multi-user.target ``` Create config ``` sudo mkdir /home/bitcoin/.lightning sudo nano /home/bitcoin/.lightning/config ``` ``` alias=Your_Node_Alias log-level=debug network=bitcoin bitcoin-rpcuser=xxx bitcoin-rpcpassword=xxx bitcoin-rpcconnect=localhost bitcoin-rpcport=8332 log-file=/home/bitcoin/.lightning/lightning.log ``` Start and enable unit ``` -
Stadicus revised this gist
Jul 25, 2018 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,7 @@ $ exit https://github.com/gdassori/spruned ``` $ sudo apt-get update $ sudo apt-get install libleveldb-dev python3-dev git virtualenv gcc g++ $ sudo adduser bitcoin $ sudo su - bitcoin @@ -46,7 +47,7 @@ Description=sPRUNED Bitcoin node After=network.target [Service] ExecStart=/home/bitcoin/spruned/venv/bin/spruned --network bitcoin.mainnet --rpcuser xxx --rpcpassword xxx Type=simple User=bitcoin Restart=on-failure @@ -57,10 +58,10 @@ WantedBy=multi-user.target ``` Start & enable ``` $ sudo systemctl start spruned $ sudo systemctl status spruned $ sudo systemctl enable spruned $ sudo tail -f /home/bitcoin/.spruned/spruned.log ``` ## bitcoin-cli @@ -74,7 +75,7 @@ $ wget https://bitcoin.org/bin/bitcoin-core-0.16.1/bitcoin-0.16.1-x86_64-linux-g $ tar -xvf bitcoin-0.16.1-x86_64-linux-gnu.tar.gz $ sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.16.1/bin/bitcoin-cli $ sudo mkdir /home/bitcoin/.bitcoin $ sudo nano /home/bitcoin/.bitcoin/bitcoin.conf ``` ``` @@ -87,13 +88,10 @@ rpcpassword=xxx https://github.com/ElementsProject/lightning ``` # admin user session $ sudo apt-get install -y \ autoconf automake build-essential git libtool libgmp-dev \ libsqlite3-dev python python3 net-tools zlib1g-dev $ cd $ git clone https://github.com/ElementsProject/lightning.git $ cd lightning $ git tag -l @@ -154,3 +152,7 @@ $ sudo systemctl status lightning $ sudo systemctl enable lightning ``` ## Node.js on Digital Ocean https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04 -
Stadicus revised this gist
Jul 25, 2018 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,21 @@ ## Prerequisites * based on small VPS with Ubuntu 16.04 * set up directly with SSH keys, work with your own sudo user (not root) ## UFW ``` $ sudo su $ ufw app list $ ufw default deny incoming $ ufw default allow outgoing $ ufw allow OpenSSH $ ufw allow 9735 comment 'allow Lightning' $ ufw enable $ systemctl enable ufw $ ufw status $ exit ``` ## sPRUNED https://github.com/gdassori/spruned -
Stadicus created this gist
Jul 25, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,141 @@ # E-Commerce c-lightning node on Digital Ocean ## Prerequisites * based on small VPS with Ubuntu 16.04 ## sPRUNED https://github.com/gdassori/spruned ``` $ sudo apt-get install libleveldb-dev python3-dev git virtualenv gcc g++ $ sudo adduser bitcoin $ sudo su - bitcoin # bitcoin user session $ git clone https://github.com/gdassori/spruned.git $ cd spruned $ virtualenv -p python3.5 venv $ . venv/bin/activate $ pip install -r requirements.txt $ python setup.py install $ exit ``` `$ sudo nano /etc/systemd/system/spruned.service` ``` # sPRUNED: systemd unit # /etc/systemd/system/spruned.service [Unit] Description=sPRUNED Bitcoin node After=network.target [Service] ExecStart=/home/bitcoin/src/venv/bin/spruned --network bitcoin.mainnet --rpcuser xxx --rpcpassword xxx Type=simple User=bitcoin Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target ``` Start & enable ``` $ sudo systemctl daemon-reload $ sudo systemctl start spruned $ sudo systemctl status spruned $ sudo systemctl enable spruned ``` ## bitcoin-cli https://bitcoin.org/en/download ``` # admin user session $ mkdir download && cd download $ wget https://bitcoin.org/bin/bitcoin-core-0.16.1/bitcoin-0.16.1-x86_64-linux-gnu.tar.gz $ tar -xvf bitcoin-0.16.1-x86_64-linux-gnu.tar.gz $ sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.16.1/bin/bitcoin-cli $ mkdir /home/bitcoin/.bitcoin $ sudo nano /home/bitcoin/.bitcoin/bitcoin.conf ``` ``` # Connection settings rpcuser=xxx rpcpassword=xxx ``` ## c-lightning https://github.com/ElementsProject/lightning ``` # admin user session $ sudo apt-get update $ sudo apt-get install -y \ autoconf automake build-essential git libtool libgmp-dev \ libsqlite3-dev python python3 net-tools zlib1g-dev $ cd # bitcoin user session $ git clone https://github.com/ElementsProject/lightning.git $ cd lightning $ git tag -l $ git checkout tags/v0.6 $ ./configure $ make $ sudo make install ``` Create systemd unit `$ sudo nano /etc/systemd/system/lightning.service` ``` # c-Lightning: systemd unit # /etc/systemd/system/lightning.service [Unit] Description=c-Lightning daemon Requires=spruned.service After=spruned.service [Service] ExecStart=/usr/local/bin/lightningd --pid-file=/home/bitcoin/.lightning/lightning.pid --daemon PIDFile=/home/bitcoin/.lightning/lightning.pid User=bitcoin Type=forking Restart=on-failure RestartSec=10 # Hardening measures #################### # Provide a private /tmp and /var/tmp. #PrivateTmp=true # Mount /usr, /boot/ and /etc read-only for the process. #ProtectSystem=full # Disallow the process and all of its children to gain # new privileges through execve(). #NoNewPrivileges=true # Use a new /dev namespace only populated with API pseudo devices # such as /dev/null, /dev/zero and /dev/random. #PrivateDevices=true # Deny the creation of writable and executable memory mappings. #MemoryDenyWriteExecute=true [Install] WantedBy=multi-user.target ``` Start and enable unit ``` $ sudo systemctl daemon-reload $ sudo systemctl start lightning $ sudo systemctl status lightning $ sudo systemctl enable lightning ```