Nodes deployment module

pull/315/head
kompotkot 2021-10-15 08:38:28 +00:00
rodzic 31e4eae4a3
commit f795306afb
4 zmienionych plików z 42 dodań i 20 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

@ -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

@ -5,10 +5,10 @@ After=network.target
[Service]
User=ubuntu
Group=www-data
ExecStart=/usr/bin/geth --syncmode full \
--port 41381 --datadir /mnt/disks/nodes/ethereum \
ExecStart=/usr/bin/geth --syncmode full --cache 4096 \
--port 41380 --datadir /mnt/disks/nodes/ethereum \
--txpool.globalslots 153600 --txpool.globalqueue 3072 \
--http --http.port 18375 --http.api eth,web3,txpool
--http --http.port 18370 --http.api eth,web3,txpool
ExecStop=/bin/kill -s SIGINT -$MAINPID
TimeoutStopSec=300
SyslogIdentifier=ethereum-node

Wyświetl plik

@ -0,0 +1,14 @@
[Unit]
Description=moonstreamnodes-service
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/moonstream/nodes/server
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream/nodes/server/moonstreamnodes -host 127.0.0.1 -port "${MOONSTREAM_NODE_SERVER_PORT}"
SyslogIdentifier=moonstreamnodes
[Install]
WantedBy=multi-user.tar