Skip to content

Commit

Permalink
Add first try at a job file.
Browse files Browse the repository at this point in the history
It errors because it can't be dpulc_staging, has to be dpulc-staging

Co-authored-by: Anna Headley <[email protected]>
Co-authored-by: Sean Warren <[email protected]>
Co-authored-by: Shaun Ellis <[email protected]>
Co-authored-by: Amin Zare <[email protected]>
  • Loading branch information
5 people committed May 30, 2024
1 parent ca1904d commit 6f95f08
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions config/deploy/staging.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
job "dpulc_staging" {
region = "global"
datacenters = ["dc1"]
type = "service"
group "web" {
count = 2
network {
port "http" { to = 4000 }
}
service {
port = "http"
check {
type = "http"
port = "http"
path = "/"
interval = "10s"
timeout = "1s"
}
}
task "release-migrate" {
# The dbmigrate task will run BEFORE the puma task in this group.
lifecycle {
hook = "prestart"
sidecar = false
}
driver = "docker"
config {
image = "ghcr.io/pulibrary/dpul-collections:main"
command = "bash"
args = ["-c", "/app/bin/migrate"]
force_pull = true
}
template {
destination = "${NOMAD_SECRETS_DIR}/env.vars"
env = true
change_mode = "restart"
data = <<EOF
{{- with nomadVar "nomad/jobs/dpulc_staging" -}}
DATABASE_URL = ecto://{{ .DB_USER }}:{{ .DB_PASSWORD }}@{{ .POSTGRES_HOST }}/{{ .DB_NAME }}
SECRET_KEY_BASE = {{ .SECRET_KEY_BASE }}
{{- end -}}
EOF
}
}
task "webserver" {
driver = "docker"
config {
image = "ghcr.io/pulibrary/dpul-collections:main"
ports = ["http"]
force_pull = true
}
template {
destination = "${NOMAD_SECRETS_DIR}/env.vars"
env = true
change_mode = "restart"
data = <<EOF
{{- with nomadVar "nomad/jobs/dpulc_staging" -}}
DATABASE_URL = ecto://{{ .DB_USER }}:{{ .DB_PASSWORD }}@{{ .POSTGRES_HOST }}/{{ .DB_NAME }}
SECRET_KEY_BASE = {{ .SECRET_KEY_BASE }}
{{- end -}}
EOF
}
}
}
}

0 comments on commit 6f95f08

Please sign in to comment.