Skip to content

Commit

Permalink
make upgrading from 1.0 easier
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-arts committed Jul 5, 2018
1 parent fd1b550 commit e2ad6e7
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tmp
/db/**/*.sqlite3-journal
/db/production
public/assets
public/gl
public/b
coverage/
spec/tmp
.rvmrc
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Ignore static assets.
/public/system/**
/public/assets/**
/public/gl/**
/public/b/**

# Ignore production paths.
/db/production
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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:

Expand Down
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
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
Expand Down
16 changes: 16 additions & 0 deletions app/views/application/migration_error.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="page mt-0">
<div class="page-content mt-0">
<div class="container text-center">
<i class="fas fa-database fa-6x mb-4"></i>
<h1 class="h3 mb-2">Greenlight encountered a database migration error.<br>This may be because you haven't updated to Greenlight 2.0.</h1>
<p class="h4 text-muted font-weight-normal mb-7">If you are not an administrator, please contact one.</p>
<h1 class="h3 mb-3">We've released a new version of Greenlight, but your database isn't compatible.</h1>
<a class="btn btn-success mt-3 mx-3" href="http://docs.bigbluebutton.org/install/greenlight-v2.html#upgrading-from-greenlight-10" target="_blank">
<i class="far fa-star mr-2"></i>Show me how to upgrade to 2.0!
</a>
<a class="btn btn-info mt-3 mx-3 w-20" href="" target="_blank">
<i class="far fa-hand-paper mr-2"></i>I'd like to stay using 1.0.
</a>
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion bin/start
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
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
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# 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.
#
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions greenlight.nginx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e2ad6e7

Please sign in to comment.