This demonstration uses kustomize to deploy ghost to OpenShift.
- Install kustomize
$ brew install kustomize
-
Login to your cluster using
oc
. -
Generate a randomized password
$ ENV_PASS=$(openssl rand -hex 10)
$ echo ${ENV_PASS}
Note, save the output...
- Generate the working url for the cluster/ghost app.
$ export WEB_DOMAIN=https://web-route-ghost.$(oc get ingress.config.openshift.io cluster -o yaml | grep domain | awk '{print $NF}')
$ echo ${WEB_DOMAIN}
- Create the secret for the database
$ cat deploy/secrets/01_db_secret.yml | sed "s|ENV_PASS|${ENV_PASS}|" | oc apply -f -
- Create the configmap for the Ghost app URL.
$ cat deploy/secrets/02_web_cm.yml | sed "s|WEB_DOMAIN|${WEB_DOMAIN}|" | oc apply -f -
- Create the deployment for the website
$ oc apply -k overlays/dev
namespace/ghost configured
service/db-service unchanged
service/web unchanged
persistentvolumeclaim/db-pvc unchanged
persistentvolumeclaim/web-content unchanged
deployment.apps/ghost-db unchanged
deployment.apps/web unchanged
route.route.openshift.io/web-route unchanged
- To clean it up you can run...
$ oc delete -k overlays/dev
namespace "ghost" deleted
service "db-service" deleted
service "web" deleted
persistentvolumeclaim "db-pvc" deleted
persistentvolumeclaim "web-content" deleted
deployment.apps "ghost-db" deleted
deployment.apps "web" deleted
route.route.openshift.io "web-route" deleted
- To see your website URL, you can grab the config map.
$ oc get cm -o yaml
- Navigate to the URL, such as https://web-route-ghost.apps.xyz.zzz.zyz.com/ghost/ to start setting up your site.