5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 23:56:22 +00:00
This commit is contained in:
f 2019-04-08 15:31:29 -03:00
parent 1ae3754fb5
commit 821e6b276d
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
4 changed files with 64 additions and 9 deletions

23
.dockerignore Normal file
View file

@ -0,0 +1,23 @@
Dockerfile
node_modules/
tmp/
log/
public/
docs/
bin/
db/
lib/
test/
tmp/
vendor/
config.ru
LICENSE
Makefile
monit.conf
README.md
TODO*
web@.service
_usuarias/
_invitadxs/
_deploy/
_sites/

View file

@ -23,7 +23,7 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
# Workers do not work on JRuby or Windows (both of which do not support # Workers do not work on JRuby or Windows (both of which do not support
# processes). # processes).
# #
# workers ENV.fetch("WEB_CONCURRENCY") { 2 } workers ENV.fetch('WEB_CONCURRENCY') { 2 }
# Use the `preload_app!` method when specifying a `workers` number. # Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code # This directive tells Puma to first boot the application and load code
@ -32,15 +32,15 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
# you need to make sure to reconnect any threads in the `on_worker_boot` # you need to make sure to reconnect any threads in the `on_worker_boot`
# block. # block.
# #
# preload_app! preload_app!
# If you are preloading your application and using Active Record, it's # If you are preloading your application and using Active Record, it's
# recommended that you close any connections to the database before workers # recommended that you close any connections to the database before workers
# are forked to prevent connection leakage. # are forked to prevent connection leakage.
# #
# before_fork do before_fork do
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
# end end
# The code in the `on_worker_boot` will be called if you are using # The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker # clustered mode by specifying a number of `workers`. After each worker
@ -49,10 +49,11 @@ environment ENV.fetch('RAILS_ENV') { 'development' }
# or connections that may have been created at application boot, as Ruby # or connections that may have been created at application boot, as Ruby
# cannot share connections between processes. # cannot share connections between processes.
# #
# on_worker_boot do on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end end
#
# Allow puma to be restarted by `rails restart` command. # Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart plugin :tmp_restart
pidfile 'tmp/puma.pid'

24
entrypoint.sh Normal file
View file

@ -0,0 +1,24 @@
#!/bin/sh
set -e
export RAILS_ENV=production
case $1 in
rails)
cd /srv/http
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec puma -d config.ru
exit $?
;;
darkhttpd)
darkhttpd /srv/http/public \
--no-server-id \
--pidfile /tmp/darkhttpd.pid \
--uid darkhttpd \
--gid www-data \
--no-listing \
--daemon \
--port 8080
exit $?
;;
esac

7
monit.conf Normal file
View file

@ -0,0 +1,7 @@
check process rails with pidfile /srv/http/tmp/puma.pid
start program = "/usr/bin/entrypoint rails" as uid app
stop program = "/bin/sh -c 'cat /srv/http/tmp/puma.pid | xargs kill'"
check process static with pidfile /tmp/darkhttpd.pid
start program = "/usr/bin/entrypoint darkhttpd"
stop program = "/bin/sh -c 'cat /tmp/darkhttpd.pid | xargs kill'"