Skip to content

Commit

Permalink
fastcgi: Add checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Oct 13, 2024
1 parent 0ebf7e3 commit 0ee521f
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions jobs/fastcgi.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ job "fastcgi" {
options { checksum = "md5:fa11e91ebb96995b117b9a7408c3f315" }
}

artifact {
source = "https://github.com/wikimedia/operations-docker-images-production-images/raw/ad68c7cb62e4e01436ab3a34fb961fe8034c2cce/images/php/common/fpm/live-test/AdoyFastCgiClient.php"
destination = "local/AdoyFastCgiClient.php"
mode = "file"
}

artifact {
source = "https://github.com/wikimedia/operations-docker-images-production-images/raw/ad68c7cb62e4e01436ab3a34fb961fe8034c2cce/images/php/common/fpm/live-test/fcgi-probe.php"
destination = "local/fcgi-probe.php"
mode = "file"
}

template {
data = var.hotfix
destination = "local/Hotfix.php"
Expand All @@ -126,6 +138,8 @@ job "fastcgi" {
"local/php.ini:/usr/local/etc/php/php.ini",
"local/php-fpm.conf:/usr/local/etc/php-fpm.conf",
"local/www.conf:/usr/local/etc/php-fpm.d/www.conf",
"local/AdoyFastCgiClient.php:/srv/fcgi-check/AdoyFastCgiClient.php",
"local/fcgi-probe.php:/srv/fcgi-check/fcgi-probe.php",
"secrets/secrets.php:/a/secret.php",
"secrets/analytics-credentials-file.json:/a/analytics-credentials-file.json",
# Overwrite the default Hotfix.php provided by femiwiki/mediawiki
Expand Down Expand Up @@ -159,13 +173,15 @@ job "fastcgi" {
}

env {
# Used by fcgi-probe.php
FCGI_URL = "127.0.0.1:9000"

MEDIAWIKI_SKIP_INSTALL = "1"
MEDIAWIKI_SKIP_IMPORT_SITES = "1"
MEDIAWIKI_SKIP_UPDATE = "1"

WG_DB_SERVER = NOMAD_UPSTREAM_ADDR_mysql
WG_DB_USER = "mediawiki"
WG_DB_PASSWORD = var.mysql_password_mediawiki
WG_DB_SERVER = NOMAD_UPSTREAM_ADDR_mysql
WG_DB_USER = "mediawiki"
WG_DB_PASSWORD = var.mysql_password_mediawiki
}
}

Expand Down Expand Up @@ -198,6 +214,24 @@ job "fastcgi" {
}
}
}

check {
# healthiness
on_update = "ignore_warnings"
type = "tcp"
port = 9000
interval = "10s"
timeout = "1s"
}
check {
# readiness
type = "script"
task = "fastcgi"
command = "/usr/local/bin/php"
args = ["/srv/fcgi-check/fcgi-probe.php"]
interval = "10s"
timeout = "1s"
}
}

network {
Expand Down

0 comments on commit 0ee521f

Please sign in to comment.