Sfoglia il codice sorgente

Updated for using postgres on recordings

master
jfederico 4 anni fa
parent
commit
137eb687bd
3 ha cambiato i file con 44 aggiunte e 4 eliminazioni
  1. 1
    0
      docker-compose.yml
  2. 20
    4
      scalelite/bin/start
  3. 23
    0
      scalelite/config/database.yml

+ 1
- 0
docker-compose.yml Vedi File

@@ -57,6 +57,7 @@ services:
57 57
     volumes:
58 58
       - ./scalelite/log/api:/srv/scalelite/log
59 59
       - ./scalelite/bin/start:/srv/scalelite/bin/start
60
+      - ./scalelite/config/database.yml:/srv/scalelite/config/database.yml
60 61
       - ./scalelite/tmp/pids/:/usr/src/app/tmp/pids
61 62
       - ./scalelite/tmp/sockets/:/usr/src/app/tmp/sockets
62 63
       - ./scalelite/tmp/cache/assets:/usr/src/app/tmp/cache/assets

+ 20
- 4
scalelite/bin/start Vedi File

@@ -6,15 +6,31 @@ servers="$(RAILS_ENV=$RAILS_ENV bundle exec rake servers 2>&1)"
6 6
 echo $servers
7 7
 
8 8
 if [ "$(echo "$servers" | cut -c0-2)" == "No" ]; then
9
-  echo ">>> Add test-install as the default server"
9
+  echo ">>> Adding test-install as the default server"
10 10
   bundle exec rake servers:add["https://test-install.blindsidenetworks.com/bigbluebutton/api","8cd8ef52e8e101574e400365b55e11a6"]
11 11
   bundle exec rake servers
12 12
   bundle exec rake status
13
-  echo ">>> Server must be enabled from the console"
14
-else
15
-  echo ">>> Do nothing"
13
+  echo ">>> Server added by default must be enabled using the rake command"
14
+fi
15
+
16
+if [ "$RAILS_ENV" = "production" ] && [ "$DB_ADAPTER" = "postgresql" ]; then
17
+  while ! curl http://$DB_HOST:${DB_PORT:-5432}/ 2>&1 | grep '52'
18
+  do
19
+    echo "Waiting for postgres to start up ..."
20
+    sleep 1
21
+  done
16 22
 fi
17 23
 
24
+db_create="$(RAILS_ENV=$RAILS_ENV bundle exec rake db:create 2>&1)"
25
+echo $db_create
26
+
27
+if [[ $db_create == *"already exists"* ]]; then
28
+  echo ">>> Database migration"
29
+  bundle exec rake db:migrate
30
+else
31
+  echo ">>> Database initialization"
32
+  bundle exec rake db:schema:load
33
+fi
18 34
 
19 35
 exec tini -- bundle exec puma -C config/puma.rb "$@"
20 36
 #tail -f /dev/null

+ 23
- 0
scalelite/config/database.yml Vedi File

@@ -0,0 +1,23 @@
1
+default: &default
2
+  pool: <%= ENV.fetch('RAILS_MAX_THREADS') { 5 } %>
3
+  timeout: 5000
4
+  adapter: postgresql
5
+  host: <%= ENV['DB_HOST'] %>
6
+  username: <%= ENV['DB_USERNAME'] %>
7
+  password: <%= ENV['DB_PASSWORD'] %>
8
+  encoding: unicode
9
+
10
+development:
11
+  <<: *default
12
+  database: scalelite_development
13
+
14
+# Warning: The database defined as "test" will be erased and
15
+# re-generated from your development database when you run "rake".
16
+# Do not set this db to the same as development or production.
17
+test:
18
+  <<: *default
19
+  database: scalelite_test
20
+
21
+production:
22
+  <<: *default
23
+  database: <%= ENV['DB_NAME'] || 'scalelite' %>

Loading…
Annulla
Salva