In my role at Highland, I do a lot of things. Developing, light project managing, and some remote tech support since COVID kicked off. Near the end of last year, I also started helping with our DevOps practice. Since then, I’ve learned countless things assisting our DevOps guru, Stu.
Through my work with Stu and the DevOps team I’ve learned a little bit of this and a little bit of that, and at this point, I’m comfortable standing up a new LAMP server and connecting it to our different services. I’m also fairly proficient in Vim, which is something I never thought I would say.
So when I decided to set up a small server for a personal project, I thought it would be a piece of cake. I just needed to install a simple PHP application on a server. What could go wrong? I had done this before and on a bigger scale. Once I got into the setup, however, I found myself repeatedly hitting walls.
Try to set up the server? Hit a wall.
Google my issue? Hit another wall.
Try a new approach, hit a wall. Rinse, repeat.
The Goal: set up an ERP for household management
I’ve been using BigOven for the past year to manage recipes and grocery lists. I like the structure, but the service hasn’t quite been doing it for me, and their API is fairly costly, so I couldn’t just make my own interface. I went looking for an alternative and I found Grocy.
Grocy is definitely the maximalist approach to grocery and home management. Describing itself as an “ERP beyond your fridge,” it is a “web-based self-hosted groceries & household management solution for your home.” It mimics large scale enterprise resource planning, but for things around your house.
Grocy has been under development for several years now and has several different useful modules. I’m particularly interested in chore management, which is a project I’ve attempted myself. Grocy is open source and has a robust API, so if I think any features are missing, I can add them myself, and I can integrate it with any other service. If this can’t fit all my needs, who knows what can.
Take 1: Google Cloud + Ubuntu + Nginx
So now that I’ve decided to get myself a copy of Grocy, it is time to set up hosting and get it running. I started with nothing but a domain name that I hadn’t done anything with for years. I’d recently received an offer from Google for $300 worth of hosting, so thought I would start there with their Cloud Platform.
I set up DNS and point my domain to Google. All good so far.
I started working on a VM in Google’s Compute Engine, got it set to a static IP, connected it to my domain through DNS, and connected.
I started installing the software I would need to run Grocy.
… and this is where I started running into problems.
At Highland, we use AWS for hosting, CentOS for the operating system, and Apache (httpd) for a web server. So of course when I was setting off on my own I decided to use Google Cloud for hosting, Ubuntu for the OS, and Nginx for the webserver! You know, because I hate myself or something. I realized fairly early on that Nginx doesn’t have a built-in PHP interpreter like Apache, so I started Googling for how to make that work. Next, I needed to figure out how to configure Nginx to serve Grocy specifically. Then I started to see comments in the Grocy issues on Github that would come to haunt me.
“If you’re little familiar with webservers in general (and use nginx) … this is really not a special application from the technical perspective.”
“I still think grocy is a pretty normal PHP application like most of the other ones out there, so a lot of different ways to setup the details.”
I got the PHP interpreter set up, and tada! I can see my PHP test page. I downloaded a copy of Grocy, installed it in place and it started to give me its own warnings.
At this point, I’m already giving Google Search a run for its money, but that is to be expected. Each time I received a new error or a missing package, I install, enable, and configure. But now I start having problems I can’t figure out. I start trying to update different Grocy configuration settings, I can’t figure it out. Is it my server? It must be! I must have done something wrong following all those tutorials. Sometime around here I gave up for the first night, thinking I’d wrap it up the next day.
The next day, after attempting to solve the same problem, I reach a point where I decide to just start over. I had installed enough different things and played with enough configurations that I thought it would be good to have a fresh slate.
Sometimes, you just have to start over | Gif by @RobertEBlackmon
Take 2: Google Cloud + Ubuntu + Apache
Somewhere along the line, I found a Github Issue where someone had gotten the installation working with Apache, so I decide to give it a shot in a new direction. Of course, this means I have now lost any of the advice I’d already researched for Nginx, but this time it aligned with what I’m more used to using at work, so that should help. I got through the same process I have before, installing the necessary software, configuring the webserver. This time I also tried making sure I downloaded a stable release of Grocy. I found the most recent release and downloaded the prebuilt application. I installed whatever lingering dependencies there are.
I ran into the same problem, and I can’t figure it out. I toggle the same settings on and off. I tried to update configurations and I simply cannot figure it out!
My Google Cloud logs
Take 3 — ?: Feeling futile
At this point, I’m getting sort of desperate.
I’m moving too quickly. I keep creating VMs with the wrong name or wrong configuration.
I went back and took a look at Google Cloud’s logs, and I look like a crazy person. At some point, I finally set up a server using Centos + Apache(httpd) hoping that my work at Highland would help. I get to a point where I’ve decided that it can’t be my servers are the problem, it MUST be how I’m configuring Grocy.
I see there is a version of Grocy pre-built as a Docker image! I can’t figure out a simple server, but surely bringing containers into the picture will help.
Take N: Containers this time
Already having trouble, I decide that it makes sense to bring in another technology I have no familiarity with: Docker!
Grocy has a Docker branch at grocy/grocy-docker and I decide that maybe it will already have the configuration built out enough that I can’t mess it up!
I’ve heard of containers plenty and understand the concept, but I’ve never worked with one before. So I find myself again Googling:
“Setting up containers Google Cloud”
“Google Cloud docker”
I find a tutorial on Google that looks promising. I go about setting up all sorts of items I definitely don’t need, but sooner or later I have a Grocy image set up in the Google Cloud Container Registry and am ready to deploy. I keep following the tutorial and realize that somewhere along the line I have set up three large VMs running behind a load balancer and the Grocy configuration still isn’t working correctly. All I wanted was one tiny server!
It’s somewhere around here that I give up again, and decide to take another look another day.
Take N+1: Starting over from scratch
I go back to where I started, at the Grocy repo, checking the README. That’s when I find something that gets me to facepalm so hard my hand came out the other side:
😱 That feeling when what you were looking for is right in front of you
There it is, a whole page of links with how-tos.
Grocy’s list of community-contributed help
I follow the guide almost to the letter and find myself finally seeing a login screen. I did it! I finally did it. This shouldn’t be as exciting as it is, but I’ve built it up for weeks.
Setting other things up (or how I redeem myself)
At this point, I needed to prove to myself that I actually know what I’m doing by setting up all sorts of things to improve the server for myself.
I set up Cloud Scheduler, set up to call Pub/Sub, and connected to Cloud Functions to turn the server on and off at night to save on some VM hours/cost. (I don’t know why this has to be so complicated but ¯\(ツ)/¯ .)
(Check out my example here)
I set up a headless Dropbox installation to backup the database from Grocy’s data directory and wrote a simple backup rotation script to save a few day’s worths of backups in case something goes wrong.
I even started a Magic Mirror² module to display information from Grocy’s API on a smart display. Somehow I had less trouble writing a new piece of software to integrate with existing software than just setting that up in the first place.
Finally, I was happy with my installation.
Prioritizing life-long learning
In this industry, you’re constantly presented with opportunities to learn new things. I’m someone who believes in learning at least a little bit of everything. Each time you understand something new about a subject, you enhance your perspective. I’ve learned a lot in the last year about DevOps, but this experience was a reminder of how much more there is to discover, and the value of getting curious enough to solve a personal problem that will help me in the long run.
Have you tackled any personal at-home DevOps projects? Tell me about them in the comments or send me an email.