-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-leaderboard-metadata
- Loading branch information
Showing
37 changed files
with
2,188 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Deployment script of monitoring services - intended to run on Moonstream crawlers server | ||
|
||
# Colors | ||
C_RESET='\033[0m' | ||
C_RED='\033[1;31m' | ||
C_GREEN='\033[1;32m' | ||
C_YELLOW='\033[1;33m' | ||
|
||
# Logs | ||
PREFIX_INFO="${C_GREEN}[INFO]${C_RESET} [$(date +%d-%m\ %T)]" | ||
PREFIX_WARN="${C_YELLOW}[WARN]${C_RESET} [$(date +%d-%m\ %T)]" | ||
PREFIX_CRIT="${C_RED}[CRIT]${C_RESET} [$(date +%d-%m\ %T)]" | ||
|
||
# Main | ||
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}" | ||
SECRETS_DIR="${SECRETS_DIR:-/home/ubuntu/moonstream-secrets}" | ||
PARAMETERS_ENV_MONITORING_PATH="${SECRETS_DIR}/monitoring.env" | ||
SCRIPT_DIR="$(realpath $(dirname $0))" | ||
|
||
# Service files | ||
MONITORING_CRAWLERS_SERVICE_FILE="monitoring-crawlers.service" | ||
|
||
set -eu | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Install checkenv" | ||
HOME=/home/ubuntu /usr/local/go/bin/go install github.com/bugout-dev/checkenv@latest | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Copy monitoring binary from AWS S3" | ||
aws s3 cp s3://bugout-binaries/prod/monitoring/monitoring "/home/ubuntu/monitoring" | ||
chmod +x "/home/ubuntu/monitoring" | ||
chown ubuntu:ubuntu "/home/ubuntu/monitoring" | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Retrieving monitoring deployment parameters" | ||
AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}" /home/ubuntu/go/bin/checkenv show aws_ssm+service:true,monitoring:true > "${PARAMETERS_ENV_MONITORING_PATH}" | ||
chmod 0640 "${PARAMETERS_ENV_MONITORING_PATH}" | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Add instance local IP to monitoring parameters" | ||
echo "AWS_LOCAL_IPV4=$(ec2metadata --local-ipv4)" >> "${PARAMETERS_ENV_MONITORING_PATH}" | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Add AWS default region to monitoring parameters" | ||
echo "AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}" >> "${PARAMETERS_ENV_MONITORING_PATH}" | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Prepare monitoring configuration" | ||
if [ ! -d "/home/ubuntu/.monitoring" ]; then | ||
mkdir -p /home/ubuntu/.monitoring | ||
echo -e "${PREFIX_WARN} Created monitoring configuration directory" | ||
fi | ||
cp "${SCRIPT_DIR}/monitoring-crawlers-config.json" /home/ubuntu/.monitoring/monitoring-crawlers-config.json | ||
|
||
echo | ||
echo | ||
if [ ! -d "/home/ubuntu/.config/systemd/user/" ]; then | ||
mkdir -p /home/ubuntu/.config/systemd/user/ | ||
echo -e "${PREFIX_WARN} Created user systemd directory" | ||
fi | ||
|
||
echo | ||
echo | ||
echo -e "${PREFIX_INFO} Replacing existing systemd crawlers monitoring service definition with ${MONITORING_CRAWLERS_SERVICE_FILE}" | ||
chmod 644 "${SCRIPT_DIR}/${MONITORING_CRAWLERS_SERVICE_FILE}" | ||
cp "${SCRIPT_DIR}/${MONITORING_CRAWLERS_SERVICE_FILE}" "/home/ubuntu/.config/systemd/user/${MONITORING_CRAWLERS_SERVICE_FILE}" | ||
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user daemon-reload | ||
XDG_RUNTIME_DIR="/run/user/1000" systemctl --user restart "${MONITORING_CRAWLERS_SERVICE_FILE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"notification_pagerduty": true, | ||
"notification_telegram": true, | ||
"notification_sendgrid": true, | ||
"notification_humbug": true, | ||
"silent": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[Unit] | ||
Description=Monitor crawlers systemd state | ||
StartLimitIntervalSec=300 | ||
StartLimitBurst=3 | ||
After=network.target | ||
|
||
[Service] | ||
Restart=on-failure | ||
RestartSec=15s | ||
WorkingDirectory=/home/ubuntu/ | ||
EnvironmentFile=/home/ubuntu/moonstream-secrets/monitoring.env | ||
ExecStart=/home/ubuntu/monitoring -plugin systemd -host "${AWS_LOCAL_IPV4}" -port 7171 -healthcheck -server -threshold 3 -config /home/ubuntu/.monitoring/monitoring-crawlers-config.json -service ethereum-moonworm-crawler.service -service mumbai-moonworm-crawler.service -service polygon-moonworm-crawler.service -service zksync-era-moonworm-crawler.service | ||
CPUWeight=90 | ||
SyslogIdentifier=monitoring-crawlers | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
crawlers/deploy/wyrm-statistics.service → ...ers/deploy/zksync-era-state-clean.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
[Unit] | ||
Description=Update Wyrm statistics dashboards | ||
Description=Execute state clean labels crawler | ||
After=network.target | ||
|
||
[Service] | ||
Type=oneshot | ||
WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl | ||
EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env | ||
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.stats_worker.dashboard --access-id "${NB_CONTROLLER_ACCESS_ID}" generate --blockchain wyrm | ||
ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli --access-id "${NB_CONTROLLER_ACCESS_ID}" clean-state-labels --blockchain zksync_era -N 10000 | ||
CPUWeight=60 | ||
SyslogIdentifier=wyrm-statistics | ||
SyslogIdentifier=zksync-era-state-clean |
Oops, something went wrong.