Commit 51feadb2 by tady (Masato TADA)

Merge pull request #137 from tadyjp/heroku

Move to Heroku
parents 24988b65 baac0c67
RV_RENDEZVOUS_APP_HOST=http://localhost:3000
RV_GOOGLE_API_CLIENT_ID=xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
RV_GOOGLE_API_SECRET=xxxxxxxxxxxxxxxxxxxxxxxx
RV_S3_ASSESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxxx
RV_S3_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
RV_S3_BACKET_NAME=xxxxxxxxxxxxxxxxxxxxx
RV_PDF_UPLOADING=1
DATABASE_URL=mysql2://user:passwd@localhost/rendezvous_development
RV_ALLOW_IPS=1.1.1.1,2.2.2.2
...@@ -17,19 +17,17 @@ ...@@ -17,19 +17,17 @@
/log/*.log /log/*.log
/tmp /tmp
/coverage/.* /coverage/.*
*.bk *.bk
/db/*.sql /db/*.sql
# secret files
/config/database.yml
/config/settings.yml
/backup /backup
/script/backup.sh /script/backup.sh
.rbenv-gemsets .rbenv-gemsets
.ruby-version .ruby-version
.env
!.env.sample
bundler_args: "--without development --path=~/.bundle" bundler_args: "--without development --path=~/.bundle"
language: ruby language: ruby
rvm: rvm:
- 2.1.2 - 2.1.4
env: env:
matrix: matrix:
- DB_TEST_DATABASE=rendezvous_test DB_TEST_USER=travis - DB_TEST_DATABASE=rendezvous_test DB_TEST_USER=travis
...@@ -20,8 +20,6 @@ before_install: ...@@ -20,8 +20,6 @@ before_install:
- sh ./script/travis/bundle_install.sh - sh ./script/travis/bundle_install.sh
before_script: before_script:
- mysql -e 'CREATE DATABASE rendezvous_test;' - mysql -e 'CREATE DATABASE rendezvous_test;'
- cp config/database.yml.example config/database.yml
- cp config/settings.yml.example config/settings.yml
after_script: after_script:
- ruby script/travis/bundle_cache.rb - ruby script/travis/bundle_cache.rb
script: bundle exec rake db:create db:test:load spec teaspoon script: bundle exec rake db:create db:test:load spec teaspoon
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '2.1.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.1' gem 'rails', '~> 4.1'
...@@ -91,6 +93,8 @@ group :development, :test do ...@@ -91,6 +93,8 @@ group :development, :test do
gem 'teaspoon' gem 'teaspoon'
gem 'guard-teaspoon' gem 'guard-teaspoon'
gem 'byebug' gem 'byebug'
gem 'dotenv-rails'
end end
group :test do group :test do
...@@ -149,3 +153,11 @@ gem 'hipchat' ...@@ -149,3 +153,11 @@ gem 'hipchat'
# For PDF upload # For PDF upload
gem 'rmagick', :require => 'RMagick' gem 'rmagick', :require => 'RMagick'
# for heroku
gem 'rails_12factor', group: :production
gem 'mysql'
# for IP restriction
gem 'rack-contrib', require: 'rack/contrib'
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
...@@ -11,8 +11,7 @@ A simple markdown-based blog & wiki system for team. ...@@ -11,8 +11,7 @@ A simple markdown-based blog & wiki system for team.
# Supported versions # Supported versions
- Ruby 2.0.0 - Ruby 2.1.4
- Rails 4.1.0
# How to install and use. # How to install and use.
...@@ -41,15 +40,7 @@ and get ...@@ -41,15 +40,7 @@ and get
-`rendevous` in [Project name] in Consent screen -`rendevous` in [Project name] in Consent screen
## Create and edit config files. ## Dotenv
```
$ cp config/database.yml.example config/database.yml
$ vim config/database.yml
$ cp config/settings.yml.example config/settings.yml
$ vim config/settings.yml
```
## Setup DB ## Setup DB
......
...@@ -32,6 +32,11 @@ module Rendezvous ...@@ -32,6 +32,11 @@ module Rendezvous
# oauth2_token: 'FIXME', # oauth2_token: 'FIXME',
# account: 'FIXME' # account: 'FIXME'
} }
# IP restriction.
if Rails.env.production? && ENV['RV_ALLOW_IPS']
config.middleware.use Rack::Access, { "/" => ENV['RV_ALLOW_IPS'].split(/,/) }
end
end end
end end
# Read Me
# Copy this file to `database.yml` when you run first development.
# $ cp config/detabase.yml.example config/database.yml
development: development:
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8
reconnect: false reconnect: false
pool: 5 pool: 5
host: localhost url: <%= ENV['DATABASE_URL'] %>
database: rendezvous_development
username: rendezvous
password: rendezvous
test: test:
adapter: mysql2 adapter: mysql2
......
# Read Me
# Copy this file to `settings.yml` when you run first development.
# $ cp config/settings.yml.example config/settings.yml
defaults: &defaults defaults: &defaults
rendezvous: rendezvous:
# For amil body # For amil body
app_host: "http://rendezvous.dev" app_host: <%= ENV['RV_RENDEZVOUS_APP_HOST'] %>
# For login # For login
google_api: google_api:
client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com" client_id: <%= ENV['RV_GOOGLE_API_CLIENT_ID'] %>
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret: <%= ENV['RV_GOOGLE_API_SECRET'] %>
# For file upload # For file upload
s3: s3:
access_key_id: "xxxxxxxxxxxxxxxxxxxxx" access_key_id: <%= ENV['RV_S3_ASSESS_KEY_ID'] %>
secret_access_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret_access_key: <%= ENV['RV_S3_SECRET_ACCESS_KEY'] %>
bucket_name: "xxxxxxxxxxxxxxxxxx" bucket_name: <%= ENV['RV_S3_BACKET_NAME'] %>
# optional # optional
# hipchat: # hipchat:
...@@ -28,7 +24,7 @@ defaults: &defaults ...@@ -28,7 +24,7 @@ defaults: &defaults
# google_analytics: # google_analytics:
# optional # optional
# pdf_uploading: false pdf_uploading: <%= ENV['RV_PDF_UPLOADING'].present? %>
development: development:
<<: *defaults <<: *defaults
......
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment