Skip to content

Commit

Permalink
add postgres db task to job
Browse files Browse the repository at this point in the history
  • Loading branch information
wizzdom committed Jan 10, 2025
1 parent bba617d commit 8001840
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/deploy/production.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,41 @@ job "blockbot" {
template {
data = <<EOF
TOKEN={{ key "blockbot/discord/token" }}
LDAP_USERNAME={{ key "blockbot/ldap/username" }}
LDAP_PASSWORD={{ key "blockbot/ldap/password" }}
DISCORD_UID_MAP={{ key "blockbot/discord/uid_map" }}
DB_HOST={{ env "NOMAD_ADDR_db" }} # address and port
DB_NAME={{ key "blockbot/db/name" }} # database name
DB_PASSWORD={{ key "blockbot/db/password" }}
DB_USER={{ key "blockbot/db/user" }}
EOF
destination = "local/.env"
env = true
}
}
task "blockbot-db" {
driver = "docker"

config {
image = "postgres:17-alpine"
ports = ["db"]

volumes = [
"/storage/nomad/blockbot/db:/var/lib/postgresql/data",
]
}

template {
data = <<EOH
POSTGRES_PASSWORD={{ key "blockbot/db/password" }}
POSTGRES_USER={{ key "blockbot/db/user" }}
POSTGRES_NAME={{ key "blockbot/db/name" }}
EOH
destination = "local/db.env"
env = true
}
}
}
}
33 changes: 33 additions & 0 deletions .github/deploy/review.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ job "blockbot-[[.environment_slug]]" {

group "blockbot" {
count = 1
network {
port "db" {
to = 5432
}
}

task "blockbot-review-[[.git_sha]]" {
driver = "docker"
Expand All @@ -25,13 +30,41 @@ job "blockbot-[[.environment_slug]]" {
data = <<EOF
TOKEN={{ key "blockbot-dev/discord/token" }}
DEBUG=true
LDAP_USERNAME={{ key "blockbot-dev/ldap/username" }}
LDAP_PASSWORD={{ key "blockbot-dev/ldap/password" }}
DISCORD_UID_MAP={{ key "blockbot-dev/discord/uid_map" }}
DB_HOST={{ env "NOMAD_ADDR_db" }} # address and port
DB_NAME={{ key "blockbot-dev/db/name" }} # database name
DB_PASSWORD={{ key "blockbot-dev/db/password" }}
DB_USER={{ key "blockbot-dev/db/user" }}
EOF
destination = "local/.env"
env = true
}
}
task "blockbot-dev-db" {
driver = "docker"

config {
image = "postgres:17-alpine"
ports = ["db"]

volumes = [
"/storage/nomad/blockbot-dev/db:/var/lib/postgresql/data",
]
}

template {
data = <<EOH
POSTGRES_PASSWORD={{ key "blockbot-dev/db/password" }}
POSTGRES_USER={{ key "blockbot-dev/db/user" }}
POSTGRES_NAME={{ key "blockbot-dev/db/name" }}
EOH
destination = "local/db.env"
env = true
}
}
}
}

0 comments on commit 8001840

Please sign in to comment.