Ethereum block sync service in deploy.bash

pull/274/head
kompotkot 2021-09-22 11:29:37 +00:00
rodzic 02f753564b
commit cddf7c07b6
5 zmienionych plików z 43 dodań i 4 usunięć

Wyświetl plik

@ -14,6 +14,8 @@ 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"
ETHEREUM_TXPOOL_SERVICE="ethereum-txpool.service"
@ -37,6 +39,30 @@ 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}"
chmod 644 "${SCRIPT_DIR}/${ETHEREUM_SYNCHRONIZE_SERVICE}"
cp "${SCRIPT_DIR}/${ETHEREUM_SYNCHRONIZE_SERVICE}" "/etc/systemd/system/${ETHEREUM_SYNCHRONIZE_SERVICE}"
systemctl daemon-reload
systemctl restart "${ETHEREUM_SYNCHRONIZE_SERVICE}"
echo
echo
echo "Replacing existing Ethereum trending service and timer with: ${ETHEREUM_TRENDING_SERVICE}, ${ETHEREUM_TRENDING_TIMER}"

Wyświetl plik

@ -5,10 +5,9 @@ After=network.target
[Service]
User=ubuntu
Group=www-data
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/usr/bin/geth --syncmode full \
--port 41381 --datadir /mnt/disks/nodes/ethereum \
--txpool.globalslots 950000 --txpool.globalqueue 50000 \
--txpool.globalslots 450000 --txpool.globalqueue 50000 \
--http --http.port 18375 --http.api eth,web3,txpool
ExecStop=/bin/kill -s SIGINT -$MAINPID
SyslogIdentifier=ethereum-node

Wyświetl plik

@ -0,0 +1,14 @@
[Unit]
Description=Ethereum block with transactions synchronizer
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.ethcrawler synchronize -c 6 -j 1
SyslogIdentifier=ethereum-synchronize
[Install]
WantedBy=multi-user.target

Wyświetl plik

@ -8,4 +8,4 @@ User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/usr/bin/bash -c '/home/ubuntu/moonstream-env/bin/python -m mooncrawl.ethcrawler trending'
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.ethcrawler trending

Wyświetl plik

@ -7,7 +7,7 @@ User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/moonstream/crawlers/ethtxpool
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env
ExecStart=/home/ubuntu/moonstream/crawlers/ethtxpool/ethtxpool -geth http://127.0.0.1:"${MOONSTREAM_GETH_HTTP_PORT}"
ExecStart=/home/ubuntu/moonstream/crawlers/ethtxpool/ethtxpool -geth "${MOONSTREAM_IPC_PATH}"
SyslogIdentifier=ethereum-txpool
[Install]