Last active
May 3, 2021 15:48
-
-
Save keymastervn/207566b4d05063237292fd87cc39dc8c to your computer and use it in GitHub Desktop.
Heroku is simple, but I need to search a lot because only AWS and GCP involve me
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
$ heroku login | |
# remember heroku instance is wellplayed with platform below | |
$ bundle lock --add-platform x86_64-linux --add-platform ruby | |
# remember postgres is wellplayed too | |
$ rails new app --database=postgresql | |
Assume you push already | |
$ heroku create | |
$ git push heroku main | |
# usually they created an associated database instance, you just need to come to `config/database.yml` | |
# under production: add url: ENV['DATABASE_URL'], else (in case something is wierd) | |
$ heroku addons:create heroku-postgresql:hobby-dev | |
$ heroku addons | |
$ heroku pg:info | |
# again | |
$ git push | |
$ git push heroku main | |
# FOR RUNNING RAKE | |
$ heroku run rails db:prepare | |
$ heroku run rails db:seed | |
$ heroku run rake load_hotel_data_from_sources | |
# CONTAINER (docker is BELOW) | |
# https://devcenter.heroku.com/articles/container-registry-and-runtime | |
# If you are migrating from heroku common stack to container stack | |
# heroku stack:set container | |
# else heroku stack:set heroku-20 | |
$ heroku container:login | |
$ heroku create | |
> Creating app... done, ⬢ fierce-garden-91665 | |
> https://fierce-garmin-91665.herokuapp.com/ | https://git.heroku.com/fierce-garmin-91665.git | |
$ heroku container:push web | |
=== Building web (/x/mris/Dockerfile.web) | |
[+] Building 40.7s (13/17) | |
=> [internal] load build definition from Dockerfile | |
=> => transferring dockerfile: 37B | |
=> [internal] load .dockerignore | |
=> => transferring context: 2B | |
=> [internal] load metadata for docker.io/library/ruby:3.0 | |
=> [internal] load build context | |
... | |
$ heroku container:release web | |
> Releasing images web,webpacker to fierce-garmin-91665... done | |
# ssh | |
$ heroku run bash | |
# migration | |
$ heroku run rails db:migrate | |
# logging (STDOUT ready) | |
$ heroku logs --tail -n 40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Refresh data
$ heroku run bash -c "DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rails db:truncate_all && rails db:seed"