Skip to content

Instantly share code, notes, and snippets.

Last active August 30, 2017 08:08
What would you like to do?
How to deploy your openshift app to a second instance

##How to deploy your openshift app to a second instance

I set up Moodle for myself on Openshift which I explained here:

Now I wanted to install Moodle for a friend who has his own user and his own domain on openshift. Since I'm the admin why bother creating a second app which is basically the exact same app as mine and will most cetainly need the exact same updates. DRY!

So I decided to find out how I can use the app repo on two different instances of openshift. This is how it works (there might be better solutions, let me know):

You log in as the second user and create a new app. This will give you a git URL. Copy this URL and head over to you app repo (Moodle used in this example):

git add remote second_app ssh://

Add cron for your second app:

rhc cartridge add cron-1.4 -a moodle -l

Also add the database:

rhc cartridge add mysql-5.1 -a moodle -l

and if you like phpmyadmin

rhc cartridge add phpmyadmin-3.4 -a moodle -l

Now you need to clean up your remote repository. There is the default app and you want to remove that with your push (therefore the -f option):

git push -f second_app HEAD:master

That will force your app over the old default openshift app. Obviously you will have to set up the app as it's all fresh and not yet set up.

Next time you update a simple:

git push second_app HEAD:master

will suffice.

Have fun Have fun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment