Deploy two (Rails) Apps from the same code repo

Currently, we deploy the same code base to multiple (non-Aptible) servers (qa, stage, production). I’m wondering how this can be accomplished in Aptible… can you map the same repo to multiple aptible git remotes, one for staging, one for production?

And if you can, how do you tell them apart when you push so you can choose where you deploy?


1 Like

You can! We do this exact same thing: deploying to one of several staging servers, then to production. One option is to have several staging “apps” within one “environment”, but I’ve preferred to have a dedicated environment for each staging server. So you might have aptible environments for jessica-qa, jessica-staging, and jessica-production.

From there, you’re on the right track: just have a different git remote for each environment+app you want to deploy to. For example, if you used the same app name (eg my-rails) in each environment, it’d look like:

git remote add qa
git remote add stage
git remote add production

( you can get these git remote addresses from the aptible UI)

Then, when you want to push master to, say, staging, you’d push like this:

git push stage master

To build on Kevin’s response (thanks for the great info!), you may wish to deploy different branches to each Aptible App. To do so, simply push the local named branch to the remote ‘master’ branch:

git push qa feature-test:master
git push stage beta:master
git push production stable:master
1 Like

Thanks for two great responses! +1 for community support!