Skip to content

Commit 7e94402

Browse files
authored
Remove envsubst, Remove config merging (breaking) (#98)
1 parent be1d671 commit 7e94402

24 files changed

Lines changed: 354 additions & 1640 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Deploy application to docker swarm in a controlled manner.
66
- Rolling update of swarm config, thanks to checksum naming
77
- Explicit syntax, no more optionals, no more short syntax
88
- [Built-in jinja2 style templating via nunjucks](./examples/swarm-app.yml?plain=1#L13)
9-
- [Inline swarm configs with envsubst](./examples/swarm-app.yml?plain=1#L34)
9+
- [Inline swarm configs](./examples/swarm-app.yml?plain=1#L32)
1010

1111
# Usage
1212
- `swarm-app validate` will exit on basic configuration file mistakes.

eslint.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ export default defineConfig(
3636
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
3737
"@stylistic/multiline-ternary": ["error", "always-multiline"],
3838
"@stylistic/newline-per-chained-call": ["error", {ignoreChainWithDepth: 3}],
39-
"@typescript-eslint/restrict-template-expressions": ["error", {allow: ["Error"]}],
39+
"@typescript-eslint/restrict-template-expressions": ["error", {allow: ["Error"], allowNumber: true}],
4040

4141
"@stylistic/function-call-argument-newline": "off",
42-
"@typescript-eslint/no-unnecessary-condition": "off", // TODO: We want this one enabled.
4342
},
4443
},
4544
);

examples/deploy.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ docker network inspect external &>/dev/null || docker network create external --
77
export STACK_NAME="test"
88
export NGINX_FOLDER="/usr/share/nginx/html"
99
export NGINX_LOCATION="/public"
10+
export NGINX_IMAGE_REF=nginx
1011

1112
node ../src/index.js deploy "$STACK_NAME" -f swarm-app.yml -i swarm-app.input.yml
1213

examples/diff.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -e
44

55
export STACK_NAME="test"
66
export NGINX_FOLDER="/usr/share/nginx/html"
7-
export NGINX_LOCATION="/public"
7+
export NGINX_LOCATION="/public-with-diff"
8+
export NGINX_IMAGE_REF=nginx:alpine
89

9-
node ../src/index.js diff --write-lhs-rhs -f swarm-app.yml -f swarm-app.diff.yml -i swarm-app.input.yml "$STACK_NAME"
10+
node ../src/index.js diff "$STACK_NAME" -f swarm-app.yml -i swarm-app.input.yml --write-lhs-rhs

examples/swarm-app.diff.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/swarm-app.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
networks:
33
default:
4-
name: ${STACK_NAME}-hello
4+
name: {{ env.STACK_NAME }}-hello
55
attachable: true
66
external: false
77
shared:
@@ -22,7 +22,7 @@ service_specs:
2222

2323
nginx:
2424
command: ["nginx", "-g", "daemon off;"]
25-
image: nginx
25+
image: {{ env.NGINX_IMAGE_REF }}
2626
container_labels:
2727
org.company.country: england
2828
configs:
@@ -31,17 +31,15 @@ service_specs:
3131
/etc/nginx/conf.d/default.conf:
3232
content: |
3333
server {
34-
location ${NGINX_LOCATION} {
35-
root ${NGINX_FOLDER};
34+
location {{ env.NGINX_LOCATION }} {
35+
root {{ env.NGINX_FOLDER }};
3636
}
3737
location /status {
3838
default_type application/json;
3939
return 200 '{"status":"success"}';
4040
}
4141
}
4242
env_file: .env
43-
environment:
44-
NGINX_FOLDER: /usr/share/nginx/html/
4543
networks:
4644
- default
4745
- shared

examples/validate.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
2-
32
set -e
43

5-
node ../src/index.js validate -f swarm-app.yml -f swarm-app.diff.yml -i swarm-app.input.yml
4+
export NGINX_IMAGE_REF=nginx:alpine
5+
6+
node ../src/index.js validate -f swarm-app.yml -i swarm-app.input.yml

0 commit comments

Comments
 (0)