Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow specifying calibnet and/or mainnet snapshot for the daily… #438

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tf-managed/modules/daily-snapshot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ locals {
export NEW_RELIC_API_KEY=${var.new_relic_api_key}
export NEW_RELIC_ACCOUNT_ID=${var.new_relic_account_id}
export NEW_RELIC_REGION=${var.new_relic_region}
export SNAPSHOT_TYPE=${var.snapshot_type}
nohup sh ./init.sh > init_log.txt &
EOT
,
Expand Down
17 changes: 15 additions & 2 deletions tf-managed/modules/daily-snapshot/service/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,18 @@ done'
# Run new_relic and fail2ban scripts
bash newrelic_fail2ban.sh

# Setup cron jobs
cp calibnet_cron_job mainnet_cron_job /etc/cron.hourly/
# Setup cron job
case "$SNAPSHOT_TYPE" in
mainnet)
cp mainnet_cron_job /etc/cron.hourly/ && rm calibnet_cron_job
samuelarogbonlo marked this conversation as resolved.
Show resolved Hide resolved
;;
calibnet)
cp calibnet_cron_job /etc/cron.hourly/ && rm mainnet_cron_job
;;
both)
cp calibnet_cron_job mainnet_cron_job /etc/cron.hourly/
;;
*)
echo "Error: Invalid SNAPSHOT_TYPE. Please specify 'mainnet', 'calibnet', or 'both'."
;;
esac
7 changes: 7 additions & 0 deletions tf-managed/modules/daily-snapshot/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ variable "environment" {
type = string
}


variable "snapshot_type" {
samuelarogbonlo marked this conversation as resolved.
Show resolved Hide resolved
description = "The type of snapshot the node should generate. Options are 'mainnet', 'calibnet', or 'both'."
default = "both"
type = string
}

# Monitoring properties of the service. Can be declared partially.
variable "monitoring" {
description = "Service monitoring properties"
Expand Down
Loading