-
Hi there, I would like to run the services in portainer as a stack. Does anyone already have an example stack. I'm unsure how to handle the profiles in portainer. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Here is the stack config I use for portainer: version: '3.9'
x-base_service: &base_service
ports:
- "${WEBUI_PORT:-7860}:7860"
volumes:
- &v1 stable-diffusion-data:/data
- &v2 stable-diffusion-output:/output
stop_signal: SIGKILL
tty: true
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['0']
capabilities: [compute, utility]
name: webui-docker
services:
download:
build: https://github.com/AbdBarho/stable-diffusion-webui-docker.git#:/services/download
profiles: ["download"]
volumes:
- *v1
auto: &automatic
<<: *base_service
profiles: ["auto"]
build: https://github.com/AbdBarho/stable-diffusion-webui-docker.git#:/services/AUTOMATIC1111
image: sd-auto:74
environment:
- CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api
auto-cpu:
<<: *automatic
profiles: ["auto-cpu"]
deploy: {}
environment:
- CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api
invoke: &invoke
<<: *base_service
profiles: ["invoke"]
build: https://github.com/AbdBarho/stable-diffusion-webui-docker.git#:/services/invoke/
image: sd-invoke:30
environment:
- PRELOAD=true
- CLI_ARGS=--xformers
# invoke-cpu:
# <<: *invoke
# profiles: ["invoke-cpu"]
# environment:
# - PRELOAD=true
# - CLI_ARGS=--always_use_cpu
comfy: &comfy
<<: *base_service
profiles: ["comfy"]
build: https://github.com/AbdBarho/stable-diffusion-webui-docker.git#:/services/comfy/
image: sd-comfy:6
environment:
- CLI_ARGS=
comfy-cpu:
<<: *comfy
profiles: ["comfy-cpu"]
deploy: {}
environment:
- CLI_ARGS=--cpu
volumes:
stable-diffusion-data:
external: true
stable-diffusion-output:
external: true Since we're using portainer, working with relative paths is kind of a pain, so I've modified the To initiate profiles in portainer, you need to create an environment variable called 'COMPOSE_PROFILES', with the value set to the profile name you want to run. Example, setting the value to When that profile completes the container will terminate. When that happens, set the Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
What's wrong with Docker Swarm? I am running both Swarm and Portainer on regular basis, and can't think what could be here a problem. |
Beta Was this translation helpful? Give feedback.
-
Swarm is dedicated to deploy things, not to build them.
Profiles are meant to be used to separate parts of stack and run only "production" or "development" apps locally. A bit of work, but doable. |
Beta Was this translation helpful? Give feedback.
-
I'm not familiar with working with swarm but for what it's worth, I have an additional process that I have used before. It's a few extra steps but it may be compatible with your needs:
Then use a straight-forward compose-profile that pulls the image from your registry and launches without profile: version: '3.9'
services:
automatic1111:
container_name: automatic1111
image: my.registry/automatic1111:1.8
ports:
- "${WEBUI_PORT:-7860}:7860"
volumes:
- &v1 stable-diffusion-data:/data
- &v2 stable-diffusion-output:/output
stop_signal: SIGKILL
tty: true
environment:
- CLI_ARGS=--allow-code --xformers --enable-insecure-extension-access --api
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['0']
capabilities: [compute, utility]
volumes:
stable-diffusion-data:
external: true
stable-diffusion-output:
external: true |
Beta Was this translation helpful? Give feedback.
Swarm is dedicated to deploy things, not to build them.
You still need multiple step process here, like:
docker-compose.override.yml
that are pointing to your private docker registry.Profiles are meant to be used to separate parts of stack and run only "production" or "development" apps locally.
In most use cases you don't want to have profiles in your swarm stack. If you n…