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 d4eff4a2..385c1850 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 ec1e7bc1..1089cc6c 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 @@ -26,8 +26,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..8d90ff3d --- /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 718486e6..d7732ed8 100755 --- a/bin/start +++ b/bin/start @@ -8,6 +8,8 @@ if [ "$RAILS_ENV" = "production" ]; then fi 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 7a1874fd..531d784e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -90,6 +90,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..7b50ff0c 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: bigbluebutton/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..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= @@ -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