This guide will demonstrate,
- How to create a new project in OpenShift
- Launch your first application
- Learn how to trigger new builds/images when you make your first Github commit
-
Sign up for OpenShift online
-
Sign up for a GitHub account if you don't have one
-
Click on Add to Project
Select Python under Browse Catalog
Select Django + PostgreSQL (Persistent)
-
Login to Github
Forkhttps://github.com/openshift/django-ex
You must now have your own django-ex repository (https://github.com/<your-github-username>/django-ex
) -
Copy the URL
https://github.com/<your-github-username>/django-ex
& go back to OpenShift UI -
In the window My-Project > Add to Project > Catalog > Django + PostgreSQL (Persistent) add your Github URL to the Git Repository URL field
Click Create -
In the next window, you will be given instructions to download the OpenShift client & also to create your first project. There is also a URL under Making code changes block
Save this URL -
Go to
https://github.com/<your-github-username>/django-ex/settings/hooks
Paste the URL you saved from the previous step into the Payload URL field
Change Content-type to application/json
Click Add Webhook
-
A build should've been started by now. After the build has completed, you will find a URL in the Overview tab in OpenShift UI
Clicking the URL should open your django web application
-
Make some changes to the code, either in Github UI or on your local machine
For example change the header inhttps://github.com/<your-github-username/django-ex/blob/master/welcome/templates/welcome/index.html
line:214
Commit the changeBEFORE: line 214: <h1>Welcome to your Django application on OpenShift</h1> AFTER: line 214: <h1>This is my 1st Django application on OpenShift</h1>
-
This change should trigger a new build automatically
Clicking on the URL should open the application, which is deployed with the changes you made