Skip to content

Commit

Permalink
Switch to pg and modify database and env config
Browse files Browse the repository at this point in the history
  • Loading branch information
esteedqueen committed Sep 2, 2018
1 parent f388ac3 commit 9f1b3bc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
11 changes: 11 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BUNDLE_WITHOUT=test:development
RACK_ENV=
RAILS_ENV=
RAILS_SKIP_MIGRATIONS=false
RAILS_SKIP_ASSET_COMPILATION=false
SECRET_KEY_BASE=
RDS_USERNAME=
RDS_DB_NAME=
RDS_PASSWORD=
RDS_PORT=
RDS_HOSTNAME=
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

# Environment credentials
.env
.env.production
.env.staging
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ gem 'rails', '5.2.0'
gem 'sqlite3'
gem 'sass-rails'
gem 'uglifier'
gem 'pg'
gem 'puma'

group :development do
gem 'listen'
Expand All @@ -25,3 +27,6 @@ group :test do
gem 'rails-controller-testing'
end

group :production, :staging do
gem 'rails_12factor'
end
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ GEM
mini_portile2 (~> 2.3.0)
parser (2.5.1.2)
ast (~> 2.4.0)
pg (1.1.2)
powerpack (0.1.2)
public_suffix (3.0.2)
puma (3.12.0)
rack (2.0.5)
rack-test (1.1.0)
rack (>= 1.0, < 3)
Expand All @@ -130,6 +132,11 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
Expand Down Expand Up @@ -212,8 +219,11 @@ DEPENDENCIES
faker
jquery-rails
listen
pg
puma
rails (= 5.2.0)
rails-controller-testing
rails_12factor
rspec-rails
rubocop (~> 0.48.1)
sass-rails
Expand Down
29 changes: 19 additions & 10 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
# 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:
<<: *default
database: db/development.sqlite3
database: guestbook_development

# 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
database: guestbook_test

production:
<<: *default
database: db/production.sqlite3
encoding: unicode
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
host: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>

staging:
<<: *default
adapter: postgresql
encoding: unicode
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
host: <%= ENV['RDS_HOSTNAME'] %>

0 comments on commit 9f1b3bc

Please sign in to comment.