From e2ad6e7715141c2cedf1d7f9c8173b17a55769dc Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Thu, 5 Jul 2018 17:25:59 -0400 Subject: [PATCH 1/3] make upgrading from 1.0 easier --- .dockerignore | 2 +- .gitignore | 2 +- Dockerfile | 6 +++--- README.md | 4 +++- app/controllers/application_controller.rb | 7 +++++++ app/views/application/migration_error.html.erb | 16 ++++++++++++++++ bin/start | 4 +++- config/environments/production.rb | 5 +++-- config/puma.rb | 2 +- docker-compose.yml | 10 +++++----- greenlight.nginx | 12 ++++++------ sample.env | 4 ++-- 12 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 app/views/application/migration_error.html.erb diff --git a/.dockerignore b/.dockerignore index 328b891a..ba912f55 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,7 +14,7 @@ tmp /db/**/*.sqlite3-journal /db/production public/assets -public/gl +public/b coverage/ spec/tmp .rvmrc diff --git a/.gitignore b/.gitignore index 51f1d350..2dfd8836 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ # Ignore static assets. /public/system/** /public/assets/** -/public/gl/** +/public/b/** # Ignore production paths. /db/production diff --git a/Dockerfile b/Dockerfile index 1155f08e..e31dc13c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ruby:2.5 # Install app dependencies. -RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs +RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs # Set an environment variable for the install location. ENV RAILS_ROOT /usr/src/app @@ -23,8 +23,8 @@ RUN bundle install --without development test --deployment --clean RUN bundle exec rake assets:clean RUN bundle exec rake assets:precompile -# Expose port 3000. -EXPOSE 3000 +# Expose port 80. +EXPOSE 80 # Start the application. CMD ["bin/start"] diff --git a/README.md b/README.md index be58538d..fbdda367 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Greenlight +Greenlight is currently on version 2.0. If you are still running Greenlight 1.0 we suggest [upgrading to 2.0](http://docs.bigbluebutton.org/install/greenlight-v2.html#upgrading-from-greenlight-10). + Greenlight is a simple front-end interface for your BigBlueButton server. At it's heart, Greenlight provides a minimalistic web-based application that allows users to: * Signup/Login with Twitter, Google, or through the application itself. @@ -10,7 +12,7 @@ Greenlight is a simple front-end interface for your BigBlueButton server. At it' Interested? Try Greenlight out on our [demo server](https://demo.bigbluebutton.org/gl)! -Greenlight is also completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and its features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight.html). +Greenlight is also completely configurable. This means you can turn on/off features to make Greenlight fit your specific use case. For more information on Greenlight and its features, see our [documentation](http://docs.bigbluebutton.org/install/greenlight-v2.html). For a overview of how Greenlight works, checkout our Introduction to Greenlight Video: diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d7f31433..2f720083 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,13 @@ require 'bigbluebutton_api' class ApplicationController < ActionController::Base include SessionsHelper + before_action :migration_error? + + # Show an information page when migration fails and there is a version error. + def migration_error? + render :migration_error unless ENV["DB_MIGRATE_FAILED"].blank? + end + protect_from_forgery with: :exception MEETING_NAME_LIMIT = 90 diff --git a/app/views/application/migration_error.html.erb b/app/views/application/migration_error.html.erb new file mode 100644 index 00000000..8abf01b2 --- /dev/null +++ b/app/views/application/migration_error.html.erb @@ -0,0 +1,16 @@ +
+
+
+ +

Greenlight encountered a database migration error.
This may be because you haven't updated to Greenlight 2.0.

+

If you are not an administrator, please contact one.

+

We've released a new version of Greenlight, but your database isn't compatible.

