website and p2pool graceful stop

This commit is contained in:
Matthew Tran 2024-09-17 02:02:35 +00:00
parent c888f10a52
commit c3ef9eb514
6 changed files with 32 additions and 8 deletions

View File

@ -18,6 +18,8 @@ Stuff that's deployed on [matthewtran.com](https://matthewtran.com). Currently r
- Expand the root partition if needed. - Expand the root partition if needed.
- `lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv` - `lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv`
- `resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv` - `resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv`
- Enable huge pages.
- `echo "vm.nr_hugepages=3072" | sudo tee -a /etc/sysctl.conf`
- Give yourself Docker access if needed. - Give yourself Docker access if needed.
- `groupadd docker` - `groupadd docker`
- `usermod -aG docker $USER` - `usermod -aG docker $USER`
@ -25,6 +27,7 @@ Stuff that's deployed on [matthewtran.com](https://matthewtran.com). Currently r
- `ufw enable` - `ufw enable`
- `ufw allow OpenSSH` - `ufw allow OpenSSH`
- `ufw allow 51820/udp` - `ufw allow 51820/udp`
- Reboot.
2. Forward the following ports. Set a static IP if needed. 2. Forward the following ports. Set a static IP if needed.
- website - `80`, `443` - website - `80`, `443`
- gitea - `2222` - gitea - `2222`

View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
# check bitmonero.log for log
monero/monerod \ monero/monerod \
--prune-blockchain \ --prune-blockchain \
--rpc-bind-ip 0.0.0.0 \ --rpc-bind-ip 0.0.0.0 \
@ -10,4 +11,12 @@ monero/monerod \
--add-priority-node=p2pmd.xmrvsbeast.com:18080 \ --add-priority-node=p2pmd.xmrvsbeast.com:18080 \
--add-priority-node=nodes.hashvault.pro:18080 \ --add-priority-node=nodes.hashvault.pro:18080 \
--disable-dns-checkpoints \ --disable-dns-checkpoints \
--enable-dns-blocklist --enable-dns-blocklist \
--detach
cleanup() {
monero/monerod exit
}
trap 'cleanup' TERM
tail -f /dev/null &
wait $!

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd cache cd cache
~/p2pool \ exec ~/p2pool \
--mini \ --mini \
--host monerod \ --host monerod \
--wallet 42j7pyNRf8WE96D1xb6pjPWCwaDaYYevwZSPpELbTJjnXiKp7Lhtahbhb5Gc3p2BVxgMB3FEGNPUcbST1oZds6nBERA4jrQ --wallet 42j7pyNRf8WE96D1xb6pjPWCwaDaYYevwZSPpELbTJjnXiKp7Lhtahbhb5Gc3p2BVxgMB3FEGNPUcbST1oZds6nBERA4jrQ

View File

@ -18,4 +18,5 @@ COPY html /var/www/matthewtran.com/html
# start script # start script
WORKDIR /root WORKDIR /root
COPY sendgrid.ke[y] ip_update.py ./ COPY sendgrid.ke[y] ip_update.py ./
COPY cert_update.py ./
COPY entry.sh ./ COPY entry.sh ./

10
website/cert_update.py Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python3
import subprocess
import time
if __name__ == '__main__':
while True:
# try renew once a day
subprocess.run(['certbot', 'renew', '--quiet'])
time.sleep(86400)

View File

@ -16,10 +16,11 @@ certbot --nginx \
nginx -s reload nginx -s reload
python3 ip_update.py & python3 ip_update.py &
python3 cert_update.py &
# try renew once a day cleanup() {
while true echo "stopping..."
do }
certbot renew --quiet trap 'cleanup' TERM
sleep 86400
done wait $! # wait SIGTERM, other processes can just be killed