Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _templates:
- local_volumes: &local_volumes
- /config: !BindRO /work/config/local
- snippets:
- - &trunk_stuff
- - !Copy
- source: /work/config/trunk
- path: /config
- - !EnsureDir /log
- - !EnsureDir /lithos
- - !Copy
- source: /work/lithos/trunk
- path: /lithos
- - &production_stuff
- - !Copy
- source: /work/config/production
- path: /config
- - !EnsureDir /log
- - !EnsureDir /lithos
- - !Copy
- source: /work/lithos/production
- path: /lithos
- - &host_resolution
- - !EnsureDir /state
- - !Sh |
- /bin/ln -sfn /state/hosts /etc/hosts
- /bin/ln -sfn /state/resolv.conf /etc/resolv.conf
- containers:
- _base_alpine:
- setup:
- - !Alpine v3.4
- - !AlpineRepo {branch: edge, repo: main, tag: main}
- - !AlpineRepo {branch: edge, repo: testing, tag: testing}
- - !AlpineRepo {branch: edge, repo: community, tag: community}
- - !EnsureDir /config
- - !Sh "chmod +r /bin/bbsuid"
- frontend:
- image-cache-url: https://dl.uwtech.org/vagga/get/${container_name}.${short_hash}.tar.xz
- setup:
- - !Container _base_alpine
- - !Install [nodejs]
- - !NpmDependencies
- environ:
- NODE_PATH: /usr/lib/node_modules
- mysql:
- image-cache-url: https://dl.uwtech.org/vagga/get/${container_name}.${short_hash}.tar.xz
- 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:
- image-cache-url: https://dl.uwtech.org/vagga/get/${container_name}.${short_hash}.tar.xz
- setup:
- - !Container _base_alpine
- - !Install
- - php7@community
- - php7-fpm@community
- - php7-mysqli@community
- - php7-json@community
- - php7-ctype@community
- - php7-session@community
- - php7-zlib@community
- - !ComposerDependencies
- optimize_autoloader: true
- - !EnsureDir /log
- - !EnsureDir /storage
- php-dev:
- setup:
- - !Container php
- volumes:
- <<: *local_volumes
- /storage: !Persistent {name: storage_php}
- /log: !Persistent {name: php_log}
- /var/log: !Snapshot
- mysql-trunk:
- setup:
- - !Container mysql
- - !*Unpack
- - *trunk_stuff
- - *host_resolution
- resolv-conf-path: /state/resolv.conf
- hosts-file-path: /state/hosts
- php-trunk:
- setup:
- - !Container php
- - !AlpineRepo {branch: edge, repo: main, tag: main}
- - !AlpineRepo {branch: edge, repo: testing, tag: testing}
- - !AlpineRepo {branch: edge, repo: community, tag: community}
- - !*Unpack
- - *trunk_stuff
- - *host_resolution
- - !EnsureDir /app
- - !Copy
- source: /work
- path: /app
- include-regex: ^(application|content|system)/*
- - !Copy
- source: /work/index.php
- path: /app/index.php
- - !Build
- container: frontend-trunk
- source: /static
- temporary-mount: /mnt
- - !Copy
- source: /mnt/frontend.ver
- path: /app/frontend.ver
- resolv-conf-path: /state/resolv.conf
- hosts-file-path: /state/hosts
- mysql-production:
- setup:
- - !Container mysql
- - !*Unpack
- - *production_stuff
- - *host_resolution
- resolv-conf-path: /state/resolv.conf
- hosts-file-path: /state/hosts
- php-production:
- setup:
- - !Container php
- - !AlpineRepo {branch: edge, repo: main, tag: main}
- - !AlpineRepo {branch: edge, repo: testing, tag: testing}
- - !AlpineRepo {branch: edge, repo: community, tag: community}
- - !*Unpack
- - *production_stuff
- - *host_resolution
- - !EnsureDir /app
- - !Copy
- source: /work
- path: /app
- include-regex: ^(application|content|system)/*
- - !Copy
- source: /work/index.php
- path: /app/index.php
- - !Build
- container: frontend-production
- source: /static
- temporary-mount: /mnt
- - !Copy
- source: /mnt/frontend.ver
- path: /app/frontend.ver
- resolv-conf-path: /state/resolv.conf
- hosts-file-path: /state/hosts
- <<:
- - !*Include "vagga.trunk.yaml"
- - !*Include "vagga.production.yaml"
- commands:
- _init_db: !Command
- description: Initialize MySQL database
- container: mysql
- environ:
- DB_HOST: 127.0.0.1
- DB_DATABASE: get
- DB_USERNAME: get
- DB_PASSWORD: get
- 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-dev
- 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]
- migration: &migration !Command
- container: php
- description: Run latest migration
- run: |
- cd /work/
- php7 index.php cli migration last
- _clean-old-static: !Command
- container: frontend
- description: Clean static files
- run: |
- mkdir -vp /work/static
- rm -rf /work/static/*
- build-static: !Command
- prerequisites: [_clean-old-static]
- container: frontend
- description: Build static files
- run: [npm, run-script, webpack:trunk]
- watch-static: !Command
- prerequisites: [_clean-old-static]
- container: frontend
- description: Watch and auto-rebuild changed static files
- run: [npm, run-script, webpack:watch]
- 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