Skip to content

Instantly share code, notes, and snippets.

@ajeetraina
Last active February 16, 2017 17:35
Show Gist options
  • Save ajeetraina/f339fecd2670942f5f768f969913103f to your computer and use it in GitHub Desktop.
Save ajeetraina/f339fecd2670942f5f768f969913103f to your computer and use it in GitHub Desktop.
Running Secrets for WordPress Application with Compose v3.1 File Format
version: "3.1"
services:
mysql:
image: "mysql"
networks:
test:
aliases: ["mysql"]
volumes:
- "db_data:/var/lib/mysql"
secrets:
- source: "mysqlpasswd"
target: "mysqlpasswd"
uid: "0"
gid: "0"
mode: 0444
- source: "mysqlrootpasswd"
target: "mysqlrootpasswd"
uid: "0"
gid: "0"
mode: 0444
environment:
MYSQL_ROOT_PASSWORD_FILE: "/run/secrets/mysqlrootpasswd"
MYSQL_PASSWORD_FILE: "/run/secrets/mysqlpasswd"
MYSQL_USER: "wordpress"
MYSQL_DATABASE: "wordpress"
deploy:
replicas: 1
web:
image: "wordpress:latest"
ports:
- "80:80"
volumes:
- "wp-data:/var/www/html"
networks:
test:
aliases: ["web"]
secrets:
- source: "mysqlpasswd"
target: "mysqlpasswd"
uid: "0"
gid: "0"
mode: 0444
- source: "wordpressdbpasswd"
target: "wordpressdbpasswd"
uid: "0"
gid: "0"
mode: 0444
environment:
WORDPRESS_DB_USER: "wordpress"
WORDPRESS_DB_PASSWORD_FILE: "/run/secrets/wordpressdbpasswd"
WORDPRESS_DB_HOST: "mysql:3306"
WORDPRESS_DB_NAME: "wordpress"
deploy:
replicas: 1
networks:
test:
driver: "overlay"
internal: true
secrets:
mysqlpasswd:
external:
name: "collab_*"
secrets:
mysqlrootpaswd:
external:
name: "collab_*"
secrets:
mysqldbpasswd:
external:
name: "collab_*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment