week of 06 may

06 May 2019

09 may

Hokay, so. The last few weeks were devoured by a11y updates and brushing up on PHP. I’m still doing quite a bit of PHP brush up via treehouse, but we’re at the point where we need to start testing out what might work going forward with the website updates, so now it’s time to make notes on what I’m doing.

WP in docker

Y’all know how much I love docker, so it’s no surprise that I’m testing migration of our stack in docker.

Found a little gem of an article on building WP/db in docker: Local WordPress Development with Docker: 3 Easy Steps. And this worked! Besides needing to making sure the MySQL and WP admin passwords matched, everything is up and running, and now I get to install WordPress and see what breaks.

Theoretically, everything that is WP-related in roots-ualib should still work on PHP 7.2. It’s the outside apps/APIs that are the issue. I’m testing this theory in docker, but I feel like I’ve already tested it locally? My machine runs php 7.1, so wouldn’t my local WordPress install have issues if there was something wrong? It will be good to have the whole thing in isolation, though, just to be sure.

install

Once the installation screen was up, I ran through basic wp install. Went ahead and upgraded WP to version 5.2 and updated all the themes that needed updating. Just want to get everything out of the way before dumping the roots-ualib theme and content in here.

clone theme

Accessed the wp files via docker exec -it wordpress-docker_my-wp_1, navigated to wp-content/themes and tried to git clone the repo… but this container doesn’t have git. Duh. So, apt-get install git. Unable to locate package git… :cold_sweat:

Googling revealed that the apt repository hadn’t been updated yet. So I did that! apt-get update && apt-get upgrade -y then installed git apt-get install git. Also realized vim probably wasn’t installed, so I fixed that, too: apt-get install vim. Now to clone!

set up theme

I forgot about all the nonsense needed to run this damn theme. Gotta install node, bower, and grunt.

cd back to roots-ualib directory to install dependencies:

Obviously, all of these install steps need to be moved to the docker commands somehow becuase this is dumb. I know a Dockerfile can handle installing stuff, but I’m using docker-compose here… there’s gotta be a way, right?

messed it up

Surprise, surprise… something I did messed everything up! :joy: Which is why we test this shit in docker.

Using docker-compose logs -f, I can see the apache logs as they run. It’s indicating that it’s trying to reach the superGlobalPHP file on our server, which it of course can’t do from inside a container. I figured this would be an issue somewhere, but I really thought there would be more of a separation of concerns… time to debug.

errors

The fatal error was at the top of functions.php where it includes the API/app stuff for the development environment. I commented it out to see what would happen. The page and theme are both loading now, but none of the apps are working, which is what I expected would happen once I commented that stuff out.

I really thought these apps were only pulling the JSON data from the API, but I guess they must be pulling it in from the superGlobalPHP at some point… investigation time! I was right: a CORS/wp-nonce situation is blocking the HTTP request from our APIs. All is well!

helpful articles

10 may

Today has been a journey of building a LAMP stack for the testing the apps/API. I watched a few videos and tried out a few pre-built images, but the thing that ended up working best for me was this article: How to create a docker-based LAMP stack using docker-compose on Ubuntu 18.04 Bionic Beaver Linux

Now getting everything set up in there is going to be the trick. I believe I need to: