As you might have guessed, this WordPress site is hosted using https://knative.dev/ (in particular, the serving component).
I’ll write up more about how this is done later, but for now, I’m going to post a quick outline of how I got this site working.
I started with this Dockerfile:
FROM wordpress:5.6 ADD nanospace /var/www/html/wp-content/themes/nanospace
And then I ran the resulting image locally and connected to the database using the web UI (maybe a bad idea, but it got things working). I then pushed the docker image to dockerhub (since it didn’t have secrets in it when I created it, just the new theme), and wrote the following Knative Service, based on the information on the DockerHub WordPress image.
apiVersion: serving.knative.dev/v1 kind: Service metadata: name: wordpress namespace: wordpress spec: template: spec: containers: - image: ekanderson/evan-nanospace env: - name: WORDPRESS_DB_HOST value: mysql-db-mysql - name: WORDPRESS_DB_PASSWORD valueFrom: secretKeyRef: name: mysql-root key: PASSWORD - name: WORDPRESS_DB_USER value: wordpress - name: WORDPRESS_DB_NAME value: wordpress_db - name: HTTP_X_FORWARDED_PROTO value: https ports: - containerPort: 80
This used my existing Knative installation to run wordpress, but I kept getting redirected to
https://....:8080, rather than loading the site. Eventually, I figured out that I needed to update the wp_options table in the database, like so:
update wp_options SET option_value = 'https://wordpress.wordpress.microkn.off-by-one.dev' WHERE option_name = 'siteurl'; update wp_options SET option_value = 'https://wordpress.wordpress.microkn.off-by-one.dev' WHERE option_name = 'home';
I’ll be updating this with more background another night… it’s almost midnight!