This successfully builds a working bikebike rails app with Docker!
This commit is contained in:
parent
df5cce9efa
commit
0a55db70c4
4
.gitignore
vendored
4
.gitignore
vendored
@ -8,7 +8,9 @@
|
|||||||
!.openshift
|
!.openshift
|
||||||
*~
|
*~
|
||||||
|
|
||||||
|
# Docker.gitignore
|
||||||
|
.env
|
||||||
|
bike_bike_advanced_environment
|
||||||
|
|
||||||
# OSX.gitignore
|
# OSX.gitignore
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
43
Dockerfile
Normal file
43
Dockerfile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
############
|
||||||
|
# BikeBike #
|
||||||
|
############
|
||||||
|
|
||||||
|
|
||||||
|
FROM ruby:2.5
|
||||||
|
MAINTAINER Jonathan Rosenbaum <bike@bikelover.org>
|
||||||
|
|
||||||
|
##RUN git clone https://github.com/fspc/BikeBikeBike.git /app/BikeBike
|
||||||
|
COPY . /app/BikeBike
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y nodejs postgresql-client
|
||||||
|
|
||||||
|
# Note: phantomjs has been deprecated in favor of headless chrome
|
||||||
|
WORKDIR /app/BikeBike
|
||||||
|
|
||||||
|
# COPY changes/Gemfile .
|
||||||
|
# Use DATABASE_URL env variable instead, although it takes precedence, regardless
|
||||||
|
# COPY database.yml ./config/database.yml
|
||||||
|
RUN bundle install
|
||||||
|
|
||||||
|
RUN mkdir -p public/stylesheets/application -p public/stylesheets/web-fonts && tar xvfz bumbleberry-css.tar.gz -C public/stylesheets/application && tar xvfz bumbleberry-css.tar.gz -C public/stylesheets/web-fonts
|
||||||
|
|
||||||
|
#RUN gem install json -v '1.8.6'
|
||||||
|
#RUN gem install activesupport -v '4.2.0'
|
||||||
|
#RUN gem install mini_portile2 -v '2.6.1'
|
||||||
|
#RUN gem install racc -v '1.6.0'
|
||||||
|
#RUN gem install actionview -v '4.2.0'
|
||||||
|
|
||||||
|
# Gem::LoadError: You have already activated rake 12.3.3, but your Gemfile requires rake 11.1.2. Prepending `bundle exec` to your command may solve this.
|
||||||
|
# Do this with docker-compose
|
||||||
|
# RUN rake db:create
|
||||||
|
# RUN rake db:migrate
|
||||||
|
|
||||||
|
|
||||||
|
# Add a script to be executed every time the container starts.
|
||||||
|
COPY entrypoint.sh /usr/bin/
|
||||||
|
RUN chmod +x /usr/bin/entrypoint.sh
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Configure the main process to run when running the image
|
||||||
|
CMD ["rails", "server", "-b", "0.0.0.0"]
|
16
Gemfile
16
Gemfile
@ -1,9 +1,9 @@
|
|||||||
source 'http://rubygems.org'
|
source 'http://rubygems.org'
|
||||||
|
|
||||||
gem 'rails', '4.2.0'
|
gem 'rails', '4.2.8'
|
||||||
gem 'pg'
|
gem 'pg', '0.21.0'
|
||||||
gem 'rake', '11.1.2'
|
gem 'rake', '12.3.3'
|
||||||
gem 'ruby_dep', '1.3.1' # Lock at 1.3.1 since 1.4 requires ruby 2.5. We should unlock once we upgrade the ruby version on our server
|
gem 'ruby_dep', '1.4' # Lock at 1.3.1 since 1.4 requires ruby 2.5. We should unlock once we upgrade the ruby version on our server
|
||||||
|
|
||||||
gem 'rack-mini-profiler'
|
gem 'rack-mini-profiler'
|
||||||
|
|
||||||
@ -41,17 +41,18 @@ gem 'sitemap_generator'
|
|||||||
gem 'sass-json-vars'
|
gem 'sass-json-vars'
|
||||||
gem 'redcarpet'
|
gem 'redcarpet'
|
||||||
gem 'to_spreadsheet', git: 'https://github.com/glebm/to_spreadsheet.git'
|
gem 'to_spreadsheet', git: 'https://github.com/glebm/to_spreadsheet.git'
|
||||||
|
gem 'net-ssh', '4.1.0'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'better_errors', '2.2.0'
|
gem 'better_errors', '2.2.0'
|
||||||
gem 'binding_of_caller'
|
gem 'binding_of_caller'
|
||||||
gem 'meta_request'
|
gem 'meta_request'
|
||||||
|
|
||||||
gem 'capistrano', '~> 3.1'
|
gem 'capistrano', '~> 3.1'
|
||||||
gem 'capistrano-rails', '~> 1.1'
|
gem 'capistrano-rails', '~> 1.1'
|
||||||
gem 'capistrano-faster-assets', '~> 1.0'
|
gem 'capistrano-faster-assets', '~> 1.0'
|
||||||
|
|
||||||
gem 'eventmachine', git: 'https://github.com/krzcho/eventmachine', :branch => 'master'
|
gem 'eventmachine', git: 'https://github.com/eventmachine/eventmachine', :branch => 'master'
|
||||||
gem 'thin'
|
gem 'thin'
|
||||||
gem 'rubocop', require: false
|
gem 'rubocop', require: false
|
||||||
gem 'haml-lint', require: false
|
gem 'haml-lint', require: false
|
||||||
@ -67,6 +68,7 @@ group :test do
|
|||||||
gem 'guard-cucumber'
|
gem 'guard-cucumber'
|
||||||
|
|
||||||
gem 'poltergeist'
|
gem 'poltergeist'
|
||||||
|
gem 'capybara', '2.15.1'
|
||||||
gem 'capybara-email'
|
gem 'capybara-email'
|
||||||
gem 'guard-rspec'
|
gem 'guard-rspec'
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
@ -93,7 +95,7 @@ end
|
|||||||
|
|
||||||
platforms 'mswin', 'mingw' do
|
platforms 'mswin', 'mingw' do
|
||||||
gem 'tzinfo-data'
|
gem 'tzinfo-data'
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'wdm', '>= 0.1.0'
|
gem 'wdm', '>= 0.1.0'
|
||||||
gem 'win32console', require: false
|
gem 'win32console', require: false
|
||||||
|
11
README.md
11
README.md
@ -5,6 +5,17 @@
|
|||||||
| Development | [](https://travis-ci.org/bikebike/BikeBike) |
|
| Development | [](https://travis-ci.org/bikebike/BikeBike) |
|
||||||
| Production | [](https://travis-ci.org/bikebike/BikeBike) |
|
| Production | [](https://travis-ci.org/bikebike/BikeBike) |
|
||||||
|
|
||||||
|
## About this Fork
|
||||||
|
|
||||||
|
The Tech group for BikeBike!Everywhere! decided to utilize this conferencing/scheduling software for the next BikeBike.
|
||||||
|
|
||||||
|
This repository creates a test environment so that we can test/fix issues before manually committing them to the live site.
|
||||||
|
|
||||||
|
Instructions can be found in docker-compose.yml, and docker-compose.build.
|
||||||
|
|
||||||
|
|
||||||
|
## From bikebike/bikebike
|
||||||
|
|
||||||
This is the repository for the Bike!Bike! website. It can be found in development at [preview.bikebike.org](https://preview-en.bikebike.org/) and in production at [bikebike.org](https://bikebike.org/)
|
This is the repository for the Bike!Bike! website. It can be found in development at [preview.bikebike.org](https://preview-en.bikebike.org/) and in production at [bikebike.org](https://bikebike.org/)
|
||||||
|
|
||||||
Feel free to clone or fork the repository any time to start working on new features or fixes. To get help create an issue or contact Godwin: `goodgodwin` `@` `hotmail.com` any time.
|
Feel free to clone or fork the repository any time to start working on new features or fixes. To get help create an issue or contact Godwin: `goodgodwin` `@` `hotmail.com` any time.
|
||||||
|
4
app/assets/config/manifest.js
Normal file
4
app/assets/config/manifest.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
//= link_tree ../images
|
||||||
|
//= link_directory ../javascripts .js
|
||||||
|
//= link_directory ../stylesheets .scss
|
||||||
|
//= link_directory ../fonts
|
@ -5,8 +5,8 @@ module I18nHelper
|
|||||||
url ||= current_path(true)
|
url ||= current_path(true)
|
||||||
|
|
||||||
return url if Rails.env.development? || Rails.env.test?
|
return url if Rails.env.development? || Rails.env.test?
|
||||||
return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview?
|
return "https://preview-#{locale.to_s}." + ENV['DEFAULT_URL'] + "#{url}" if Rails.env.preview?
|
||||||
"https://#{locale.to_s}.bikebike.org#{url}"
|
"https://#{locale.to_s}." + ENV['DEFAULT_URL'] + "#{url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_path(relative = false)
|
def current_path(relative = false)
|
||||||
@ -21,13 +21,13 @@ module I18nHelper
|
|||||||
return url_for(new_params) if relative
|
return url_for(new_params) if relative
|
||||||
|
|
||||||
subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s
|
subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s
|
||||||
url_for(new_params.merge(host: "#{subdomain}.bikebike.org"))
|
url_for(new_params.merge(host: "#{subdomain}." + ENV['DEFAULT_URL']))
|
||||||
end
|
end
|
||||||
|
|
||||||
def canonical_url
|
def canonical_url
|
||||||
url = current_path
|
url = current_path
|
||||||
return url if Rails.env.development? || Rails.env.test?
|
return url if Rails.env.development? || Rails.env.test?
|
||||||
return "https://preview.bikebike.org#{url}" if Rails.env.preview?
|
return ENV['DEFAULT_URL'] + "#{url}" if Rails.env.preview?
|
||||||
"https://bikebike.org#{url}"
|
"https://bikebike.org#{url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ class UserMailer < ActionMailer::Base
|
|||||||
|
|
||||||
before_filter :set_host
|
before_filter :set_host
|
||||||
|
|
||||||
default from: "Bike!Bike! <info@bikebike.org>"
|
default from: "Bike!Bike! <" + ENV['SMTP_USER_NAME'] + ">"
|
||||||
|
|
||||||
def email_confirmation(confirmation)
|
def email_confirmation(confirmation)
|
||||||
@confirmation = EmailConfirmation.find_by_id(confirmation) if confirmation.present?
|
@confirmation = EmailConfirmation.find_by_id(confirmation) if confirmation.present?
|
||||||
@ -172,9 +172,9 @@ class UserMailer < ActionMailer::Base
|
|||||||
private
|
private
|
||||||
def set_host(*args)
|
def set_host(*args)
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
@host = "https://#{I18n.locale.to_s}.bikebike.org"
|
@host = "https://#{I18n.locale.to_s}." + ENV['DEFAULT_URL']
|
||||||
elsif Rails.env.preview?
|
elsif Rails.env.preview?
|
||||||
@host = "https://preview-#{I18n.locale.to_s}.bikebike.org"
|
@host = "https://preview-#{I18n.locale.to_s}." + ENV['DEFAULT_URL']
|
||||||
else
|
else
|
||||||
@host = UserMailer.default_url_options[:host]
|
@host = UserMailer.default_url_options[:host]
|
||||||
end
|
end
|
||||||
|
BIN
bumbleberry-css.tar.gz
Normal file
BIN
bumbleberry-css.tar.gz
Normal file
Binary file not shown.
@ -28,7 +28,7 @@ BikeBike::Application.configure do
|
|||||||
# config.assets.css_compressor = :sass
|
# config.assets.css_compressor = :sass
|
||||||
|
|
||||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
#config.assets.compile = true
|
config.assets.compile = true
|
||||||
|
|
||||||
# Generate digests for assets URLs.
|
# Generate digests for assets URLs.
|
||||||
config.assets.digest = true
|
config.assets.digest = true
|
||||||
@ -46,8 +46,6 @@ BikeBike::Application.configure do
|
|||||||
# Set to :debug to see everything in the log.
|
# Set to :debug to see everything in the log.
|
||||||
config.log_level = :info
|
config.log_level = :info
|
||||||
|
|
||||||
config.assets.compile = false
|
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
config.log_tags = [ :subdomain, :uuid ]
|
config.log_tags = [ :subdomain, :uuid ]
|
||||||
|
|
||||||
@ -61,7 +59,8 @@ BikeBike::Application.configure do
|
|||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.json *.ttf *.otf *.woff *.woff2 *.svg *.json)
|
#config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.json *.ttf *.otf *.woff *.woff2 *.svg *.json)
|
||||||
|
config.assets.precompile = ["manifest.js"]
|
||||||
|
|
||||||
# Ignore bad email addresses and do not raise email delivery errors.
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
@ -82,18 +81,18 @@ BikeBike::Application.configure do
|
|||||||
|
|
||||||
config.action_mailer.delivery_method = :smtp
|
config.action_mailer.delivery_method = :smtp
|
||||||
config.action_mailer.smtp_settings = {
|
config.action_mailer.smtp_settings = {
|
||||||
address: 'smtp.gmail.com',
|
address: config.app_config['smtp_address'],
|
||||||
domain: 'bikebike.org',
|
domain: config.app_config['smtp_domain'],
|
||||||
port: 587,
|
port: config.app_config['smtp_port'],
|
||||||
authentication: :plain,
|
authentication: :plain,
|
||||||
enable_starttls_auto: true,
|
enable_starttls_auto: true,
|
||||||
openssl_verify_mode: 'none',
|
openssl_verify_mode: 'none',
|
||||||
user_name: 'info@bikebike.org',
|
user_name: config.app_config['smtp_user_name'],
|
||||||
password: config.app_config['email_password']
|
password: config.app_config['smtp_password']
|
||||||
}
|
}
|
||||||
config.action_mailer.raise_delivery_errors = true
|
config.action_mailer.raise_delivery_errors = true
|
||||||
config.action_mailer.perform_deliveries = true
|
config.action_mailer.perform_deliveries = true
|
||||||
I18n.config.language_detection_method = I18n::Config::DETECT_LANGUAGE_FROM_SUBDOMAIN
|
I18n.config.language_detection_method = I18n::Config::DETECT_LANGUAGE_FROM_SUBDOMAIN
|
||||||
config.action_controller.default_url_options = { host: 'https://bikebike.org', trailing_slash: true }
|
config.action_controller.default_url_options = { host: config.app_config['default_url'], trailing_slash: true }
|
||||||
Sidekiq::Extensions.enable_delay!
|
Sidekiq::Extensions.enable_delay!
|
||||||
end
|
end
|
||||||
|
12
docker-compose.build
Executable file
12
docker-compose.build
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This assume docker-compose build, which takes a long time and builds the image, has already happened,
|
||||||
|
# it should on up -d.
|
||||||
|
# Also, you may need to remove and create the external volumes again for the steps
|
||||||
|
# below to work correctly.
|
||||||
|
docker-compose up -d
|
||||||
|
docker-compose run bikebike rake db:setup
|
||||||
|
docker-compose run bikebike rake db:migrate
|
||||||
|
docker-compose run bikebike rake assets:precompile
|
||||||
|
docker-compose down
|
||||||
|
docker-compose up -d
|
89
docker-compose.yml
Normal file
89
docker-compose.yml
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# BikeBike
|
||||||
|
#
|
||||||
|
# ENV DATABASE_URL string = https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
|
||||||
|
#
|
||||||
|
# docker-compose up -d
|
||||||
|
# docker-compose run bikebike rake db:setup
|
||||||
|
# docker-compose run bikebike rake db:migrate
|
||||||
|
# docker-compose run bikebike rake assets:precompile
|
||||||
|
# docker-compose down
|
||||||
|
# docker-compose up
|
||||||
|
#
|
||||||
|
# don't do this because new sprockets and manifest.js isn't precompiling to *css, and breaks the container
|
||||||
|
# -- docker-compose run bikebike rake bumbleberry:update --
|
||||||
|
|
||||||
|
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
db:
|
||||||
|
container_name: bikebikebike-db
|
||||||
|
image: postgres:9.5
|
||||||
|
ports:
|
||||||
|
- "5432"
|
||||||
|
restart: always
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
volumes:
|
||||||
|
- bikebikebike_db:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- POSTGRES_PASSWORD=password
|
||||||
|
- POSTGRES_USER=bike_bike
|
||||||
|
- POSTGRES_DB=bike_bike
|
||||||
|
|
||||||
|
bikebike:
|
||||||
|
build: .
|
||||||
|
image: bikebikebike
|
||||||
|
container_name: bikebikebike
|
||||||
|
networks:
|
||||||
|
letsencrypt:
|
||||||
|
default:
|
||||||
|
command: /bin/sh -c "rm -f /app/BikeBike/tmp/pids/server.pid && rails server -e production -b '0.0.0.0'"
|
||||||
|
# Add environment values that are not in .env (environment:) below in the bike_bike_advanced_environment file
|
||||||
|
# Empty file ok, too, or just comment out this section
|
||||||
|
env_file:
|
||||||
|
- bike_bike_advanced_environment
|
||||||
|
# Add your own environment values in .env, or use the default ones
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
- DATABASE_URL=${DATABASE_URL:-postgresql://bike_bike:password@db/bike_bike?encoding=unicode&pool=5}
|
||||||
|
- RAILS_ENV=${RAILS_ENV:-production rails assets:precompile.log}
|
||||||
|
- SMTP_ADDRESS=${SMTP_ADDRESS:-fake-smtp.bikebike.org}
|
||||||
|
- SMTP_DOMAIN=${SMTP_DOMAIN:-bikebike.org}
|
||||||
|
- SMTP_PORT=${SMTP_PORT:-587}
|
||||||
|
- SMTP_USER_NAME=${SMTP_USER_NAME:-info@bikebike.org}
|
||||||
|
- SMTP_PASSWORD=${SMTP_PASSWORD:-fake}
|
||||||
|
- DEFAULT_URL=${DEFAULT_URL:-bikebike.org}
|
||||||
|
volumes:
|
||||||
|
- bikebikebike:/app/BikeBike
|
||||||
|
- bikebikebike_bundle:/usr/local/bundle
|
||||||
|
build: .
|
||||||
|
expose:
|
||||||
|
- "3000"
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
restart: always
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
|
||||||
|
# Create this volumes, docker volume create me
|
||||||
|
# or comment our external
|
||||||
|
volumes:
|
||||||
|
bikebikebike_db:
|
||||||
|
external: true
|
||||||
|
bikebikebike:
|
||||||
|
external: true
|
||||||
|
bikebikebike_bundle:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
# Remove this network if you don't use it
|
||||||
|
networks:
|
||||||
|
letsencrypt:
|
||||||
|
external: true
|
8
entrypoint.sh
Normal file
8
entrypoint.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Remove a potentially pre-existing server.pid for Rails.
|
||||||
|
rm -f /app/BikeBike/tmp/pids/server.pid
|
||||||
|
|
||||||
|
# Then exec the container's main process (what's set as CMD in the Dockerfile).
|
||||||
|
exec "$@"
|
Loading…
x
Reference in New Issue
Block a user