+ + Show me how to upgrade to 2.0! + + + I'd like to stay using 1.0. + +
+
+
diff --git a/bin/start b/bin/start index 93c2bb22..a0d04505 100755 --- a/bin/start +++ b/bin/start @@ -1,6 +1,8 @@ #!/bin/bash bundle exec rake db:create -bundle exec rake db:migrate +if ! bundle exec rake db:migrate ; then + export DB_MIGRATE_FAILED=1 +fi exec bundle exec puma -C config/puma.rb diff --git a/config/environments/production.rb b/config/environments/production.rb index 42d2e076..42654597 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -87,6 +87,7 @@ Rails.application.configure do config.active_record.dump_schema_after_migration = false # Set the relative url root for deployment to a subdirectory. - config.relative_url_root = "/" - config.relative_url_root = ENV['RELATIVE_URL_ROOT'] if ENV['RELATIVE_URL_ROOT'].present? + if ENV['RELATIVE_URL_ROOT'] != "/" + config.relative_url_root = ENV['RELATIVE_URL_ROOT'] || "/b" + end end diff --git a/config/puma.rb b/config/puma.rb index 991c3a6f..2ef031d5 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -11,7 +11,7 @@ threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # -port ENV.fetch("PORT") { 3000 } +port ENV.fetch("PORT") { 80 } # Specifies the `environment` that Puma will run in. # diff --git a/docker-compose.yml b/docker-compose.yml index ef11cc2f..29b8f40e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: '3' -services: +services: app: entrypoint: [bin/start] - image: joshblind/greenlight:latest - container_name: greenlight-web + image: joshblind/greenlight:v2 + container_name: greenlight-v2 env_file: env restart: unless-stopped ports: - - 6000:3000 - volumes: + - 5000:80 + volumes: - ./db/production:/usr/src/app/db/production - ./log:/usr/src/app/log diff --git a/greenlight.nginx b/greenlight.nginx index a40d30ba..b3d5f904 100644 --- a/greenlight.nginx +++ b/greenlight.nginx @@ -1,18 +1,18 @@ -# Routes requests to Greenlight based on the '/gl' prefix. -# Use this file to route '/gl' paths on your BigBlueButton server +# Routes requests to Greenlight based on the '/b' prefix. +# Use this file to route '/b' paths on your BigBlueButton server # to the Greenlight application. If you are using a different # subpath, you should change it here. -location /gl { - proxy_pass http://127.0.0.1:6000; +location /b { + proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; } -location /gl/cable { - proxy_pass http://127.0.0.1:6000; +location /b/cable { + proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; diff --git a/sample.env b/sample.env index 26973ac0..dd635fe4 100644 --- a/sample.env +++ b/sample.env @@ -50,6 +50,6 @@ ALLOW_GREENLIGHT_ACCOUNTS=true # if deploying on a BigBlueButton server. Keep in mind that if you change this, you'll # have to update your authentication callback URL's to reflect this change. # -# The recommended prefix is "/gl". +# The recommended prefix is "/b". # -RELATIVE_URL_ROOT=/gl +RELATIVE_URL_ROOT=/b From 8647993443b2bd8d1324a813061101de5e572005 Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Fri, 6 Jul 2018 11:42:50 -0400 Subject: [PATCH 2/3] fix docker-compose org --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 29b8f40e..7b50ff0c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: app: entrypoint: [bin/start] - image: joshblind/greenlight:v2 + image: bigbluebutton/greenlight:v2 container_name: greenlight-v2 env_file: env restart: unless-stopped From 60a5b57121556f8003f8b6b5cd97f4bd9b80e6fe Mon Sep 17 00:00:00 2001 From: Joshua Arts Date: Fri, 6 Jul 2018 12:12:27 -0400 Subject: [PATCH 3/3] add stay on 1.0 link --- app/views/application/migration_error.html.erb | 2 +- sample.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/application/migration_error.html.erb b/app/views/application/migration_error.html.erb index 8abf01b2..8d90ff3d 100644 --- a/app/views/application/migration_error.html.erb +++ b/app/views/application/migration_error.html.erb @@ -8,7 +8,7 @@ Show me how to upgrade to 2.0! - + I'd like to stay using 1.0. diff --git a/sample.env b/sample.env index dd635fe4..864b5d0c 100644 --- a/sample.env +++ b/sample.env @@ -3,7 +3,7 @@ # You can generate a secure one through the Greenlight docker image # with with the command. # -# docker run --rm bigbluebutton/greenlight bundle exec rake secret +# docker run --rm bigbluebutton/greenlight:v2 bundle exec rake secret # SECRET_KEY_BASE=