where i deviate from standard mastodon assets
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

boxfile.yml 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. run.config:
  2. engine: ruby
  3. engine.config:
  4. runtime: ruby-2.5
  5. extra_packages:
  6. # basic servers:
  7. - nginx
  8. - nodejs
  9. # for images:
  10. - ImageMagick
  11. - jemalloc
  12. # for videos:
  13. - ffmpeg3
  14. # to prep the .env file:
  15. - gettext-tools
  16. # for node-gyp, used in the asset compilation process:
  17. - python-2
  18. # i18n:
  19. - libidn
  20. cache_dirs:
  21. - node_modules
  22. extra_path_dirs:
  23. - node_modules/.bin
  24. build_triggers:
  25. - .ruby-version
  26. - Gemfile
  27. - Gemfile.lock
  28. - package.json
  29. - yarn.lock
  30. extra_steps:
  31. - cp .env.nanobox .env
  32. - yarn
  33. fs_watch: true
  34. deploy.config:
  35. extra_steps:
  36. - NODE_ENV=production bundle exec rake assets:precompile
  37. transform:
  38. - "envsubst < /app/.env.nanobox > /app/.env.production"
  39. - |-
  40. if [ -z "$LOCAL_DOMAIN" ]
  41. then
  42. . /app/.env.production
  43. export LOCAL_DOMAIN
  44. fi
  45. erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
  46. erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
  47. - touch /app/log/production.log
  48. before_live:
  49. web.web:
  50. - bundle exec rake db:migrate:setup
  51. - |-
  52. if [[ "${ES_ENABLED}" != "false" ]]
  53. then
  54. bin/tootctl search deploy
  55. fi
  56. - bin/tootctl cache clear
  57. web.web:
  58. start:
  59. nginx: nginx -c /app/nanobox/nginx-web.conf
  60. rails: bundle exec puma -C /app/config/puma.rb
  61. routes:
  62. - '/'
  63. writable_dirs:
  64. - tmp
  65. log_watch:
  66. rails: 'log/production.log'
  67. network_dirs:
  68. data.storage:
  69. - public/system
  70. web.stream:
  71. start:
  72. nginx: nginx -c /app/nanobox/nginx-stream.conf
  73. node: yarn run start
  74. routes:
  75. - '/api/v1/streaming*'
  76. # Somehow we're getting requests for scheme://domain//api/v1/streaming* - match those, too
  77. - '//api/v1/streaming*'
  78. writable_dirs:
  79. - tmp
  80. worker.sidekiq:
  81. start:
  82. default: bundle exec sidekiq -c 5 -q default -L /app/log/sidekiq.log
  83. mailers: bundle exec sidekiq -c 5 -q mailers -L /app/log/sidekiq.log
  84. pull: bundle exec sidekiq -c 5 -q pull -L /app/log/sidekiq.log
  85. push: bundle exec sidekiq -c 5 -q push -L /app/log/sidekiq.log
  86. writable_dirs:
  87. - tmp
  88. log_watch:
  89. rails: 'log/production.log'
  90. sidekiq: 'log/sidekiq.log'
  91. network_dirs:
  92. data.storage:
  93. - public/system
  94. data.db:
  95. image: nanobox/postgresql:9.6
  96. cron:
  97. - id: backup
  98. schedule: '0 3 * * *'
  99. command: |
  100. PGPASSWORD=${DATA_DB_PASS} pg_dump -U ${DATA_DB_USER} -w -Fc -O gonano |
  101. gzip |
  102. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).sql.gz -X POST -T - >&2
  103. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  104. sed 's/,/\n/g' |
  105. grep ${HOSTNAME} |
  106. sort |
  107. head -n-${BACKUP_COUNT:-1} |
  108. sed 's/.*: \?"\(.*\)".*/\1/' |
  109. while read file
  110. do
  111. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  112. done
  113. data.elastic:
  114. image: nanobox/elasticsearch:5
  115. cron:
  116. - id: backup
  117. schedule: '0 3 * * *'
  118. command: |
  119. id=$(cat /proc/sys/kernel/random/uuid)
  120. curl -X PUT -H "Content-Type: application/json" "127.0.0.1:9200/_snapshot/${id}" -d "{\"type\": \"fs\",\"settings\": {\"location\": \"/var/tmp/${id}\",\"compress\": true}}"
  121. curl -X PUT -H "Content-Type: application/json" "127.0.0.1:9200/_snapshot/${id}/backup?wait_for_completion=true&pretty"
  122. tar -cz -C "/var/tmp/${id}" . |
  123. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).tgz -X POST -T - >&2
  124. curl -X DELETE -H "Content-Type: application/json" "127.0.0.1:9200/_snapshot/${id}"
  125. rm -rf "/var/tmp/${id}"
  126. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  127. sed 's/,/\n/g' |
  128. grep ${HOSTNAME} |
  129. sort |
  130. head -n-${BACKUP_COUNT:-1} |
  131. sed 's/.*: \?"\(.*\)".*/\1/' |
  132. while read file
  133. do
  134. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  135. done
  136. data.redis:
  137. image: nanobox/redis:4.0
  138. cron:
  139. - id: backup
  140. schedule: '0 3 * * *'
  141. command: |
  142. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).rdb -X POST -T /data/var/db/redis/dump.rdb >&2
  143. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  144. sed 's/,/\n/g' |
  145. grep ${HOSTNAME} |
  146. sort |
  147. head -n-${BACKUP_COUNT:-1} |
  148. sed 's/.*: \?"\(.*\)".*/\1/' |
  149. while read file
  150. do
  151. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  152. done
  153. data.storage:
  154. image: nanobox/unfs:0.9
  155. cron:
  156. - id: backup
  157. schedule: '0 3 * * *'
  158. command: |
  159. tar cz -C /data/var/db/unfs/ . |
  160. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/backup-${HOSTNAME}-$(date -u +%Y-%m-%d.%H-%M-%S).tgz -X POST -T - >&2
  161. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  162. sed 's/,/\n/g' |
  163. grep ${HOSTNAME} |
  164. sort |
  165. head -n-${BACKUP_COUNT:-1} |
  166. sed 's/.*: \?"\(.*\)".*/\1/' |
  167. while read file
  168. do
  169. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  170. done