usar postgresql en desarrollo

This commit is contained in:
f 2021-06-08 14:36:48 -03:00
parent 2b14010b1e
commit 57e86f3cfb
3 changed files with 24 additions and 9 deletions

View file

@ -38,8 +38,11 @@ test/%_test.rb: always
test: always
$(hain) 'cd /Sutty/sutty; RAILS_ENV=test bundle exec rake test'
serve: /etc/hosts
$(hain) 'cd /Sutty/sutty; bundle exec rails s -b "ssl://0.0.0.0:3000?key=../sutty.local/domain/$(SUTTY).key&cert=../sutty.local/domain/$(SUTTY).crt"'
postgresql: /etc/hosts
pgrep postgres >/dev/null || $(hain) postgresql
serve: /etc/hosts postgresql
$(MAKE) rails args=server
# make rails args="db:migrate"
rails:
@ -129,5 +132,6 @@ ota-rb:
@grep -q " $(SUTTY)$$" $@ || echo -e "127.0.0.1 $(SUTTY)\n::1 $(SUTTY)" | sudo tee -a $@
@grep -q " api.$(SUTTY)$$" $@ || echo -e "127.0.0.1 api.$(SUTTY)\n::1 api.$(SUTTY)" | sudo tee -a $@
@grep -q " panel.$(SUTTY)$$" $@ || echo -e "127.0.0.1 panel.$(SUTTY)\n::1 panel.$(SUTTY)" | sudo tee -a $@
@grep -q " postgresql.$(SUTTY)$$" $@ || echo -e "127.0.0.1 postgresql.$(SUTTY)\n::1 postgresql.$(SUTTY)" | sudo tee -a $@
.PHONY: always

View file

@ -5,20 +5,25 @@
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
encoding: unicode
development:
<<: *default
database: db/development.sqlite3
database: 'sutty'
host: 'postgresql.sutty.local'
user: <%= ENV['USER'] %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
database: 'sutty_test'
host: 'postgresql.sutty.local'
user: <%= ENV['USER'] %>
production:
adapter: postgresql
@ -26,4 +31,3 @@ production:
database: <%= ENV.fetch('DATABASE') { 'sutty' } %>
user: sutty
host: postgresql
encoding: unicode

View file

@ -19,8 +19,15 @@ worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
# Specifies the `port` that Puma will listen on to receive requests;
# default is 3000.
#
# port ENV.fetch('PORT') { 3000 }
# XXX: Por alguna razón el puerto en el contenedor es históricamente
# 3100, aunque en desarrollo es 3000. En algún momento deberíamos
# establecer un solo puerto.
if ENV['RAILS_ENV'] == 'production'
bind 'tcp://[::]:3100'
else
sutty = ENV.fetch('SUTTY', 'sutty.local')
bind "ssl://[::]:3000?key=../sutty.local/domain/#{sutty}.key&cert=../sutty.local/domain/#{sutty}.crt"
end
# Specifies the `environment` that Puma will run in.
#