The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

212 lines
6.1 KiB

  1. run.config:
  2. engine: ruby
  3. engine.config:
  4. runtime: ruby-2.4.1
  5. extra_packages:
  6. # basic servers:
  7. - nginx
  8. - nodejs
  9. # for images:
  10. - ImageMagick
  11. # for videos:
  12. - ffmpeg3
  13. # to prep the .env file:
  14. - gettext-tools
  15. # for node-gyp, used in the asset compilation process:
  16. - python-2
  17. cache_dirs:
  18. - node_modules
  19. extra_path_dirs:
  20. - node_modules/.bin
  21. build_triggers:
  22. - .ruby-version
  23. - Gemfile
  24. - Gemfile.lock
  25. - package.json
  26. - yarn.lock
  27. extra_steps:
  28. - envsubst < .env.nanobox > .env
  29. - gem install bundler
  30. - bundle config build.nokogiri --with-iconv-dir=/data/ --with-zlib-dir=/data/
  31. - bundle config build.nokogumbo --with-iconv-dir=/data/ --with-zlib-dir=/data/
  32. - bundle install --clean
  33. - yarn
  34. fs_watch: true
  35. deploy.config:
  36. extra_steps:
  37. - NODE_ENV=production bundle exec rake assets:precompile
  38. transform:
  39. - "sed 's/LOCAL_HTTPS=.*/LOCAL_HTTPS=true/i' /app/.env.nanobox | envsubst > /app/.env.production"
  40. - |-
  41. if [ -z "$LOCAL_DOMAIN" ]
  42. then
  43. . /app/.env.production
  44. export LOCAL_DOMAIN
  45. fi
  46. erb /app/nanobox/nginx-web.conf.erb > /app/nanobox/nginx-web.conf
  47. erb /app/nanobox/nginx-stream.conf.erb > /app/nanobox/nginx-stream.conf
  48. - touch /app/log/production.log
  49. before_live:
  50. web.web:
  51. - bundle exec rake db:migrate:setup
  52. web.web:
  53. start:
  54. nginx: nginx -c /app/nanobox/nginx-web.conf
  55. rails: bundle exec puma -C /app/config/puma.rb
  56. routes:
  57. - '/'
  58. writable_dirs:
  59. - tmp
  60. log_watch:
  61. rails: 'log/production.log'
  62. network_dirs:
  63. data.storage:
  64. - public/system
  65. web.stream:
  66. start:
  67. nginx: nginx -c /app/nanobox/nginx-stream.conf
  68. node: yarn run start
  69. routes:
  70. - '/api/v1/streaming*'
  71. # Somehow we're getting requests for scheme://domain//api/v1/streaming* - match those, too
  72. - '//api/v1/streaming*'
  73. writable_dirs:
  74. - tmp
  75. worker.sidekiq:
  76. start: bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push -L /app/log/sidekiq.log
  77. writable_dirs:
  78. - tmp
  79. log_watch:
  80. rails: 'log/production.log'
  81. sidekiq: 'log/sidekiq.log'
  82. network_dirs:
  83. data.storage:
  84. - public/system
  85. cron:
  86. - id: generate_static_gifs
  87. schedule: '*/15 * * * *'
  88. command: 'bundle exec rake mastodon:maintenance:add_static_avatars'
  89. - id: update_counter_caches
  90. schedule: '50 * * * *'
  91. command: 'bundle exec rake mastodon:maintenance:update_counter_caches'
  92. # runs feeds:clear, media:clear, users:clear, and push:refresh
  93. - id: do_daily_tasks
  94. schedule: '00 00 * * *'
  95. command: 'bundle exec rake mastodon:daily'
  96. - id: clear_silenced_media
  97. schedule: '10 00 * * *'
  98. command: 'bundle exec rake mastodon:media:remove_silenced'
  99. - id: clear_remote_media
  100. schedule: '20 00 * * *'
  101. command: 'bundle exec rake mastodon:media:remove_remote'
  102. - id: clear_unfollowed_subs
  103. schedule: '30 00 * * *'
  104. command: 'bundle exec rake mastodon:push:clear'
  105. - id: send_digest_emails
  106. schedule: '00 20 * * *'
  107. command: 'bundle exec rake mastodon:emails:digest'
  108. # The following two tasks can be uncommented to automatically open and close
  109. # registrations on a schedule. The format of 'schedule' is a standard cron
  110. # time expression: minute hour day month day-of-week; search for "cron
  111. # time expressions" for more info on how to set these up. The examples here
  112. # open registration only from 8 am to 4 pm, server time.
  113. #
  114. # - id: open_registrations
  115. # schedule: '00 08 * * *'
  116. # command: 'bundle exec rake mastodon:settings:open_registrations'
  117. #
  118. # - id: close_registrations
  119. # schedule: '00 16 * * *'
  120. # command: 'bundle exec rake mastodon:settings:close_registrations'
  121. data.db:
  122. image: nanobox/postgresql:9.5
  123. cron:
  124. - id: backup
  125. schedule: '0 3 * * *'
  126. command: |
  127. PGPASSWORD=${DATA_POSTGRES_PASS} pg_dump -U ${DATA_POSTGRES_USER} -w -Fc -O gonano |
  128. gzip |
  129. 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 --data-binary @- &&
  130. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  131. json_pp |
  132. grep ${HOSTNAME} |
  133. sort |
  134. head -n-${BACKUP_COUNT:-1} |
  135. sed 's/.*: "\(.*\)".*/\1/' |
  136. while read file
  137. do
  138. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  139. done
  140. data.redis:
  141. image: nanobox/redis:3.0
  142. cron:
  143. - id: backup
  144. schedule: '0 3 * * *'
  145. command: |
  146. 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 --data-binary @/data/var/db/redis/dump.rdb &&
  147. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  148. json_pp |
  149. grep ${HOSTNAME} |
  150. sort |
  151. head -n-${BACKUP_COUNT:-1} |
  152. sed 's/.*: "\(.*\)".*/\1/' |
  153. while read file
  154. do
  155. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  156. done
  157. data.storage:
  158. image: nanobox/unfs:0.9
  159. cron:
  160. - id: backup
  161. schedule: '0 3 * * *'
  162. command: |
  163. tar cz -C /data/var/db/unfs/ |
  164. 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 --data-binary @- &&
  165. curl -k -s -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/ |
  166. json_pp |
  167. grep ${HOSTNAME} |
  168. sort |
  169. head -n-${BACKUP_COUNT:-1} |
  170. sed 's/.*: "\(.*\)".*/\1/' |
  171. while read file
  172. do
  173. curl -k -H "X-AUTH-TOKEN: ${WAREHOUSE_DATA_HOARDER_TOKEN}" https://${WAREHOUSE_DATA_HOARDER_HOST}:7410/blobs/${file} -X DELETE
  174. done