Merge branch 'postgresql' into 'rails'

usar postgresql en desarrollo

See merge request sutty/sutty!42
This commit is contained in:
fauno 2021-06-08 17:51:50 +00:00
commit 171ebc2388
3 changed files with 24 additions and 9 deletions

View file

@ -38,8 +38,11 @@ test/%_test.rb: always
test: always test: always
$(hain) 'cd /Sutty/sutty; RAILS_ENV=test bundle exec rake test' $(hain) 'cd /Sutty/sutty; RAILS_ENV=test bundle exec rake test'
serve: /etc/hosts postgresql: /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"' pgrep postgres >/dev/null || $(hain) postgresql
serve: /etc/hosts postgresql
$(MAKE) rails args=server
# make rails args="db:migrate" # make rails args="db:migrate"
rails: 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 " $(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 " 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 " 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 .PHONY: always

View file

@ -5,20 +5,25 @@
# gem 'sqlite3' # gem 'sqlite3'
# #
default: &default default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000 timeout: 5000
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
encoding: unicode
development: development:
<<: *default <<: *default
database: db/development.sqlite3 database: 'sutty'
host: 'postgresql.sutty.local'
user: <%= ENV['USER'] %>
# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake". # re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production. # Do not set this db to the same as development or production.
test: test:
<<: *default <<: *default
database: db/test.sqlite3 database: 'sutty_test'
host: 'postgresql.sutty.local'
user: <%= ENV['USER'] %>
production: production:
adapter: postgresql adapter: postgresql
@ -26,4 +31,3 @@ production:
database: <%= ENV.fetch('DATABASE') { 'sutty' } %> database: <%= ENV.fetch('DATABASE') { 'sutty' } %>
user: sutty user: sutty
host: postgresql 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; # Specifies the `port` that Puma will listen on to receive requests;
# default is 3000. # default is 3000.
# #
# port ENV.fetch('PORT') { 3000 } # XXX: Por alguna razón el puerto en el contenedor es históricamente
bind 'tcp://[::]:3100' # 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. # Specifies the `environment` that Puma will run in.
# #