Skip to content

Commit

Permalink
Add basic deployment config
Browse files Browse the repository at this point in the history
  • Loading branch information
LikaLex committed Aug 31, 2018
1 parent 0612bac commit 2dd1245
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ db/*.sqlite3
/tmp/*

# add /config/database.yml if it contains passwords
/config/database.yml
# /config/database.yml
/config/secrets.yml
/config/local_env.yml
# various artifacts
Expand Down
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ gem 'bootstrap', '~> 4.0.0'
gem 'jquery-rails'
gem 'bourbon'
gem 'foreman'
gem 'dotenv'
gem 'coffee-rails', '~> 4.2'
gem 'devise'
gem 'gibbon'
Expand All @@ -32,7 +31,8 @@ gem 'paperclip'
gem 'pundit'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'sendgrid'

gem 'sidekiq'
gem 'sidekiq-status'
gem 'semantic-ui-sass', github: 'doabit/semantic-ui-sass'

group :development do
Expand Down Expand Up @@ -60,5 +60,3 @@ group :test do
gem 'launchy'
gem 'selenium-webdriver'
end
gem 'sidekiq'
gem 'sidekiq-status'
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.3)
dotenv (2.5.0)
enum_help (0.0.17)
activesupport (>= 3.0.0)
erubi (1.7.1)
Expand Down Expand Up @@ -399,7 +398,6 @@ DEPENDENCIES
coffee-rails (~> 4.2)
database_cleaner
devise
dotenv
enum_help
excon
factory_bot_rails
Expand Down
12 changes: 0 additions & 12 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,4 @@ def blocked?
def active_for_authentication?
super && !blocked?
end

def subscribe
mailchimp = Gibbon::Request.new(api_key: Rails.application.secrets.mailchimp_api_key)
list_id = Rails.application.secrets.mailchimp_list_id
result = mailchimp.lists(list_id).members.create(
body: {
email_address: email,
status: 'subscribed'
}
)
Rails.logger.info("Subscribed #{email} to MailChimp") if result
end
end
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Application < Rails::Application
config.i18n.default_locale = :en
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
config.active_job.queue_adapter = Rails.env.production? ? :sidekq : :async
config.active_job.queue_adapter = Rails.env.production? ? :sidekiq : :async
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
Expand Down
13 changes: 0 additions & 13 deletions config/application.yml

This file was deleted.

61 changes: 61 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On Mac OS X with macports:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
development:
adapter: postgresql
host: localhost
encoding: unicode
database: FitFree_development
pool: 5
username: FitFree
password:
template: template0

# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
#port: 5432

# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public

# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
# The server defaults to notice.
#min_messages: warning

# 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:
adapter: postgresql
host: localhost
encoding: unicode
database: FitFree_test
pool: 5
username: FitFree
password:
template: template0

production:
adapter: postgresql
host: localhost
encoding: unicode
database: FitFree_production
pool: 5
username: FitFree
# password:
# template: template0
9 changes: 8 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.js_compressor = Uglifier.new(harmony: true)
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
Expand Down Expand Up @@ -106,4 +106,11 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
end
13 changes: 0 additions & 13 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@
# http://edgeguides.rubyonrails.org/security.html#custom-credentials

development:
admin_name: First User
admin_email: [email protected]
admin_password: 123456789
email_provider_username: <%= ENV["SENDGRID_USERNAME"] %>
email_provider_password: <%= ENV["SENDGRID_PASSWORD"] %>
domain_name: example.com
mailchimp_api_key: <%= ENV["MAILCHIMP_API_KEY"] %>
mailchimp_list_id: <%= ENV["MAILCHIMP_LIST_ID"] %>
secret_key_base: very_long_random_string
telegram_token: '699449238:AAG65ShGj918_sWg60k_W9xeHK7orsr0ZE0'
google_client_id: 752276571199-9dfahm6g9oert5765gf7m0nmi0t0ea85.apps.googleusercontent.com
Expand All @@ -36,14 +29,8 @@ test:
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
admin_name: <%= ENV["ADMIN_NAME"] %>
admin_email: <%= ENV["ADMIN_EMAIL"] %>
admin_password: <%= ENV["ADMIN_PASSWORD"] %>
email_provider_username: <%= ENV["SENDGRID_USERNAME"] %>
email_provider_password: <%= ENV["SENDGRID_PASSWORD"] %>
domain_name: <%= ENV["DOMAIN_NAME"] %>
mailchimp_api_key: <%= ENV["MAILCHIMP_API_KEY"] %>
mailchimp_list_id: <%= ENV["MAILCHIMP_LIST_ID"] %>
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
telegram_token: '699449238:AAG65ShGj918_sWg60k_W9xeHK7orsr0ZE0'
google_client_id: 752276571199-9dfahm6g9oert5765gf7m0nmi0t0ea85.apps.googleusercontent.com
Expand Down

0 comments on commit 2dd1245

Please sign in to comment.