job "mediawiki" { datacenters = ["aperture"] type = "service" meta { domain = "wiki.redbrick.dcu.ie" } group "rbwiki" { count = 1 network { mode = "bridge" port "http" { to = 80 } port "fpm" { to = 9000 } port "db" { to = 3306 } } service { name = "rbwiki-web" port = "http" check { type = "http" path = "/Main_Page" interval = "10s" timeout = "5s" } tags = [ "traefik.enable=true", "traefik.port=${NOMAD_PORT_http}", "traefik.http.routers.rbwiki.rule=Host(`${NOMAD_META_domain}`) || Host(`wiki.rb.dcu.ie`)", "traefik.http.routers.rbwiki.entrypoints=web,websecure", "traefik.http.routers.rbwiki.tls.certresolver=lets-encrypt", "traefik.http.routers.rbwiki.middlewares=rbwiki-redirect-root, rbwiki-redirect-mw", "traefik.http.middlewares.rbwiki-redirect-root.redirectregex.regex=^https://wiki\\.redbrick\\.dcu\\.ie/?$", "traefik.http.middlewares.rbwiki-redirect-root.redirectregex.replacement=https://wiki.redbrick.dcu.ie/Main_Page", "traefik.http.middlewares.rbwiki-redirect-mw.redirectregex.regex=https://wiki\\.redbrick\\.dcu\\.ie/Mw/(.*)", "traefik.http.middlewares.rbwiki-redirect-mw.redirectregex.replacement=https://wiki.redbrick.dcu.ie/$1", ] } task "rbwiki-nginx" { driver = "docker" config { image = "nginx:alpine" ports = ["http"] volumes = [ "local/nginx.conf:/etc/nginx/nginx.conf", "/storage/nomad/mediawiki/extensions:/var/www/html/extensions", "/storage/nomad/mediawiki/images:/var/www/html/images", "/storage/nomad/mediawiki/skins:/var/www/html/skins", "/storage/nomad/mediawiki/resources/assets:/var/www/html/Resources/assets", ] } resources { cpu = 200 memory = 100 } template { data = <