Author: admin

So …. yeah …. it didn’t happen….

So, way back in 2019, I decided I was going to start a blog. I was going to write posts regularly. I was going to take the nuggets of wisdom I’ve accumulated in a plethora of areas and share them. Not only was I going to share my knowledge but I was also going to use this medium as a way to share my interests and opinions.

None of this happened…

I could say that this was due to COVID-19 and the ensuing global pandemic that consumed 2020 but that wouldn’t be true. I actually completely forgot that this was a goal of mine as I got consumed with the other pots I had in the fire. My bad!

So, now it’s June of 2021.

I’m revisiting this goal with the intent to follow through this time. I’m going to try to put out content regularly on software engineering topics as well as my other interests like Star Trek.

Please, my friends, hold me accountable.

When I made this decision back in 2019, I felt this would be a fun endeavor and a means of catharsis. I’m excited. I know this will be great!

Looking forward to this journey!

Running Gitlab Runner from Container Station

So! I have a QNAP NAS and I finally decided that I should use it to set up a private development environment and finally get around to creating some of the MANY side projects I have rolling around in my head.

The cool thing about my QNAP is I can install QNAP’s Container Station which gives me Docker. I’m not the biggest fan of Container Station but it’s not horrible for container management in non-mission critical situations – like my new private development environment. I found a few ways to back up my instance to ensure that I don’t lose anything valuable. I might do a separate post about that later.

Through Container Station, I set up GitLab with a few clicks and was pretty much off to the races. By turning on Port Forwarding in my router, I was able connect to it outside of my LAN and push code to my instance.

So…

Now that I got Gitlab up and running, why not try and get CI/CD working?

I decided to see if I can get the Gitlab Runner up and running through Container Station so I could take advantage of Gitlab’s CI/CD. I installed the image and get it up and running. I also went through the GitLab Runner docs to configure it so my GitLab instance could see/use it.

All was well! … Then this happened when I submit a job to kick off the pipeline…

Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock

All the documentation and forums out there explain pretty quickly what the root cause of this is and how to fix it. However, all those venues assume you’re running Docker through the command line. Container Station has a few flaws. One of the major ones is that you can’t edit a lot about your containers once they’re created.

The fix for this problem is simple. Mount the host server (my QNAP)  /var/run/docker.sock file to the gitlab-runner container. In Container Station, you can’t add shared folders (mounts) after container creation. So, I had to delete my container and create a new one to see if I can mount it during creation. Then, I encountered another hurdle. The Container Station UI only let’s you mount folders that you can navigate to in their UI. Luckily, this is a pretty easy hurdle to get over.

Here’s how I got it to work!

I ssh’d into my QNAP and went to directory that I knew I could navigate to in the UI and made a symbolic link to my QNAP’s /var/run folder. Then in the UI, I selected my linked folder. I set up the Gitlab Runner once again like I had it before. BOOM! Everything worked!

I know this isn’t the most amazing solution or an amazing problem even to begin with but I was surprised at the lack of information on Container Station out there in the interwebs. That’s why I decided to write this up so that if others out there are bored and decide they want to set up their own GitLab instance using Container Station and want to do CI, they can use this hack as well.

Excelsior….