Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
./config/application_settings.yml
./config/database.yml
./config/environments/deveropment.rb

vender/bundle
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pickle-email-*.html

# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/secrets.yml
config/setting_google_calendar.yml
config/application_settings.yml

Expand All @@ -53,4 +52,6 @@ bower.json

attic/

config/environments/development.rb
config/environments/development.rb

.env
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ruby:2.1.5
RUN apt-get update -qq && apt-get install -y build-essential ruby-dev libxslt1-dev libxml2-dev libpq-dev nodejs sqlite3 postgresql-client redis-server

WORKDIR camome

COPY Gemfile Gemfile.lock /camome/
RUN bundle install --path vendor/bundle

COPY . /camome

RUN git submodule init
RUN git config submodule.vendor/assets/bootstrap-table.url https://github.com/wenzhixin/bootstrap-table.git
RUN git config submodule.vendor/assets/jsSHA.url https://github.com/Caligatio/jsSHA.git
RUN git submodule update
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source 'https://rubygems.org'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem 'pg', '~> 0.20.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
Expand Down
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ GEM
less-rails (2.6.0)
actionpack (>= 3.1)
less (~> 2.6.0)
libv8 (3.16.14.7)
libv8 (3.16.14.19)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.4.3)
Expand Down Expand Up @@ -123,6 +123,7 @@ GEM
oauth2 (~> 1.0)
omniauth (~> 1.2)
orm_adapter (0.5.0)
pg (0.21.0)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
Expand Down Expand Up @@ -232,6 +233,7 @@ DEPENDENCIES
nokogiri
omniauth
omniauth-google-oauth2
pg
rails (= 4.1.8)
redis
rspec-rails
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def event_to_json(event)
def exist_token?
ds = DataStore::RedisStore.new
user = current_user
if ds.load(user.auth_name) == nil && user.master_auth_info.token != nil
if ds.load(user.auth_name) == nil
redirect_to :action => "input_master_pass"
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def google_oauth2

case state
when "invitation"
user = User.where("invitation_token is ?", token).first
user = User.where("invitation_token = token").first
if user
User.current = user
user.provider = auth.provider
Expand Down
4 changes: 3 additions & 1 deletion app/models/redis_store.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'uri'
module DataStore
class RedisStore < Base
def initialize
@redis = Redis.new
uri = URI.parse(ApplicationSettings.redis.url)
@redis = Redis.new(host: uri.host, port: uri.port)
end

def load(key)
Expand Down
2 changes: 2 additions & 0 deletions config/application_settings_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ default: &default
google:
application_id: XXXXXXXXXXXXXXXXX
application_secret: XXXXXXXXXXXXXXXXX
redis:
url: redis://XXXXX:6379

development:
<<: *default
Expand Down
26 changes: 8 additions & 18 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
adapter: postgresql
encoding: unicode
pool: 5
timeout: 5000

development:
development: &development
<<: *default
database: db/development.sqlite3
database: camome_development
username: postgres
password:
host: db

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3

production:
<<: *default
database: db/production.sqlite3
database: camome_test
6 changes: 6 additions & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
development:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
test:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'
services:
db:
container_name: db
image: postgres
expose:
- "5432"
volumes:
- ./db/camome_pgdata:/var/lib/postgresql/data

web:
build: .
container_name: camome
image: nomlab/camome
command: bundle exec rails s -p 3000 -b 0.0.0.0
ports:
- "3000:3000"
depends_on:
- redis
- db
volumes:
- ./config/application_settings.yml:/camome/config/application_settings.yml
- ./config/database.yml:/camome/config/database.yml
- ./config/environments/deveropment.rb:/camome/config/environments/deveropment.rb
env_file: .env

redis:
container_name: redis
image: redis

goohub:
container_name: goohub
image: nomlab/goohub
links:
- redis
- web
volumes:
- ./goohub:/root/.config/goohub
Empty file added redis/appendonly.aof
Empty file.