Merge pull request #315 from bugout-dev/timeout-node-shutdown

Timeout for node service shutdown
pull/325/head
Sergei Sumarokov 2021-10-15 13:49:48 +03:00 zatwierdzone przez GitHub
commit a7e172f8fe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 43 dodań i 34 usunięć

Wyświetl plik

@ -14,7 +14,6 @@ PARAMETERS_ENV_PATH="${SECRETS_DIR}/app.env"
AWS_SSM_PARAMETER_PATH="${AWS_SSM_PARAMETER_PATH:-/moonstream/prod}"
SCRIPT_DIR="$(realpath $(dirname $0))"
PARAMETERS_SCRIPT="${SCRIPT_DIR}/parameters.py"
ETHEREUM_GETH_SERVICE="ethereum-node.service"
ETHEREUM_SYNCHRONIZE_SERVICE="ethereum-synchronize.service"
ETHEREUM_TRENDING_SERVICE="ethereum-trending.service"
ETHEREUM_TRENDING_TIMER="ethereum-trending.service"
@ -51,22 +50,6 @@ echo "Retrieving deployment parameters"
mkdir -p "${SECRETS_DIR}"
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" "${PYTHON}" "${PARAMETERS_SCRIPT}" extract -p "${AWS_SSM_PARAMETER_PATH}" -o "${PARAMETERS_ENV_PATH}"
echo
echo
echo "Deploy Geth service if not running already"
if systemctl is-active --quiet "${ETHEREUM_GETH_SERVICE}"
then
echo "Ethereum Geth service ${ETHEREUM_GETH_SERVICE} already running"
else
echo "Replacing Ethereum Geth service definition with ${ETHEREUM_GETH_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${ETHEREUM_GETH_SERVICE}"
cp "${SCRIPT_DIR}/${ETHEREUM_GETH_SERVICE}" "/etc/systemd/system/${ETHEREUM_GETH_SERVICE}"
systemctl daemon-reload
systemctl disable "${ETHEREUM_GETH_SERVICE}"
systemctl restart "${ETHEREUM_GETH_SERVICE}"
sleep 10
fi
echo
echo
echo "Replacing existing Ethereum block with transactions syncronizer service definition with ${ETHEREUM_SYNCHRONIZE_SERVICE}"

Wyświetl plik

@ -1,16 +0,0 @@
[Unit]
Description=Ethereum node Geth client
After=network.target
[Service]
User=ubuntu
Group=www-data
ExecStart=/usr/bin/geth --syncmode full \
--port 41381 --datadir /mnt/disks/nodes/ethereum \
--txpool.globalslots 450000 --txpool.globalqueue 50000 \
--http --http.port 18375 --http.api eth,web3,txpool
ExecStop=/bin/kill -s SIGINT -$MAINPID
SyslogIdentifier=ethereum-node
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -7,7 +7,7 @@ User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/moonstream/db/server
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream/db/server/moonstreamdb -host 0.0.0.0 -port "${MOONSTREAM_DB_SERVER_PORT}"
ExecStart=/home/ubuntu/moonstream/db/server/moonstreamdb -host 127.0.0.1 -port "${MOONSTREAM_DB_SERVER_PORT}"
SyslogIdentifier=moonstreamdb
[Install]

Wyświetl plik

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Deployment script - intended to run on Moonstream node control server
# Main
SCRIPT_DIR="$(realpath $(dirname $0))"
ETHEREUM_GETH_SERVICE="ethereum-node.service"
set -eu
echo
echo
echo "Deploy Geth service if not running already"
if systemctl is-active --quiet "${ETHEREUM_GETH_SERVICE}"
then
echo "Ethereum Geth service ${ETHEREUM_GETH_SERVICE} already running"
else
echo "Replacing Ethereum Geth service definition with ${ETHEREUM_GETH_SERVICE}"
chmod 644 "${SCRIPT_DIR}/${ETHEREUM_GETH_SERVICE}"
cp "${SCRIPT_DIR}/${ETHEREUM_GETH_SERVICE}" "/etc/systemd/system/${ETHEREUM_GETH_SERVICE}"
systemctl daemon-reload
systemctl disable "${ETHEREUM_GETH_SERVICE}"
systemctl restart "${ETHEREUM_GETH_SERVICE}"
sleep 10
fi

Wyświetl plik

@ -0,0 +1,17 @@
[Unit]
Description=Ethereum node Geth client
After=network.target
[Service]
User=ubuntu
Group=www-data
ExecStart=/usr/bin/geth --syncmode snap --cache 4096 \
--port 41380 --datadir /mnt/disks/nodes/ethereum \
--txpool.globalslots 153600 --txpool.globalqueue 3072 \
--http --http.port 18370 --http.api eth,web3,txpool
ExecStop=/bin/kill -s SIGINT -$MAINPID
TimeoutStopSec=300
SyslogIdentifier=ethereum-node
[Install]
WantedBy=multi-user.target