-
Create a dockerhub account.
-
Create a new public repository, called "sample-python-repo".
-
sudo docker build -t eliezerberlin/sample-python-repo:latest .
3a. (When building the docker image, give it a name {Username}/{RepoName}:{tag})
-
sudo docker login
-
sudo docker push eliezerberlin/sample-python-repo:latest
-
Go to https://console.pro-us-east-1.openshift.com/console/project/fatfish-test/overview
-
Press "Add to Project -> Deploy Image"
7a. Image name: "eliezerberlin/sample-python-repo:latest"
7b. Press the "Magnifying glass" button next to image name, to verify OpenShift can read the image correctly.
7c. Press "Deploy"
-
Create route so it can be accessed from outside.
8a. "Create Route" button.
8b. Target Port "8080" -> "8080" (That means outer port 8080 should be forwarded to inner port 8080)
8c. "Secure Route" : TRUE
-
Set Enviroment variables
9a. Go to Resources -> Secrets
9b. Press "Create Secret"
9c.
"Secret Type": Generic Secret "Secret Name": "my-python-git-credentials"
9d. Add three keys. After each key, press "Add Item" to add another.
Key: GIT_USERNAME Value: (The GIT username) Key: GIT_PASS Value: (The GIT password. Note that if the password has any special characters, they need to be escaped, as per https://en.wikipedia.org/wiki/Percent-encoding#Reserved_characters. For example, "p@ssw0rd" would turn into "p%40ssw0rd", since we must replace the "@" with "%40". ) Key: GIT_URL Value: (HTTPS GIT URL. For example, "bitbucket.org/urban_dash/urban-utils.git" )
9e. Save.
9f. Go to Applications->Deployments (https://console.pro-us-east-1.openshift.com/console/project/fatfish-test/browse/deployments)
9g. Press "Environment"
9h. Under "Enviroment From", choose "my-python-git-credentials". (From Step 9c)
9i. Press "Save".
-
Create Persistent File Storage.
10a. Go to "Storage" (https://console.pro-us-east-1.openshift.com/console/project/fatfish-test/browse/storage)
10b. Press "Create Storage".
10c. (More info: https://docs.openshift.com/online/pro/architecture/additional_concepts/storage.html#pv-access-modes)
"Storage Class" : (Whatever you like) "Name" : My-Python-Disk "Size" : 2GB
10d. Press "Create".
-
Attach our new storage to our Instance. (This will create a directory "/data", within which everything is persistent.)
11a. Go to Applications->Deployments (https://console.pro-us-east-1.openshift.com/console/project/fatfish-test/browse/deployments)
11b. Choose existing image.
11c. Choose "Configuration" tab.
11d. Press "Add Storage".
11e. "Storage" : My-Python-Disk "Mount Path" : /data
11f. Press "Add".
Note: The way the Persistent Filesystem works is as follows: Anything located inside the directory "/data" (As defined in step 11e) will persist when the server is restarted.
Note: When running a local copy of Docker, if you want to run with Enviroment variables, you can run the following command: sudo docker run --env-file .env NameOfImage