Saturday, February 27, 2021

Deploying Mabel To Production

I thought this would be the easiest step in the process outlined in the prior post. I just needed to pull the updated code from github onto the server, run composer to install all the necessary dependencies and then create the .ini file that held the environment specific configurations.

When I attempted to run composer I found out I was missing two php extensions (ext-mbstring and ext-xml). I installed each of them in turn and was eventually able to get all the way through a composer install. It's a little odd that I needed to install ext-xml as it's supposed to be installed by default. In amazon-linux-extras that's apparently not the case.


I did NOT run into the problem I had earlier where composer was choking while attempting to unzip files. As expected, this was a vagrant/virtualbox only problem. I'll share some additional details on this (now solved) problem in a future post.

Last but not least, I needed to update the ini file that contained environment specific configuration values. One of those values is the path to the service specific log file. I already knew where I wanted log files to go, but while going through this I realized I'd made a mistake during development.

The error handler for the service contains a path to a special log file for unhandled errors and exceptions. The problem here is that this path was under source control. If I set the path to the correct value on my local machine it'd be incorrect for the production server. If I set it to the correct value for the production server it'd be incorrect on my local. This value couldn't be loaded from the service configuration file because the state of the service with respect to code executing in this file is unknown. In other words, one of the cases that can route execution into this file is a malformed configuration file. 

I did some thinking and some googling around this problem and stumbled upon what become my preferred solution. Henceforth, the two external paths that this service (or any other service) depends on (the path to the project and the path to the log files) will be provided externally by the configuration files of Nginx itself.


No comments:

Post a Comment