diff options
author | jfederico <jesus@123it.ca> | 2020-02-12 16:38:45 -0500 |
---|---|---|
committer | jfederico <jesus@123it.ca> | 2020-02-12 16:38:45 -0500 |
commit | 137eb687bdfce31135de6f153e4e085e1b9e08a8 (patch) | |
tree | af532c193f95a390022a78e1d6ecb972a0b2f79e | |
parent | 8d9217b767beff7408ef8824a47d9e5655cdddd1 (diff) | |
download | scalelite-run-itzks-137eb687bdfce31135de6f153e4e085e1b9e08a8.tar.gz scalelite-run-itzks-137eb687bdfce31135de6f153e4e085e1b9e08a8.tar.bz2 scalelite-run-itzks-137eb687bdfce31135de6f153e4e085e1b9e08a8.zip |
Updated for using postgres on recordings
-rw-r--r-- | docker-compose.yml | 1 | ||||
-rwxr-xr-x | scalelite/bin/start | 24 | ||||
-rw-r--r-- | scalelite/config/database.yml | 23 |
3 files changed, 44 insertions, 4 deletions
diff --git a/docker-compose.yml b/docker-compose.yml index c54f609..3e5e059 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,6 +57,7 @@ services: volumes: - ./scalelite/log/api:/srv/scalelite/log - ./scalelite/bin/start:/srv/scalelite/bin/start + - ./scalelite/config/database.yml:/srv/scalelite/config/database.yml - ./scalelite/tmp/pids/:/usr/src/app/tmp/pids - ./scalelite/tmp/sockets/:/usr/src/app/tmp/sockets - ./scalelite/tmp/cache/assets:/usr/src/app/tmp/cache/assets diff --git a/scalelite/bin/start b/scalelite/bin/start index 4c19e52..5c95e1c 100755 --- a/scalelite/bin/start +++ b/scalelite/bin/start @@ -6,15 +6,31 @@ servers="$(RAILS_ENV=$RAILS_ENV bundle exec rake servers 2>&1)" echo $servers if [ "$(echo "$servers" | cut -c0-2)" == "No" ]; then - echo ">>> Add test-install as the default server" + echo ">>> Adding test-install as the default server" bundle exec rake servers:add["https://test-install.blindsidenetworks.com/bigbluebutton/api","8cd8ef52e8e101574e400365b55e11a6"] bundle exec rake servers bundle exec rake status - echo ">>> Server must be enabled from the console" -else - echo ">>> Do nothing" + echo ">>> Server added by default must be enabled using the rake command" +fi + +if [ "$RAILS_ENV" = "production" ] && [ "$DB_ADAPTER" = "postgresql" ]; then + while ! curl http://$DB_HOST:${DB_PORT:-5432}/ 2>&1 | grep '52' + do + echo "Waiting for postgres to start up ..." + sleep 1 + done fi +db_create="$(RAILS_ENV=$RAILS_ENV bundle exec rake db:create 2>&1)" +echo $db_create + +if [[ $db_create == *"already exists"* ]]; then + echo ">>> Database migration" + bundle exec rake db:migrate +else + echo ">>> Database initialization" + bundle exec rake db:schema:load +fi exec tini -- bundle exec puma -C config/puma.rb "$@" #tail -f /dev/null diff --git a/scalelite/config/database.yml b/scalelite/config/database.yml new file mode 100644 index 0000000..80a0afd --- /dev/null +++ b/scalelite/config/database.yml @@ -0,0 +1,23 @@ +default: &default + pool: <%= ENV.fetch('RAILS_MAX_THREADS') { 5 } %> + timeout: 5000 + adapter: postgresql + host: <%= ENV['DB_HOST'] %> + username: <%= ENV['DB_USERNAME'] %> + password: <%= ENV['DB_PASSWORD'] %> + encoding: unicode + +development: + <<: *default + database: scalelite_development + +# 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: scalelite_test + +production: + <<: *default + database: <%= ENV['DB_NAME'] || 'scalelite' %> |