Skip to content

Instantly share code, notes, and snippets.

@kuboon
Created January 24, 2025 05:10
Show Gist options
  • Save kuboon/e486ba4a75cfeb22697e018ac7ff8a17 to your computer and use it in GitHub Desktop.
Save kuboon/e486ba4a75cfeb22697e018ac7ff8a17 to your computer and use it in GitHub Desktop.
rails initializer for heroku
# frozen_string_literal: true
run "heroku create #{@app_name}"
gem "pg"
file "config/database.yml", <<~CODE
development: &psql
adapter: postgresql
database: #{@app_name}
pool: 5
username: postgres
password:
host: localhost
test:
<<: *psql
database: #{@app_name}_test
production:
<<: *psql
database: #{@app_name}_prod
CODE
run "heroku addons:add sendgrid:starter"
initializer "mail.rb", <<~CODE
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com'
}
ActionMailer::Base.delivery_method = :smtp
CODE
git add: "."
git commit: "-a -m 'heroku'"
git push heroku master
heroku run rake db: migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment