fix: indent heredoc content to satisfy YAML block scalar parser
YAML ends a block scalar when it sees content less indented than the first content line. The JSON heredoc at column 0 caused the parser to bail out mid-block. Indenting to 8 spaces keeps it inside the run: | scalar; YAML strips that indentation before handing the script to the shell, so the NOMAD_EOF terminator lands at column 0 as required. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
22ad13e061
commit
76c0b483c8
1 changed files with 92 additions and 92 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue