Merge pull request #208 from tsujigiri/dockerize

Dockerize
This commit is contained in:
Philipp Bayer
2015-11-01 15:52:43 +08:00
29 changed files with 219 additions and 198 deletions

20
.env.example Normal file
View File

@@ -0,0 +1,20 @@
# This file serves as a template for configuration through environment
# variables. It should always be sufficient for use in development and
# testing. It should also be always complete in a sense that all
# variables that can be set are included. It is used to extract a list
# of permitted variables for production during deployment, commented out
# or not.
export SECRET_KEY_BASE=foo
export SECRET_TOKEN=bar
export RAILS_ENV=development
export POSTGRES_URL="postgres://localhost/snpr_$RAILS_ENV"
export REDIS_URL=redis://localhost
export FITBIT_CONSUMER_KEY=foo
export FITBIT_CONSUMER_SECRET=bar
export PLOS_API_KEY=foo
export RECAPTCHA_PRIVATE_KEY=foo
export RECAPTCHA_PUBLIC_KEY=bar
export SIDEKIQ_PASSWORD=foo
export MENDELEY_CONSUMER_KEY=foo
export ERRBIT_API_KEY=foo
export ERRBIT_HOST=localhost

1
.gitignore vendored
View File

@@ -31,3 +31,4 @@ tmp/pids/server.pid
vendor/bundle
vendor/cache
logfile
.env

View File

@@ -1,11 +1,11 @@
language: ruby # Defaults to ruby, but travis-ci recommends making this explicit.
language: ruby
sudo: false
cache: bundler
addons:
apt:
packages:
- libhiredis-dev
postgresql: "9.2"
postgresql: '9.3'
services:
- redis-server
rvm:
@@ -14,11 +14,11 @@ env: DB=postgres CI=1
bundler_args: --without development debug
before_script:
- cp config/database.yml.ci config/database.yml
- cp config/app_config.yml.example config/app_config.yml
- echo "foo" > mail_username.txt
- echo "bar" > mail_password.txt
- echo "secret-token" > secret_token
- echo "secret-key-base" > secret_key_base
- psql -c 'create database snpr_test;' -U postgres
- cp .env.example .env
- bundle exec rake db:setup
script: "bundle exec rake test"
script: bundle exec rake
deploy:
provider: script
script: bin/deploy
on:
branch: master

19
Gemfile
View File

@@ -1,13 +1,15 @@
source 'http://rubygems.org'
gem 'dotenv-rails'
gem 'rails', '~> 4.2.0'
gem 'authlogic' # lots of user-related magic
gem 'i18n', '>= 0.6.6'
gem 'rails3-generators'
gem "jquery-rails"
gem 'bcrypt-ruby', :require => "bcrypt"
gem 'jquery-rails'
gem 'bcrypt-ruby', require: 'bcrypt'
gem 'sanitize'
gem "recaptcha", :require => "recaptcha/rails"
gem 'recaptcha', require: 'recaptcha/rails'
gem 'dynamic_form'
gem 'lograge'
gem 'slop'
@@ -32,13 +34,13 @@ gem 'pg_search'
# so we can create zip-files for genotypes
gem 'rubyzip'
gem "will_paginate"
gem 'will_paginate'
gem 'nested_form', github: 'ryanb/nested_form'
gem 'json'
gem 'mediawiki-gateway'
gem 'paperclip', '~> 4.0 '
gem 'friendly_id'
gem 'recommendify', github: 'paulasmuth/recommendify', :ref => "34308c4"
gem 'recommendify', github: 'paulasmuth/recommendify', ref: '34308c4'
# background jobs
gem 'sidekiq'
@@ -53,10 +55,9 @@ gem 'whenever', require: false
gem 'therubyracer'
gem 'execjs'
gem 'uglifier'
gem 'yui-compressor'
gem "twitter-bootstrap-rails"
gem "jquery-ui-rails"
gem "sass"
gem 'twitter-bootstrap-rails'
gem 'jquery-ui-rails'
gem 'sass-rails'
#group :production do
# gem 'rpm_contrib'

View File

@@ -24,88 +24,107 @@ GIT
GEM
remote: http://rubygems.org/
specs:
actionmailer (4.2.2)
actionpack (= 4.2.2)
actionview (= 4.2.2)
activejob (= 4.2.2)
actionmailer (4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.2)
actionview (= 4.2.2)
activesupport (= 4.2.2)
actionpack (4.2.4)
actionview (= 4.2.4)
activesupport (= 4.2.4)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.2)
activesupport (= 4.2.2)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.4)
activesupport (= 4.2.4)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.2)
activesupport (= 4.2.2)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.4)
activesupport (= 4.2.4)
globalid (>= 0.3.0)
activemodel (4.2.2)
activesupport (= 4.2.2)
activemodel (4.2.4)
activesupport (= 4.2.4)
builder (~> 3.1)
activerecord (4.2.2)
activemodel (= 4.2.2)
activesupport (= 4.2.2)
activerecord (4.2.4)
activemodel (= 4.2.4)
activesupport (= 4.2.4)
arel (~> 6.0)
activerecord-import (0.7.0)
activerecord-import (0.10.0)
activerecord (>= 3.0)
activesupport (4.2.2)
activesupport (4.2.4)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
airbrake (4.1.0)
airbrake (4.3.3)
builder
multi_json
arel (6.0.0)
authlogic (3.4.5)
arel (6.0.3)
authlogic (3.4.6)
activerecord (>= 3.2)
activesupport (>= 3.2)
request_store (~> 1.0)
scrypt (~> 1.2)
scrypt (>= 1.2, < 3.0)
bcrypt (3.1.10)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
builder (3.2.2)
capistrano (2.15.5)
capistrano (2.15.6)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capybara (2.4.4)
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid (0.17.2)
celluloid-essentials
celluloid-extras
celluloid-fsm
celluloid-pool
celluloid-supervision
timers (>= 4.1.1)
celluloid-essentials (0.20.5)
timers (>= 4.1.1)
celluloid-extras (0.20.5)
timers (>= 4.1.1)
celluloid-fsm (0.20.5)
timers (>= 4.1.1)
celluloid-pool (0.20.5)
timers (>= 4.1.1)
celluloid-supervision (0.20.5)
timers (>= 4.1.1)
chronic (0.10.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.7)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
composite_primary_keys (8.1.0)
composite_primary_keys (8.1.1)
activerecord (~> 4.2.0)
connection_pool (2.2.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
crass (1.0.2)
database_cleaner (1.4.1)
database_cleaner (1.5.1)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.24)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.0.2)
dotenv-rails (2.0.2)
dotenv (= 2.0.2)
railties (~> 4.0)
dynamic_form (1.1.4)
erubis (2.7.0)
execjs (2.6.0)
@@ -114,20 +133,20 @@ GEM
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
ffi (1.9.8)
ffi (1.9.10)
ffi-compiler (0.1.3)
ffi (>= 1.0.0)
rake
fitgem (0.10.0)
fitgem (0.12.1)
oauth
formatador (0.2.5)
friendly_id (5.1.0)
activerecord (>= 4.0.0)
globalid (0.3.5)
globalid (0.3.6)
activesupport (>= 4.1.0)
guard (2.12.5)
guard (2.13.0)
formatador (>= 0.2.4)
listen (~> 2.7)
listen (>= 2.7, <= 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
@@ -135,32 +154,32 @@ GEM
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.5.0)
guard-rspec (4.6.4)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
highline (1.7.2)
hashdiff (0.2.2)
highline (1.7.8)
hitimes (1.2.3)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.7.0)
jquery-rails (4.0.4)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
json (1.8.3)
libv8 (3.16.14.7)
listen (2.10.0)
celluloid (~> 0.16.0)
libv8 (3.16.14.13)
listen (3.0.3)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lograge (0.3.2)
lograge (0.3.4)
actionpack (>= 3)
activesupport (>= 3)
railties (>= 3)
loofah (2.0.2)
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
@@ -169,71 +188,71 @@ GEM
rest-client (~> 1.7)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (2.6.1)
mime-types (2.6.2)
mimemagic (0.3.0)
mini_portile (0.6.2)
minitest (5.7.0)
minitest (5.8.1)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.11.0)
multi_json (1.11.2)
nenv (0.2.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.9.2)
net-ssh (3.0.1)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
netrc (0.10.3)
newrelic_rpm (3.12.0.288)
newrelic_rpm (3.14.0.305)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nokogumbo (1.4.1)
nokogiri
notiffany (0.0.6)
notiffany (0.0.8)
nenv (~> 0.1)
shellany (~> 0.0)
oauth (0.4.7)
paperclip (4.3.0)
paperclip (4.3.1)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (= 0.3.0)
pg (0.18.2)
pg_search (1.0.3)
pg (0.18.3)
pg_search (1.0.5)
activerecord (>= 3.1)
activesupport (>= 3.1)
arel
plos (0.0.7)
nokogiri
rest-client
power_assert (0.2.3)
pry (0.10.1)
power_assert (0.2.4)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.4)
pry (>= 0.9.10)
rack (1.6.2)
rack (1.6.4)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.2)
actionmailer (= 4.2.2)
actionpack (= 4.2.2)
actionview (= 4.2.2)
activejob (= 4.2.2)
activemodel (= 4.2.2)
activerecord (= 4.2.2)
activesupport (= 4.2.2)
rails (4.2.4)
actionmailer (= 4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
activemodel (= 4.2.4)
activerecord (= 4.2.4)
activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.2)
railties (= 4.2.4)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
@@ -241,46 +260,46 @@ GEM
loofah (~> 2.0)
rails3-generators (1.0.0)
railties (>= 3.0.0)
railties (4.2.2)
actionpack (= 4.2.2)
activesupport (= 4.2.2)
railties (4.2.4)
actionpack (= 4.2.4)
activesupport (= 4.2.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rb-fsevent (0.9.4)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
recaptcha (0.4.0)
redis (3.2.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
ref (1.0.5)
request_store (1.1.0)
ref (2.0.0)
request_store (1.2.0)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
rspec-support (~> 3.3.0)
rspec-mocks (3.3.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-rails (3.2.1)
rspec-support (~> 3.3.0)
rspec-rails (3.3.3)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
rubyzip (1.1.7)
rvm-capistrano (1.4.4)
capistrano (>= 2.15.4)
@@ -289,14 +308,20 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.4.4)
nokogumbo (= 1.4.1)
sass (3.4.13)
scrypt (1.2.1)
sass (3.4.19)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
scrypt (2.0.2)
ffi-compiler (>= 0.0.2)
rake
shellany (0.0.1)
shoulda-context (1.2.1)
sidekiq (3.4.2)
celluloid (~> 0.16.0)
sidekiq (3.5.1)
celluloid (~> 0.17.2)
connection_pool (~> 2.2, >= 2.2.0)
json (~> 1.0)
redis (~> 3.2, >= 3.2.1)
@@ -316,17 +341,17 @@ GEM
temple (~> 0.6.3)
tilt (~> 1.3, >= 1.3.3)
slop (3.6.0)
spring (1.3.6)
spring (1.4.0)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.2.0)
rack (~> 1.0)
sprockets-rails (2.3.1)
sprockets (3.4.0)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
temple (0.6.10)
test-unit (3.0.9)
test-unit (3.1.5)
power_assert
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
@@ -334,8 +359,8 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
timecop (0.7.3)
timers (4.0.4)
timecop (0.8.0)
timers (4.1.1)
hitimes
twitter-bootstrap-rails (3.2.0)
actionpack (~> 4.1)
@@ -352,16 +377,16 @@ GEM
unf_ext (0.0.7.1)
uuidtools (2.1.5)
vcr (2.9.3)
webmock (1.21.0)
webmock (1.22.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
whenever (0.9.4)
chronic (>= 0.6.3)
will_paginate (3.0.7)
xpath (2.0.0)
nokogiri (~> 1.3)
yajl-ruby (1.2.1)
yui-compressor (0.12.0)
PLATFORMS
ruby
@@ -375,6 +400,7 @@ DEPENDENCIES
capybara
composite_primary_keys (~> 8.0)
database_cleaner
dotenv-rails
dynamic_form
execjs
factory_girl_rails
@@ -405,7 +431,7 @@ DEPENDENCIES
rubyzip
rvm-capistrano (= 1.4.4)
sanitize
sass
sass-rails
shoulda-context
sidekiq
sidekiq-limit_fetch
@@ -425,4 +451,6 @@ DEPENDENCIES
webmock
whenever
will_paginate
yui-compressor
BUNDLED WITH
1.10.6

View File

@@ -34,18 +34,14 @@ rake db:seed OR rake db:setup (which also sets up the entire db)
## Setup Config
```
# edit database.yml to point to your postgresql database
cp config/database.yml.example config/database.yml
All configuration is done via environment variables. A file with a
working environment for development can be found at `.env.example`.
Simply copy it to `.env` to use it as is. The
[dotenv](https://github.com/bkeepers/dotenv) gem will pick it up
and set the environment variables.
cp config/app_config.yml.example config/app_config.yml
```
## Generate Secret Token
```
bundle rake secret > secret_token
```
Copy `config/database.yml.example` to `config/database.yml` and adapt to
your database setup.
## Initialize Database
@@ -58,6 +54,7 @@ bundle exec rake db:setup
```
bundle exec rake
```
This runs RSpec tests as well as the **legacy** test/unit ones.
# Usage

View File

@@ -6,4 +6,5 @@ require 'rake'
Snpr::Application.load_tasks
task :test => :spec
task test: :spec
task default: :test

View File

@@ -162,7 +162,8 @@ class FitbitProfilesController < ApplicationController
print @user
@fitbit_profile = @user.fitbit_profile
print @fitbit_profile
client = Fitgem::Client.new({:consumer_key => APP_CONFIG[:fitbit_consumer_key], :consumer_secret => APP_CONFIG[:fitbit_consumer_secret]})
client = Fitgem::Client.new(consumer_key: ENV.fetch('FITBIT_CONSUMER_KEY'),
consumer_secret: ENV.fetch('FITBIT_CONSUMER_SECRET'))
request_token = client.request_token
@fitbit_profile.request_token = request_token.token
@fitbit_profile.request_secret = request_token.secret
@@ -174,7 +175,8 @@ class FitbitProfilesController < ApplicationController
@user = current_user
@fitbit_profile = @user.fitbit_profile
if params[:oauth_token] && params[:oauth_verifier]
@client = Fitgem::Client.new(:consumer_key => APP_CONFIG[:fitbit_consumer_key], :consumer_secret => APP_CONFIG[:fitbit_consumer_secret])
@client = Fitgem::Client.new(consumer_key: ENV.fetch('FITBIT_CONSUMER_KEY'),
consumer_secret: ENV.fetch('FITBIT_CONSUMER_SECRET'))
token = params[:oauth_token]
secret = @fitbit_profile.request_secret
verifier = params[:oauth_verifier]

View File

@@ -6,7 +6,8 @@ class FitbitEdit
def perform(fitbit_profile_id)
@fitbit_profile = FitbitProfile.find_by_id(fitbit_profile_id)
@client = Fitgem::Client.new(:consumer_key => APP_CONFIG[:fitbit_consumer_key], :consumer_secret => APP_CONFIG[:fitbit_consumer_secret])
@client = Fitgem::Client.new(consumer_key: ENV.fetch('FITBIT_CONSUMER_KEY'),
consumer_secret: ENV.fetch('FITBIT_CONSUMER_SECRET'))
@client.reconnect(@fitbit_profile.access_token, @fitbit_profile.access_secret)
@return_value = @client.create_subscription({:type => :all, :subscription_id => @fitbit_profile.id})
puts "subscription returned: "+ @return_value[0]

View File

@@ -6,7 +6,8 @@ class FitbitEndSubscription
def perform(fitbit_profile_id)
@fitbit_profile = FitbitProfile.find_by_id(fitbit_profile_id)
@client = Fitgem::Client.new(:consumer_key => APP_CONFIG[:fitbit_consumer_key], :consumer_secret => APP_CONFIG[:fitbit_consumer_secret])
@client = Fitgem::Client.new(consumer_key: ENV.fetch('FITBIT_CONSUMER_KEY'),
consumer_secret: ENV.fetch('FITBIT_CONSUMER_SECRET'))
@client.reconnect(@fitbit_profile.access_token, @fitbit_profile.access_secret)
@client.remove_subscription({:type => :all, :subscriber_id => "general", :subscription_id => @fitbit_profile.id})
@fitbit_profile.destroy()

View File

@@ -5,7 +5,8 @@ class FitbitInit
sidekiq_options :queue => :fitbit, :retry => 5, :unique => true
def perform(fitbit_profile_id)
@client = Fitgem::Client.new(:consumer_key => APP_CONFIG[:fitbit_consumer_key], :consumer_secret => APP_CONFIG[:fitbit_consumer_secret])
@client = Fitgem::Client.new(consumer_key: ENV.fetch('FITBIT_CONSUMER_KEY'),
consumer_secret: ENV.fetch('FITBIT_CONSUMER_SECRET'))
fitbit_profile = FitbitProfile.find_by_id(fitbit_profile_id)
@client.reconnect(fitbit_profile.access_token, fitbit_profile.access_secret)
fitbit_id = @client.user_info["user"]["encodedId"]

View File

@@ -9,7 +9,8 @@ class FitbitNotification
notification.each do |n|
@fitbit_profile = FitbitProfile.find_by_id(n["subscriptionId"])
if @fitbit_profile != nil
@client = Fitgem::Client.new(:consumer_key => APP_CONFIG[:fitbit_consumer_key], :consumer_secret => APP_CONFIG[:fitbit_consumer_secret])
@client = Fitgem::Client.new(consumer_key: ENV.fetch('FITBIT_CONSUMER_KEY'),
consumer_secret: ENV.fetch('FITBIT_CONSUMER_SECRET'))
@client.reconnect(@fitbit_profile.access_token, @fitbit_profile.access_secret)
puts n
puts n["collectionType"]

View File

@@ -84,7 +84,6 @@ class PlosSearch
end
def self.api_key
# TODO: put in APP_CONFIG
File.read(Rails.root.join("key_plos.txt")).strip
ENV.fetch('PLOS_API_KEY')
end
end

5
bin/deploy Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
curl -X POST \
-d "build=true&source_type=Branch&source_name=master" \
https://registry.hub.docker.com/u/opensnp/rails/trigger/$DOCKERHUB_TRIGGER_TOKEN/

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
env_file_name = ARGV[0] || '.env.example'
puts File.read(env_file_name)
.split(/ |=/)
.grep(/\A[_A-Z0-9]+\z/)
.map { |var| "env #{var};" }

View File

@@ -1,25 +0,0 @@
default: &default
fitbit_consumer_key:
fitbit_consumer_secret:
mendeley:
consumer_key:
recaptcha:
public_key: foo
private_key: bar
sidekiq:
user: admin
password: password
devise: password
errbit:
api_key: gobbledigook
host: url
production:
<<: *default
development:
<<: *default
test:
<<: *default

View File

@@ -2,11 +2,7 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
end
Bundler.require(*Rails.groups)
module Snpr
class Application < Rails::Application

View File

@@ -23,7 +23,7 @@ Snpr::Application.configure do
config.log_level = :info
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
config.logger = Logger.new($stdout)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
@@ -52,7 +52,7 @@ Snpr::Application.configure do
# Compress JavaScript and CSS
config.assets.compress = true
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :yui
#config.assets.css_compressor = :yui
# Don't fallback to assets pipeline
config.assets.compile = false

View File

@@ -1,2 +0,0 @@
raw_config = File.read("#{Rails.root}/config/app_config.yml")
APP_CONFIG = YAML.load(raw_config)[Rails.env].symbolize_keys

View File

@@ -1,7 +1,7 @@
# This is the config to talk to opensnperr.herokuapp.com
Airbrake.configure do |config|
config.api_key = APP_CONFIG[:errbit]['api_key']
config.host = APP_CONFIG[:errbit]['host']
config.api_key = ENV.fetch('ERRBIT_API_KEY')
config.host = ENV.fetch('ERRBIT_HOST')
config.port = 80
config.secure = config.port == 443
config.environment_name = Rails.env.production? ? `hostname` : Rails.env

View File

@@ -1 +1 @@
Mendeley.consumer_key = APP_CONFIG[:mendeley]['consumer_key']
Mendeley.consumer_key = ENV.fetch('MENDELEY_CONSUMER_KEY')

View File

@@ -1,4 +1,4 @@
Recaptcha.configure do |config|
config.public_key = APP_CONFIG[:recaptcha]['public_key']
config.private_key = APP_CONFIG[:recaptcha]['private_key']
config.public_key = ENV.fetch('RECAPTCHA_PUBLIC_KEY')
config.private_key = ENV.fetch('RECAPTCHA_PRIVATE_KEY')
end

View File

@@ -1,9 +1,4 @@
# TODO: Move to environment variables
begin
Snpr::Application.configure do
config.secret_token = File.read(Rails.root.join('secret_token'))
config.secret_key_base = File.read(Rails.root.join('secret_key_base'))
end
rescue LoadError, Errno::ENOENT => e
raise "Secret token couldn't be loaded! Error: #{e}"
Snpr::Application.configure do
config.secret_token = ENV.fetch('SECRET_TOKEN')
config.secret_key_base = ENV.fetch('SECRET_KEY_BASE')
end

View File

@@ -3,8 +3,6 @@ require 'sidekiq/web'
require 'sidekiq/limit_fetch'
Sidekiq::Web.use(Rack::Auth::Basic) do |user, password|
u = (APP_CONFIG[:sidekiq].try(:[], "user") || "admin")
p = (APP_CONFIG[:sidekiq].try(:[], "password") || "password")
[user, password] == [u, p]
Sidekiq::Web.use(Rack::Auth::Basic) do |_user, password|
password == ENV.fetch('SIDEKIQ_PASSWORD')
end

View File

@@ -1,6 +0,0 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'