5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 05:36:21 +00:00

puma ya no daemoniza por su cuenta

This commit is contained in:
f 2020-09-27 14:04:11 -03:00
parent c4d58e3206
commit e4de488225
6 changed files with 14 additions and 18 deletions

View file

@ -58,10 +58,7 @@ COPY --chown=app:root ./config/credentials.yml.enc ./config/
COPY --chown=app:www-data ./public/assets-production ./public/assets
COPY --chown=app:www-data ./public/packs-production ./public/packs
# Eliminar la necesidad de un runtime JS en producción, porque los
# assets ya están pre-compilados.
RUN sed -re "/(sassc|uglifier|bootstrap|coffee-rails)/d" -i Gemfile
RUN bundle clean
# Limpieza
RUN rm -rf ./node_modules ./tmp/cache ./.git
# Contenedor final
@ -113,7 +110,7 @@ RUN install -m 755 /srv/http/sync_assets.sh /usr/local/bin/sync_assets
# Instalar la configuración de monit
RUN install -m 640 -o root -g root /srv/http/monit.conf /etc/monit.d/sutty.conf
RUN apk add --no-cache daemonize ruby-webrick
RUN install -m 755 /srv/http/prometheus.sh /usr/local/bin/prometheus
RUN install -m 755 /srv/http/entrypoint.sh /usr/local/bin/sutty
# Mantener estos directorios!
VOLUME "/srv/http/data"

10
Gemfile
View file

@ -23,10 +23,6 @@ gem 'dotenv-rails', require: 'dotenv/rails-now'
gem 'rails', '~> 6'
# Use Puma as the app server
gem 'puma'
# Use SCSS for stylesheets
gem 'sassc-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
@ -39,7 +35,6 @@ gem 'jbuilder', '~> 2.5'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'blazer'
gem 'bootstrap', '~> 4'
gem 'commonmarker'
gem 'devise'
gem 'devise-i18n'
@ -96,6 +91,11 @@ group :production do
end
group :development, :test do
# Use SCSS for stylesheets
gem 'sassc-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem 'bootstrap', '~> 4'
gem 'derailed_benchmarks'
gem 'pry'
# Adds support for Capybara system testing and selenium driver

View file

@ -1,5 +1,5 @@
migrate: bundle exec rake db:prepare db:seed
sutty: bundle exec puma -d config.ru
sutty: bundle exec puma config.ru
blazer_5m: bundle exec rake blazer:run_checks SCHEDULE="5 minutes"
blazer_1h: bundle exec rake blazer:run_checks SCHEDULE="1 hour"
blazer_1d: bundle exec rake blazer:run_checks SCHEDULE="1 day"

View file

@ -2,5 +2,9 @@
set -e
case $1 in
sutty)
su app -c "cd /srv/http && foreman start migrate"
daemonize -c /srv/http -u app /usr/bin/foreman start sutty
;;
prometheus) daemonize -c /srv/http -p /tmp/prometheus.pid -l /tmp/prometheus.pid -u app /usr/bin/foreman start prometheus ;;
esac

View file

@ -1,10 +1,9 @@
check process sutty with pidfile /srv/http/tmp/puma.pid
start program = "/bin/sh -c 'cd /srv/http && foreman start migrate && foreman start sutty'"
as uid "app" and gid "www-data"
start program = "/usr/local/bin/sutty sutty"
stop program = "/bin/sh -c 'cat /srv/http/tmp/puma.pid | xargs kill'"
check process prometheus with pidfile /tmp/prometheus.pid
start program = "/usr/local/bin/prometheus"
start program = "/usr/local/bin/sutty prometheus"
stop program = "/bin/sh -c 'cat /tmp/prometheus.pid | xargs kill'"
check program sync_assets

View file

@ -1,4 +0,0 @@
#!/bin/sh
set -e
daemonize -c /srv/http -p /tmp/prometheus.pid -l /tmp/prometheus.pid -u app /usr/bin/foreman start prometheus