Last active
June 5, 2018 15:37
-
-
Save imjosh/1d0356453b9bfe9ae1b674cd2be8a676 to your computer and use it in GitHub Desktop.
Portainer stacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.6" | |
services: | |
portainer: | |
image: portainer/portainer | |
command: --ssl --sslcert /path/to/certificate.crt --sslkey /path/to/certificate.key --admin-password-file '/path/to/password.txt' | |
ports: | |
- "9000:9000" | |
networks: | |
- portainer-net | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- portainer-data:/data | |
deploy: | |
placement: | |
constraints: [node.role == manager] | |
restart_policy: | |
condition: any | |
resources: | |
limits: | |
cpus: '0.20' | |
memory: 256M | |
networks: | |
portainer-net: | |
volumes: | |
portainer-data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.6" | |
services: | |
portainer: | |
image: portainer/portainer | |
command: --ssl --sslcert /run/secrets/portainer.crt --sslkey /run/secrets/portainer.key --admin-password-file '/run/secrets/portainer-pass' | |
ports: | |
- "9000:9000" | |
networks: | |
- portainer-net | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- portainer-data:/data | |
deploy: | |
placement: | |
constraints: [node.role == manager] | |
restart_policy: | |
condition: any | |
resources: | |
limits: | |
cpus: '0.20' | |
memory: 256M | |
secrets: | |
- portainer.crt | |
- portainer.key | |
- portainer-pass | |
networks: | |
portainer-net: | |
volumes: | |
portainer-data: | |
secrets: | |
portainer.crt: | |
external: true | |
portainer.key: | |
external: true | |
portainer-pass: | |
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# init secrets | |
echo -n P@s$w0rd123! | docker secret create portainer-pass - | |
docker secret create portainer.crt your_ssl_cert.crt | |
docker secret create portainer.key your_ssl_key.key | |
# deploy portainer | |
docker stack deploy -c portainer-with-ssl-and-admin-password.yml portainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://gist.github.com/deviantony/a332e874756af8b7c8e009b9df1a5c8a#file-portainer-agent-stack-yml | |
version: '3.6' | |
services: | |
agent: | |
image: portainer/agent:latest | |
environment: | |
AGENT_PORT: 9001 | |
# Should be equal to the service name prefixed by "tasks." when | |
# deployed inside an overlay network | |
AGENT_CLUSTER_ADDR: tasks.agent | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
networks: | |
- portainer-net | |
deploy: | |
mode: global | |
portainer: | |
image: portainer/portainer:latest | |
command: -H tcp://tasks.agent:9001 --tlsskipverify --ssl --sslcert /path/to/certificate.crt --sslkey /path/to/certificate.key --admin-password-file '/path/to/password.txt' | |
ports: | |
- "9000:9000" | |
volumes: | |
- portainer_data:/data | |
networks: | |
- portainer-net | |
deploy: | |
placement: | |
constraints: [node.role == manager] | |
mode: replicated | |
replicas: 1 | |
restart_policy: | |
condition: any | |
resources: | |
limits: | |
cpus: '0.20' | |
memory: 256M | |
networks: | |
portainer-net: | |
driver: overlay | |
volumes: | |
portainer_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment