X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=templates%2Fweb.template.yml;h=e71ff7e82321b3cc70c2f1829ac70898590342fb;hb=aef8682f1e9961d82b98aab87c7e47e0f08a6c52;hp=c95ff59fde35a4755464eb6f8a1ceeaccee10f60;hpb=7047cd35ef73a2a0a832b293e43d2ee982b1744a;p=discourse_docker.git diff --git a/templates/web.template.yml b/templates/web.template.yml index c95ff59..e71ff7e 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -24,22 +24,7 @@ params: upload_size: 10m run: - # see: https://www.imagemagick.org/discourse-server/viewtopic.php?f=4&t=29588 - - replace: - filename: /usr/local/etc/ImageMagick-6/policy.xml - from: "" - to: | - - - - - - - - - - - + - exec: thpoff echo "thpoff is installed!" - exec: /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end' - exec: /usr/local/bin/ruby -e 'if ENV["DISCOURSE_HOSTNAME"] == "discourse.example.com"; puts "Aborting! Domain is not configured!"; exit 1; end' - exec: chown -R discourse /home/discourse @@ -61,18 +46,7 @@ run: conf=/var/www/discourse/config/discourse.conf # find DISCOURSE_ env vars, strip the leader, lowercase the key - /usr/local/bin/ruby -e 'ENV.each{|k,v| puts "#{$1.downcase} = #{v}" if k =~ /^DISCOURSE_(.*)/}' > $conf - - file: - path: /etc/runit/1.d/00-fix-log-permissions - chmod: "+x" - contents: | - #!/bin/bash - mkdir -p /var/log/nginx - chown -R www-data:www-data /var/log/nginx - chown www-data:www-data /var/log/nginx - chown -f syslog:adm /var/log/syslog* - chown -f syslog:adm /var/log/auth.log* - chown -f syslog:adm /var/log/kern.log* + /usr/local/bin/ruby -e 'ENV.each{|k,v| puts "#{$1.downcase} = '\''#{v}'\''" if k =~ /^DISCOURSE_(.*)/}' > $conf - file: path: /etc/runit/1.d/enable-brotli @@ -91,7 +65,7 @@ run: # postgres cd $home chown -R discourse:www-data /shared/log/rails - HOME=/home/discourse USER=discourse exec chpst -u discourse:www-data -U discourse:www-data bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb + LD_PRELOAD=$RUBY_ALLOCATOR HOME=/home/discourse USER=discourse exec thpoff chpst -u discourse:www-data -U discourse:www-data bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb - file: path: /etc/service/nginx/run @@ -173,13 +147,13 @@ run: cmd: # ensure we are on latest bundler - gem update bundler - - chown -R discourse $home + - find $home ! -user discourse -exec chown discourse {} \+ - exec: cd: $home hook: bundle_exec cmd: - - su discourse -c 'bundle install --deployment --verbose --without test --without development' + - su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4' - su discourse -c 'bundle exec rake db:migrate' - su discourse -c 'bundle exec rake assets:precompile' @@ -210,6 +184,20 @@ run: #!/bin/bash (cd /var/www/discourse && RAILS_ENV=production sudo -H -E -u discourse bundle exec bin/rake "$@") + - file: + path: /usr/local/bin/rbtrace + chmod: +x + contents: | + #!/bin/bash + (cd /var/www/discourse && RAILS_ENV=production sudo -H -E -u discourse bundle exec rbtrace "$@") + + - file: + path: /usr/local/bin/stackprof + chmod: +x + contents: | + #!/bin/bash + (cd /var/www/discourse && RAILS_ENV=production sudo -H -E -u discourse bundle exec stackprof "$@") + - file: path: /etc/update-motd.d/10-web chmod: +x @@ -224,11 +212,10 @@ run: contents: | /shared/log/rails/*.log { - rotate 14 + rotate 7 dateext daily missingok - notifempty delaycompress compress postrotate @@ -242,11 +229,10 @@ run: /var/log/nginx/*.log { daily missingok - rotate 14 + rotate 7 compress delaycompress - notifempty - create 0640 www-data www-data + create 0644 www-data www-data sharedscripts postrotate sv 1 nginx