{ "Format": "hcl2", "JobID": "calendar-proxy", "JobModifyIndex": 13940997, "Namespace": "default", "Source": "job \"calendar-proxy\" {\n datacenters = [\"dc1\"]\n type = \"service\"\n \n group \"web\" {\n count = 1\n \n network {\n port \"http\" {\n to = 80\n }\n }\n \n service {\n name = \"calendar-proxy\"\n port = \"http\"\n \n tags = [\n \"traefik.enable=true\",\n \"traefik.http.routers.calendar-proxy.rule=Host(`mail.fbleagh.duckdns.org`)\",\n \"traefik.http.routers.calendar-proxy.entrypoints=web\",\n ]\n \n check {\n type = \"http\"\n path = \"/health\"\n interval = \"10s\"\n timeout = \"3s\"\n }\n }\n \n # Nginx container\n task \"nginx\" {\n driver = \"docker\"\n lifecycle {\n hook = \"prestart\"\n sidecar = true\n }\n\n config {\n image = \"nginx:alpine\"\n ports = [\"http\"]\n \n volumes = [\n \"local/nginx.conf:/etc/nginx/nginx.conf\",\n \"local/app:/var/www/html\",\n ]\n }\n \n template {\n data = < [\n \"header\" => \"User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n ]\n]);\nif (($data = @file_get_contents($url, false, $context)) === false) {\n $error = error_get_last();\n http_response_code(500);\n print \"HTTP request failed: \" . $error['message'];\n exit;\n}\nheader('Content-Type: text/calendar; charset=utf-8');\nprint $data;\n?>\nEOF\n destination = \"local/app/ics.php\"\n }\n\n \n resources {\n cpu = 100\n memory = 128\n }\n }\n \n # PHP-FPM container\n task \"php-fpm\" {\n driver = \"docker\"\n \n config {\n image = \"php:8.2-fpm-alpine\"\n network_mode = \"container:nginx-${NOMAD_ALLOC_ID}\"\n \n volumes = [\n \"local/app:/var/www/html\",\n \"local/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf\",\n ]\n }\n \n template {\n data = < [\n \"header\" => \"User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36\",\n ]\n]);\nif (($data = @file_get_contents($url, false, $context)) === false) {\n $error = error_get_last();\n http_response_code(500);\n print \"HTTP request failed: \" . $error['message'];\n exit;\n}\nheader('Content-Type: text/calendar; charset=utf-8');\nprint $data;\n?>\nEOF\n destination = \"local/app/ics.php\"\n }\n\n resources {\n cpu = 200\n memory = 256\n }\n }\n \n # Restart policy\n restart {\n attempts = 3\n interval = \"5m\"\n delay = \"25s\"\n mode = \"fail\"\n }\n \n # Update strategy\n update {\n max_parallel = 1\n min_healthy_time = \"10s\"\n healthy_deadline = \"3m\"\n auto_revert = true\n }\n }\n}", "VariableFlags": null, "Variables": "", "Version": 7 }