Created
January 24, 2025 05:10
-
-
Save kuboon/e486ba4a75cfeb22697e018ac7ff8a17 to your computer and use it in GitHub Desktop.
rails initializer for heroku
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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