I have a stack in a swarm. It’s is Symfony + nginx. I implement it like both services can see each other data through a shared volume called app.
The problem is when I change some data in the php image and I want to re-deploy the stack then I need to manually remove a stack and remove the app volume so that the app volume could be populated by a new php container.
What I need to change to make a re-deployment work without this manuall actions?
Any chanse I do this without copying data from a php image to a nginx image with ci or without any binding to a persisten host volume where I preliminarily should put data?
version: '3.7'
volumes:
app:
x-op-deploy: &deploy
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node1]
x-php: &common-php-container
image: someSymfonyImage
volumes:
- app:/var/www/app # the Symfony image has a workdir on this path
deploy:
<<: *deploy
services:
php_fpm:
<<: *common-php-container
rest_server:
image: nginx
ports:
- "8080:80"
volumes:
- app:/var/www/app
command: '/bin/sh -c ''while :; do sleep 12h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
deploy:
<<: *deploy
Source: Symfony Questions
Was this helpful?
0 / 0