Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spark ~/Projects/WC $ cat vagga.yaml
- _templates:
- local_volumes: &local_volumes
- /config: !BindRO /work/config/local
- containers:
- _base_alpine:
- setup:
- - !Alpine v3.5
- - !AlpineRepo {branch: v3.5, repo: community, tag: community}
- - !EnsureDir /config
- - !Sh "chmod +r /bin/bbsuid"
- mysql:
- setup:
- - !Container _base_alpine
- - !Install
- - mariadb
- - mariadb-client
- - !EnsureDir /storage
- volumes:
- <<: *local_volumes
- /storage: !Persistent {name: storage_mysql, init-command: _init_db}
- nginx:
- setup:
- - !Container _base_alpine
- - !Install [nginx]
- volumes:
- <<: *local_volumes
- /var/log/nginx: !Snapshot
- php:
- setup:
- - !Container _base_alpine
- - !Install
- - php7-fpm@community
- - php7-mysqli@community
- - php7-json@community
- - php7-ctype@community
- - php7-curl@community
- - php7-session@community
- - php7-zlib@community
- - php7-mbstring@community
- - !EnsureDir /log
- - !EnsureDir /storage
- volumes:
- <<: *local_volumes
- /storage: !Persistent {name: storage_php}
- /log: !Persistent {name: php_log}
- /var/log: !Snapshot
- commands:
- _init_db: !Command
- description: Initialize MySQL database
- container: mysql
- environ:
- DB_HOST: 127.0.0.1
- DB_DATABASE: wp
- DB_USERNAME: wp
- DB_PASSWORD: wp
- run: |
- mysql_install_db --datadir=/storage
- mysqld_safe --defaults-extra-file=/config/mysql/my.cnf --skip-syslog --no-auto-restart
- while [ ! -f /tmp/mysqld.pid ]; do sleep 0.1; done
- mysqladmin --defaults-extra-file=/config/mysql/my.cnf create $DB_DATABASE
- mysql --defaults-extra-file=/config/mysql/my.cnf -e "CREATE USER '$DB_USERNAME'@'$DB_HOST' IDENTIFIED BY '$DB_PASSWORD';"
- mysql --defaults-extra-file=/config/mysql/my.cnf -e "GRANT ALL PRIVILEGES ON $DB_DATABASE.* TO '$DB_USERNAME'@'$DB_HOST';"
- mysqladmin --defaults-extra-file=/config/mysql/my.cnf flush-privileges
- mysqladmin --defaults-extra-file=/config/mysql/my.cnf shutdown
- mysql: &mysql !Command
- container: mysql
- description: Run mysql database server
- user-id: 1
- external-user-id: 0
- run: mysqld_safe --defaults-extra-file=/config/mysql/my.cnf --skip-syslog --console --debug-gdb
- nginx: &nginx !Command
- container: nginx
- description: Run nginx webserver
- run: nginx -c /config/nginx.conf
- php: &php !Command
- container: php
- description: Run php-fpm (application)
- user-id: 1
- external-user-id: 0
- run: [php-fpm7, -e, -F, -O, -y, /config/php/php-fpm.conf, -c, /config/php/php.ini]
- run: !Supervise
- description: Run full server stack
- kill-unresponsive-after: 5
- children:
- mysql: *mysql
- nginx: *nginx
- php: *php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement