Skip to content

Commit

Permalink
Initial docker compose file
Browse files Browse the repository at this point in the history
Start basechurch with:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml <cmd>
  • Loading branch information
achan committed Jul 9, 2017
1 parent fe03040 commit e890bc8
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 34 deletions.
3 changes: 3 additions & 0 deletions apps/basechurch/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DATABASE_HOST=db
DATABASE_USER=postgres
DATABASE_PASSWORD=
8 changes: 8 additions & 0 deletions apps/basechurch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install
ADD . /app
22 changes: 7 additions & 15 deletions apps/basechurch/config/database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 10
timeout: 50000
adapter: postgresql
database: mcac
encoding: utf8
host: <%= ENV["DATABASE_HOST"] %>
username: <%= ENV["DATABASE_USER"] %>
password: <%= ENV["DATABASE_PASSWORD"] %>
pool: 5

development:
<<: *default
database: db/development.sqlite3

# 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
43 changes: 24 additions & 19 deletions apps/basechurch/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

ActiveRecord::Schema.define(version: 20161011033416) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "announcements", force: :cascade do |t|
t.integer "post_id"
t.integer "bulletin_id"
Expand All @@ -23,8 +26,8 @@
t.string "url"
end

add_index "announcements", ["bulletin_id"], name: "index_announcements_on_bulletin_id"
add_index "announcements", ["post_id"], name: "index_announcements_on_post_id"
add_index "announcements", ["bulletin_id"], name: "index_announcements_on_bulletin_id", using: :btree
add_index "announcements", ["post_id"], name: "index_announcements_on_post_id", using: :btree

create_table "attachments", force: :cascade do |t|
t.string "key"
Expand All @@ -35,7 +38,7 @@
t.datetime "updated_at"
end

add_index "attachments", ["attachable_type", "attachable_id"], name: "attachments_polymorphic_keys_index"
add_index "attachments", ["attachable_type", "attachable_id"], name: "attachments_polymorphic_keys_index", using: :btree

create_table "bulletins", force: :cascade do |t|
t.datetime "published_at"
Expand All @@ -49,7 +52,7 @@
t.integer "sermon_id"
end

add_index "bulletins", ["sermon_id"], name: "index_bulletins_on_sermon_id"
add_index "bulletins", ["sermon_id"], name: "index_bulletins_on_sermon_id", using: :btree

create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false
Expand All @@ -59,10 +62,10 @@
t.datetime "created_at"
end

add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id"
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree
add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree
add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree

create_table "groups", force: :cascade do |t|
t.string "name"
Expand All @@ -76,7 +79,7 @@
t.string "meet_details"
end

add_index "groups", ["slug"], name: "index_groups_on_slug", unique: true
add_index "groups", ["slug"], name: "index_groups_on_slug", unique: true, using: :btree

create_table "posts", force: :cascade do |t|
t.integer "group_id"
Expand All @@ -91,9 +94,9 @@
t.integer "kind", default: 0
end

add_index "posts", ["author_id"], name: "index_posts_on_author_id"
add_index "posts", ["editor_id"], name: "index_posts_on_editor_id"
add_index "posts", ["group_id"], name: "index_posts_on_group_id"
add_index "posts", ["author_id"], name: "index_posts_on_author_id", using: :btree
add_index "posts", ["editor_id"], name: "index_posts_on_editor_id", using: :btree
add_index "posts", ["group_id"], name: "index_posts_on_group_id", using: :btree

create_table "sermons", force: :cascade do |t|
t.integer "group_id"
Expand All @@ -106,7 +109,7 @@
t.datetime "updated_at", null: false
end

add_index "sermons", ["group_id"], name: "index_sermons_on_group_id"
add_index "sermons", ["group_id"], name: "index_sermons_on_group_id", using: :btree

create_table "taggings", force: :cascade do |t|
t.integer "tag_id"
Expand All @@ -118,15 +121,15 @@
t.datetime "created_at"
end

add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree

create_table "tags", force: :cascade do |t|
t.string "name"
t.integer "taggings_count", default: 0
end

add_index "tags", ["name"], name: "index_tags_on_name", unique: true
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree

create_table "users", force: :cascade do |t|
t.string "provider", null: false
Expand All @@ -153,8 +156,10 @@
t.datetime "updated_at"
end

add_index "users", ["email"], name: "index_users_on_email"
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
add_index "users", ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true
add_index "users", ["email"], name: "index_users_on_email", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true, using: :btree

add_foreign_key "bulletins", "sermons"
add_foreign_key "sermons", "groups"
end
6 changes: 6 additions & 0 deletions apps/basechurch/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'
services:
web:
env_file:
- ./.env.dev

13 changes: 13 additions & 0 deletions apps/basechurch/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
db:
image: postgres
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/app
ports:
- "3000:3000"
depends_on:
- db

0 comments on commit e890bc8

Please sign in to comment.