Multiple apps on heroku from the same git repository

Inspired by

I have 3 version of the same app running on heroku. The difference between each versions is the demo group that the app is using (teens, moms and fashion).

To make deployments easy, I wanted to push to all three apps from the same git repo.

Here are the steps to get this working.

1. Go to your local folder where the app files are located.

2. Make sure you’re logged in to heroku, then create your three apps:

heroku create --remote [name_of_your_app]  // app_demo1

This will automatically create a git connection with a remote named “heroku”. Go ahead and rename that to a more descriptive name:

git remote rename heroku [your_descriptive_remote_name] 

Repeat this for all three of your apps (or however many you have). To check your remote repos, run:

git remote -v

3. Create config variables for each app, so they can act as your settings

heroku config:add CONF_VAR_NAME=var_value --app [name_of_your_app] 
// in my case DEMO_NAME=teens

Then run “heroku config –app [name_of_your_app]” to make sure the variables are set

4. In your app code, use heroku environment config variables where needed:

var demo = process.env.DEMO_NAME; 

The output will show: DEMO_NAME => teens

5. Now you should be ready for deployment! Commit your changes and push to your remote:

git push [your_descriptive_remote_name] master

And that’s it! This will initiate the deployment on heroku.

To check logs for your app, just run:

heroku logs --app [name_of_your_app]

One thought on “Multiple apps on heroku from the same git repository

  1. Pingback: Tanya Nam » Blog Archive » Why I love Heroku

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s