visit github.com/vencaf/theapp in browser
on right side of page, click to save the "clone url"
git clone [paste clone url]
will look like: git clone [email protected]:vencaf/theapp.git
cd theapp
heroku apps:create vencaf-chigao --remote chicago
optional: confirm we're all set in git: cat .git/config
. Output should look like:
Lukes-MacBook-Air:know_list luke$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = [email protected]:vencaf/theapp.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "chicago"]
url = [email protected]:vencaf-chicago.git
fetch = +refs/heads/*:refs/remotes/heroku/*
The "remotes" are the important part.
- one remote is called "origin", and that is the github repo
- the other is called "chicago", and is the deploy on heroku
git push chicago master
-> starts the deploy to heroku
Theoretically should work smoothly since it's the same as the code already deployed to heroku.
But this will probably fail with various errors.
Can paste these errors into google for solutions.
add a CNAME record to the vencaf.org DNS with these values:
Name: chi.vencaf.org
TTL: 14400
Type: CNAME
Address: vencaf-chicago.herokuapp.com
see: http://stackoverflow.com/questions/13715556/how-to-point-subdomain-to-a-heroku-app-and-root-domain-to-another-heroku-app
Then assign the subdomain in heroku's system:
heroku domains:add --app vencaf-chicago.herokuapp.com chi.vencaf.org
That should do the trick, but will probably require debugging.
Each separate running copy of the app, with its own database, is called "a deploy" of the app.
Each deploy of the app might require certain variables to differ.
For example, if storing images in S3, a different app should use a different S3 bucket.
has_attached_file(:portrait, storage: :s3, s3_options: {bucket_name: 'vencaf'})
Here the app is using an external service, and the connection is configured inside the code.
To allow for multiple deployes, the code should be changed to use an Environment Variable.
has_attached_file(:portrait, storage: :s3, s3_options: {bucket_name: ENV['S3_BUCKET_NAME']})
Environment variables are set using the "config" command on heroku like this:
heroku config:add S3_BUCKET_NAME=vencaf --app original-app.herokuapp.com
heroku config:add S3_BUCKET_NAME=vencaf-chi --app vencaf-chicago.herokuapp.com