diff --git a/apps/basechurch/.env.dev b/apps/basechurch/.env.dev new file mode 100644 index 0000000..fb3d214 --- /dev/null +++ b/apps/basechurch/.env.dev @@ -0,0 +1,3 @@ +DATABASE_HOST=db +DATABASE_USER=postgres +DATABASE_PASSWORD= diff --git a/apps/basechurch/Dockerfile b/apps/basechurch/Dockerfile new file mode 100644 index 0000000..0cd15e7 --- /dev/null +++ b/apps/basechurch/Dockerfile @@ -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 diff --git a/apps/basechurch/config/database.yml b/apps/basechurch/config/database.yml index 9d1152d..c348837 100644 --- a/apps/basechurch/config/database.yml +++ b/apps/basechurch/config/database.yml @@ -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 diff --git a/apps/basechurch/db/schema.rb b/apps/basechurch/db/schema.rb index 558328e..9209cbc 100644 --- a/apps/basechurch/db/schema.rb +++ b/apps/basechurch/db/schema.rb @@ -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" @@ -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" @@ -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" @@ -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 @@ -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" @@ -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" @@ -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" @@ -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" @@ -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 @@ -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 diff --git a/apps/basechurch/docker-compose.dev.yml b/apps/basechurch/docker-compose.dev.yml new file mode 100644 index 0000000..76fb48c --- /dev/null +++ b/apps/basechurch/docker-compose.dev.yml @@ -0,0 +1,6 @@ +version: '3' +services: + web: + env_file: + - ./.env.dev + diff --git a/apps/basechurch/docker-compose.yml b/apps/basechurch/docker-compose.yml new file mode 100644 index 0000000..2bc3f30 --- /dev/null +++ b/apps/basechurch/docker-compose.yml @@ -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