Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _templates:
- local_volumes: &local_volumes
- /config: !BindRO /work/config/local
- containers:
- _base_alpine:
- setup:
- - !Alpine v3.4
- - !EnsureDir /config
- - !Sh "chmod +r /bin/bbsuid"
- mysql:
- setup:
- - !Container _base_alpine
- - !Install
- - mariadb
- - mariadb-client
- volumes:
- <<: *local_volumes
- /var/lib/mysql: !Persistent {name: mysql, init-command: _init_db}
- nginx:
- setup:
- - !Container _base_alpine
- - !Install [nginx]
- volumes:
- <<: *local_volumes
- /var/log/nginx: !Snapshot
- php:
- setup:
- - !Alpine v3.4
- - !Sh "chmod +r /bin/bbsuid"
- - !AlpineRepo {branch: edge, repo: main, tag: main}
- - !AlpineRepo {branch: edge, repo: testing, tag: testing}
- - !AlpineRepo {branch: edge, repo: community, tag: community}
- - !Install
- - php5-fpm@main
- - php5-mysqli
- - php5-json
- - php5-cli
- - php5-ctype
- - !Copy
- source: /work/config/local/php-fpm.conf
- path: /etc/php5/fpm.d/app.pool.conf
- - !EnsureDir /log
- - !EnsureDir /config
- volumes:
- <<: *local_volumes
- /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: getexam
- DB_USERNAME: getexam
- DB_PASSWORD: getexam
- run: |
- mysql_install_db
- mysqld_safe --defaults-extra-file=/config/mysql.conf --skip-syslog --no-auto-restart
- while [ ! -f /tmp/mysqld.pid ]; do sleep 0.1; done
- mysqladmin --defaults-extra-file=/config/mysql.conf create $DB_DATABASE
- mysql --defaults-extra-file=/config/mysql.conf -e "CREATE USER '$DB_USERNAME'@'$DB_HOST' IDENTIFIED BY '$DB_PASSWORD';"
- mysql --defaults-extra-file=/config/mysql.conf -e "GRANT ALL PRIVILEGES ON $DB_DATABASE.* TO '$DB_USERNAME'@'$DB_HOST';"
- mysqladmin --defaults-extra-file=/config/mysql.conf flush-privileges
- mysqladmin --defaults-extra-file=/config/mysql.conf 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.conf --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-fpm, -eFO]
- migration: &migration !Command
- container: php
- description: Run latest migration
- user-id: 1
- external-user-id: 0
- run: |
- cd /work/
- php index.php cli migration last
- 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