Difference between revisions of "Install Ghost on OKD4x"
Jump to navigation
Jump to search
| (3 intermediate revisions by the same user not shown) | |||
| Line 13: | Line 13: | ||
PROJECT=ghost | PROJECT=ghost | ||
URL=$PROJECT.domain.com | URL=$PROJECT.domain.com | ||
| − | IMG= | + | IMG=ghost:latest |
DB_PASS=$(genpasswd) | DB_PASS=$(genpasswd) | ||
oc new-project $PROJECT | oc new-project $PROJECT | ||
</pre> | </pre> | ||
| + | |||
| + | [[Category:4x]] | ||
| + | [[Category:OpenShift & K8S]] | ||
=PULL SECRET= | =PULL SECRET= | ||
| Line 34: | Line 37: | ||
=DEPLOY APPLICATION= | =DEPLOY APPLICATION= | ||
<pre> | <pre> | ||
| − | oc new-app --name $PROJECT --image $IMG \ | + | oc new-app --name $PROJECT --source-secret=docker --image $IMG \ |
database__client=mysql \ | database__client=mysql \ | ||
database__connection__host=mariadb \ | database__connection__host=mariadb \ | ||
| Line 42: | Line 45: | ||
url=https://$URL | url=https://$URL | ||
</pre> | </pre> | ||
| + | |||
| + | ==ADD APPLICATION PERSISTENT STORAGE== | ||
| + | <pre> | ||
| + | oc set volumes deployment --all | ||
| + | oc set volumes deployment ghost --remove --confirm | ||
| + | oc set volume deployment/ghost --add --name=ghost-data -t pvc --claim-name=ghost-data-claim --mount-path=/var/lib/ghost/content --claim-size=5G --overwrite | ||
| + | oc set volumes deployment --all | ||
| + | </pre> | ||
| + | |||
| + | [[Category:4x]] | ||
| + | [[Category:OpenShift & K8S]] | ||
=CREATE ROUTE= | =CREATE ROUTE= | ||
Latest revision as of 07:33, 1 May 2022
Ghost blog software became pretty popular this days.
If you have a kubernetes cluster around, you can install it within seconds.
Here we go with OKD 4.10
Contents
1 ENVIRONMENT
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_=%.,: < /dev/urandom | head -c ${l} | xargs
}
PROJECT=ghost
URL=$PROJECT.domain.com
IMG=ghost:latest
DB_PASS=$(genpasswd)
oc new-project $PROJECT
2 PULL SECRET
oc create secret docker-registry docker --docker-server=docker.io --docker-username=username1 --docker-email=chris@domain.ch --docker-password=xcgsedfgsdfhgsdfg oc secrets link default docker --for=pull
3 DEPLOY DATABASE
oc process -n openshift mariadb-persistent MYSQL_DATABASE=$PROJECT MYSQL_USER=$PROJECT MYSQL_PASSWORD=$DB_PASS VOLUME_CAPACITY=5Gi | oc create -f -
4 DEPLOY APPLICATION
oc new-app --name $PROJECT --source-secret=docker --image $IMG \
database__client=mysql \
database__connection__host=mariadb \
database__connection__user=$PROJECT \
database__connection__password=$DB_PASS \
database__connection__database=$PROJECT \
url=https://$URL
4.1 ADD APPLICATION PERSISTENT STORAGE
oc set volumes deployment --all oc set volumes deployment ghost --remove --confirm oc set volume deployment/ghost --add --name=ghost-data -t pvc --claim-name=ghost-data-claim --mount-path=/var/lib/ghost/content --claim-size=5G --overwrite oc set volumes deployment --all
5 CREATE ROUTE
oc create route edge --service=ghost --hostname=$URL