Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. spark ~/Projects/WC $ cat vagga.yaml
  2. _templates:
  3. local_volumes: &local_volumes
  4. /config: !BindRO /work/config/local
  5.  
  6. containers:
  7. _base_alpine:
  8. setup:
  9. - !Alpine v3.5
  10. - !AlpineRepo {branch: v3.5, repo: community, tag: community}
  11. - !EnsureDir /config
  12. - !Sh "chmod +r /bin/bbsuid"
  13.  
  14. mysql:
  15. setup:
  16. - !Container _base_alpine
  17. - !Install
  18. - mariadb
  19. - mariadb-client
  20. - !EnsureDir /storage
  21. volumes:
  22. <<: *local_volumes
  23. /storage: !Persistent {name: storage_mysql, init-command: _init_db}
  24.  
  25. nginx:
  26. setup:
  27. - !Container _base_alpine
  28. - !Install [nginx]
  29. volumes:
  30. <<: *local_volumes
  31. /var/log/nginx: !Snapshot
  32.  
  33. php:
  34. setup:
  35. - !Container _base_alpine
  36. - !Install
  37. - php7-fpm@community
  38. - php7-mysqli@community
  39. - php7-json@community
  40. - php7-ctype@community
  41. - php7-curl@community
  42. - php7-session@community
  43. - php7-zlib@community
  44. - php7-mbstring@community
  45. - !EnsureDir /log
  46. - !EnsureDir /storage
  47. volumes:
  48. <<: *local_volumes
  49. /storage: !Persistent {name: storage_php}
  50. /log: !Persistent {name: php_log}
  51. /var/log: !Snapshot
  52.  
  53. commands:
  54. _init_db: !Command
  55. description: Initialize MySQL database
  56. container: mysql
  57. environ:
  58. DB_HOST: 127.0.0.1
  59. DB_DATABASE: wp
  60. DB_USERNAME: wp
  61. DB_PASSWORD: wp
  62. run: |
  63. mysql_install_db --datadir=/storage
  64. mysqld_safe --defaults-extra-file=/config/mysql/my.cnf --skip-syslog --no-auto-restart
  65. while [ ! -f /tmp/mysqld.pid ]; do sleep 0.1; done
  66. mysqladmin --defaults-extra-file=/config/mysql/my.cnf create $DB_DATABASE
  67. mysql --defaults-extra-file=/config/mysql/my.cnf -e "CREATE USER '$DB_USERNAME'@'$DB_HOST' IDENTIFIED BY '$DB_PASSWORD';"
  68. mysql --defaults-extra-file=/config/mysql/my.cnf -e "GRANT ALL PRIVILEGES ON $DB_DATABASE.* TO '$DB_USERNAME'@'$DB_HOST';"
  69. mysqladmin --defaults-extra-file=/config/mysql/my.cnf flush-privileges
  70. mysqladmin --defaults-extra-file=/config/mysql/my.cnf shutdown
  71.  
  72. mysql: &mysql !Command
  73. container: mysql
  74. description: Run mysql database server
  75. user-id: 1
  76. external-user-id: 0
  77. run: mysqld_safe --defaults-extra-file=/config/mysql/my.cnf --skip-syslog --console --debug-gdb
  78.  
  79. nginx: &nginx !Command
  80. container: nginx
  81. description: Run nginx webserver
  82. run: nginx -c /config/nginx.conf
  83.  
  84. php: &php !Command
  85. container: php
  86. description: Run php-fpm (application)
  87. user-id: 1
  88. external-user-id: 0
  89. run: [php-fpm7, -e, -F, -O, -y, /config/php/php-fpm.conf, -c, /config/php/php.ini]
  90.  
  91. run: !Supervise
  92. description: Run full server stack
  93. kill-unresponsive-after: 5
  94. children:
  95. mysql: *mysql
  96. nginx: *nginx
  97. php: *php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement