diff --git a/deploy-nix-site/action.yaml b/deploy-nix-site/action.yaml index 86f9e84..623a7ed 100644 --- a/deploy-nix-site/action.yaml +++ b/deploy-nix-site/action.yaml @@ -79,101 +79,101 @@ runs: shell: bash run: | cat > /tmp/deploy-${{ inputs.site-name }}.nomad.json <<'NOMAD_EOF' -{ - "Job": { - "ID": "${{ inputs.site-name }}", - "Name": "${{ inputs.site-name }}", - "Type": "service", - "Datacenters": ["contabo"], - "Constraints": [{ - "LTarget": "${node.unique.name}", - "RTarget": "alvin", - "Operand": "=" - }], - "TaskGroups": [{ - "Name": "web", - "Count": 1, - "Networks": [{ - "Mode": "bridge", - "DynamicPorts": [{ - "Label": "http", - "To": 8080 - }] - }], - "Services": [{ - "Name": "${{ inputs.site-name }}", - "PortLabel": "http", - "Provider": "nomad", - "Tags": [ - "traefik.enable=true", - "traefik.http.routers.${{ inputs.site-name }}.rule=${{ inputs.traefik-rule }}", - "traefik.http.routers.${{ inputs.site-name }}.entrypoints=websecure", - "traefik.http.routers.${{ inputs.site-name }}.tls.certresolver=letsencrypt" - ] - }], - "Volumes": { - "site-data": { - "Type": "host", - "Source": "site-data", - "ReadOnly": false - } - }, - "Tasks": [ { - "Name": "fetch", - "Driver": "docker", - "Lifecycle": { - "Hook": "prestart", - "Sidecar": false - }, - "Config": { - "image": "nixos/nix:latest", - "command": "/bin/sh", - "args": [ - "-c", - "nix copy --from 's3://nix-cache?endpoint=${{ inputs.s3-endpoint }}&scheme=https' '${STORE_PATH}' && cp -r ${STORE_PATH}/* /alloc/data/" - ] - }, - "Env": { - "AWS_ACCESS_KEY_ID": "${{ env.S3_ACCESS_KEY }}", - "AWS_SECRET_ACCESS_KEY": "${{ env.S3_SECRET_KEY }}", - "STORE_PATH": "${{ env.STORE_PATH }}" - }, - "VolumeMounts": [{ - "Volume": "site-data", - "Destination": "/alloc/data" - }], - "Resources": { - "CPU": 200, - "MemoryMB": 256 - } - }, - { - "Name": "server", - "Driver": "docker", - "Config": { - "image": "joseluisq/static-web-server:2", - "ports": ["http"] - }, - "Env": { - "SERVER_ROOT": "/var/www", - "SERVER_LOG_LEVEL": "info" - }, - "VolumeMounts": [{ - "Volume": "site-data", - "Destination": "/var/www", - "ReadOnly": true - }], - "Resources": { - "CPU": 100, - "MemoryMB": 64 + "Job": { + "ID": "${{ inputs.site-name }}", + "Name": "${{ inputs.site-name }}", + "Type": "service", + "Datacenters": ["contabo"], + "Constraints": [{ + "LTarget": "${node.unique.name}", + "RTarget": "alvin", + "Operand": "=" + }], + "TaskGroups": [{ + "Name": "web", + "Count": 1, + "Networks": [{ + "Mode": "bridge", + "DynamicPorts": [{ + "Label": "http", + "To": 8080 + }] + }], + "Services": [{ + "Name": "${{ inputs.site-name }}", + "PortLabel": "http", + "Provider": "nomad", + "Tags": [ + "traefik.enable=true", + "traefik.http.routers.${{ inputs.site-name }}.rule=${{ inputs.traefik-rule }}", + "traefik.http.routers.${{ inputs.site-name }}.entrypoints=websecure", + "traefik.http.routers.${{ inputs.site-name }}.tls.certresolver=letsencrypt" + ] + }], + "Volumes": { + "site-data": { + "Type": "host", + "Source": "site-data", + "ReadOnly": false + } + }, + "Tasks": [ + { + "Name": "fetch", + "Driver": "docker", + "Lifecycle": { + "Hook": "prestart", + "Sidecar": false + }, + "Config": { + "image": "nixos/nix:latest", + "command": "/bin/sh", + "args": [ + "-c", + "nix copy --from 's3://nix-cache?endpoint=${{ inputs.s3-endpoint }}&scheme=https' '${STORE_PATH}' && cp -r ${STORE_PATH}/* /alloc/data/" + ] + }, + "Env": { + "AWS_ACCESS_KEY_ID": "${{ env.S3_ACCESS_KEY }}", + "AWS_SECRET_ACCESS_KEY": "${{ env.S3_SECRET_KEY }}", + "STORE_PATH": "${{ env.STORE_PATH }}" + }, + "VolumeMounts": [{ + "Volume": "site-data", + "Destination": "/alloc/data" + }], + "Resources": { + "CPU": 200, + "MemoryMB": 256 + } + }, + { + "Name": "server", + "Driver": "docker", + "Config": { + "image": "joseluisq/static-web-server:2", + "ports": ["http"] + }, + "Env": { + "SERVER_ROOT": "/var/www", + "SERVER_LOG_LEVEL": "info" + }, + "VolumeMounts": [{ + "Volume": "site-data", + "Destination": "/var/www", + "ReadOnly": true + }], + "Resources": { + "CPU": 100, + "MemoryMB": 64 + } + } + ] + }] } } - ] - }] - } -} -NOMAD_EOF + NOMAD_EOF nomad job run -json /tmp/deploy-${{ inputs.site-name }}.nomad.json