From 897d2d7321a9dc7f02dc3e077c1f01f0162a38e9 Mon Sep 17 00:00:00 2001 From: kompotkot Date: Thu, 3 Nov 2022 16:56:18 +0000 Subject: [PATCH] Tokenonomics systemd services and changed on boot start timers --- crawlers/deploy/deploy.bash | 11 +++++++++++ crawlers/deploy/mumbai-missing.timer | 2 +- .../deploy/polygon-cu-reports-tokenonomics.service | 13 +++++++++++++ .../deploy/polygon-cu-reports-tokenonomics.timer | 9 +++++++++ crawlers/deploy/polygon-missing.timer | 2 +- crawlers/deploy/xdai-missing.timer | 2 +- 6 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 crawlers/deploy/polygon-cu-reports-tokenonomics.service create mode 100644 crawlers/deploy/polygon-cu-reports-tokenonomics.timer diff --git a/crawlers/deploy/deploy.bash b/crawlers/deploy/deploy.bash index 8fae619f..7ed52b50 100755 --- a/crawlers/deploy/deploy.bash +++ b/crawlers/deploy/deploy.bash @@ -51,6 +51,8 @@ POLYGON_STATE_CLEAN_SERVICE_FILE="polygon-state-clean.service" POLYGON_STATE_CLEAN_TIMER_FILE="polygon-state-clean.timer" POLYGON_METADATA_SERVICE_FILE="polygon-metadata.service" POLYGON_METADATA_TIMER_FILE="polygon-metadata.timer" +POLYGON_CU_REPORTS_TOKENONOMICS_SERVICE_FILE="polygon-cu-reports-tokenonomics.service" +POLYGON_CU_REPORTS_TOKENONOMICS_TIMER_FILE="polygon-cu-reports-tokenonomics.timer" # Mumbai service files MUMBAI_SYNCHRONIZE_SERVICE="mumbai-synchronize.service" @@ -267,3 +269,12 @@ cp "${SCRIPT_DIR}/${POLYGON_METADATA_SERVICE_FILE}" "/etc/systemd/system/${POLYG cp "${SCRIPT_DIR}/${POLYGON_METADATA_TIMER_FILE}" "/etc/systemd/system/${POLYGON_METADATA_TIMER_FILE}" systemctl daemon-reload systemctl restart --no-block "${POLYGON_METADATA_TIMER_FILE}" + +echo +echo +echo -e "${PREFIX_INFO} Replacing existing Polygon CU reports tokenonomics service and timer with: ${POLYGON_CU_REPORTS_TOKENONOMICS_SERVICE_FILE}, ${POLYGON_CU_REPORTS_TOKENONOMICS_TIMER_FILE}" +chmod 644 "${SCRIPT_DIR}/${POLYGON_CU_REPORTS_TOKENONOMICS_SERVICE_FILE}" "${SCRIPT_DIR}/${POLYGON_CU_REPORTS_TOKENONOMICS_TIMER_FILE}" +cp "${SCRIPT_DIR}/${POLYGON_CU_REPORTS_TOKENONOMICS_SERVICE_FILE}" "/etc/systemd/system/${POLYGON_CU_REPORTS_TOKENONOMICS_SERVICE_FILE}" +cp "${SCRIPT_DIR}/${POLYGON_CU_REPORTS_TOKENONOMICS_TIMER_FILE}" "/etc/systemd/system/${POLYGON_CU_REPORTS_TOKENONOMICS_TIMER_FILE}" +systemctl daemon-reload +systemctl restart --no-block "${POLYGON_CU_REPORTS_TOKENONOMICS_TIMER_FILE}" diff --git a/crawlers/deploy/mumbai-missing.timer b/crawlers/deploy/mumbai-missing.timer index 0e7644a3..e3812f81 100644 --- a/crawlers/deploy/mumbai-missing.timer +++ b/crawlers/deploy/mumbai-missing.timer @@ -2,7 +2,7 @@ Description=Fill missing blocks at Mumbai database [Timer] -OnBootSec=30s +OnBootSec=120s OnUnitActiveSec=15m [Install] diff --git a/crawlers/deploy/polygon-cu-reports-tokenonomics.service b/crawlers/deploy/polygon-cu-reports-tokenonomics.service new file mode 100644 index 00000000..0393062e --- /dev/null +++ b/crawlers/deploy/polygon-cu-reports-tokenonomics.service @@ -0,0 +1,13 @@ +[Unit] +Description=Runs custom crawler for CU tokenonomics +After=network.target + +[Service] +Type=oneshot +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.custom-crawler cu-reports --moonstream-token "${MOONSTREAM_ADMIN_ACCESS_TOKEN}" queries run-tokenonomics +CPUWeight=60 +SyslogIdentifier=polygon-cu-reports-tokenonomics diff --git a/crawlers/deploy/polygon-cu-reports-tokenonomics.timer b/crawlers/deploy/polygon-cu-reports-tokenonomics.timer new file mode 100644 index 00000000..3a56d85d --- /dev/null +++ b/crawlers/deploy/polygon-cu-reports-tokenonomics.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Runs custom crawler for CU tokenonomics + +[Timer] +OnBootSec=60s +OnUnitActiveSec=60m + +[Install] +WantedBy=timers.target diff --git a/crawlers/deploy/polygon-missing.timer b/crawlers/deploy/polygon-missing.timer index 58eb0ce3..73029113 100644 --- a/crawlers/deploy/polygon-missing.timer +++ b/crawlers/deploy/polygon-missing.timer @@ -2,7 +2,7 @@ Description=Fill missing blocks at Polygon database [Timer] -OnBootSec=30s +OnBootSec=120s OnUnitActiveSec=15m [Install] diff --git a/crawlers/deploy/xdai-missing.timer b/crawlers/deploy/xdai-missing.timer index 66285c66..d6ff5e2b 100644 --- a/crawlers/deploy/xdai-missing.timer +++ b/crawlers/deploy/xdai-missing.timer @@ -2,7 +2,7 @@ Description=Fill missing blocks at XDai database [Timer] -OnBootSec=35s +OnBootSec=120s OnUnitActiveSec=15m [Install]