You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: {{cookiecutter.project_slug}}/README.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -489,10 +489,10 @@ services:
489
489
deploy:
490
490
placement:
491
491
constraints:
492
-
- node.labels.${STACK_NAME}.app-db-data == true
492
+
- node.labels.${STACK_NAME?Variable not set}.app-db-data == true
493
493
```
494
494
495
-
note the `${STACK_NAME}`. In the script `./scripts/deploy.sh`, the `docker-compose.yml` would be converted, and saved to a file `docker-stack.yml` containing:
495
+
note the `${STACK_NAME?Variable not set}`. In the script `./scripts/deploy.sh`, the `docker-compose.yml` would be converted, and saved to a file `docker-stack.yml` containing:
**Note**: The `${STACK_NAME?Variable not set}` means "use the environment variable `STACK_NAME`, but if it is not set, show an error `Variable not set`".
510
+
509
511
If you add more volumes to your stack, you need to make sure you add the corresponding constraints to the services that use that named volume.
510
512
511
513
Then you have to create those labels in some nodes in your Docker Swarm mode cluster. You can use `docker-auto-labels` to do it automatically.
@@ -632,10 +634,10 @@ You can do the process by hand based on those same scripts if you wanted. The ge
632
634
```bash
633
635
# Use the environment variables passed to this script, as TAG and FRONTEND_ENV
634
636
# And re-create those variables as environment variables for the next command
635
-
TAG=${TAG} \
637
+
TAG=${TAG?Variable not set} \
636
638
# Set the environment variable FRONTEND_ENV to the same value passed to this script with
637
639
# a default value of "production" if nothing else was passed
638
-
FRONTEND_ENV=${FRONTEND_ENV-production} \
640
+
FRONTEND_ENV=${FRONTEND_ENV-production?Variable not set} \
639
641
# The actual comand that does the work: docker-compose
640
642
docker-compose \
641
643
# Pass the file that should be used, setting explicitly docker-compose.yml avoids the
@@ -653,7 +655,7 @@ config > docker-stack.yml
653
655
docker-auto-labels docker-stack.yml
654
656
655
657
# Now this command uses that same file to deploy it
# to disable www redirection remove the section: ${STACK_NAME?Variable not set}-www-redirect,
69
+
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.middlewares=${STACK_NAME?Variable not set}-www-redirect,${STACK_NAME?Variable not set}-https-redirect
70
70
71
71
db:
72
72
image: postgres:12
@@ -79,12 +79,12 @@ services:
79
79
deploy:
80
80
placement:
81
81
constraints:
82
-
- node.labels.${STACK_NAME}.app-db-data == true
82
+
- node.labels.${STACK_NAME?Variable not set}.app-db-data == true
0 commit comments