|Latest 7 Posts
| Composing With Docker|
Thu, Nov 2nd 2017 8
| Hacktoberfest and More|
Tue, Oct 24th 2017 7
| Go Evergreen|
Tue, Oct 17th 2017 13
| Change is in the Air|
Fri, Sep 1st 2017 10
| Open Source Contribution|
Fri, Jun 16th 2017 6
| Docker Quick Tips|
Fri, Apr 28th 2017 4
| Notes in 9: Dev Tools Grab Bg|
Tue, Apr 4th 2017 6
| Building Java Objects From JSON|
Thu, Jan 22nd 2015 15
| Go Evergreen|
Tue, Oct 17th 2017 13
| Task Runners pt.4|
Thu, Dec 17th 2015 11
| REST is Best|
Wed, Sep 17th 2014 10
| Eric and the Quest for More Coffee, pt.2|
Fri, Jul 15th 2016 10
| Git Squash|
Thu, Oct 20th 2016 10
| Change is in the Air|
Fri, Sep 1st 2017 10
| Everything Old is New Again|
Mon, Oct 24th 2016 9
| Notes in 9: Docker + SonarQube|
Wed, Feb 24th 2016 8
| Scripting Server Upgrades|
Fri, Nov 11th 2016 8
||Scripting Server Upgrades
This one might be slight departure from my usual, but those that have followed my blogging this past year will have noticed a bit more of a leaning towards DevOps in some of my posts. This echoes a lot of what I’ve been concluding as increasingly a necessary part of development; that we need to consider a picture large enough to encompass the themes surrounding development functions and, like any good developer (DRY ~= “lazy”), automate the heck out of it.
I had previously blogged on some of the scm hosting options available, both external and self-hosted options, and my personal take on a few of them. I’ve generally gone the direction of being increasingly git-centric, which has led me to implement a GitLab instance at work. I had previously run GitLab but then switched off, as I ran into an issue that seemed to be a corrupted data store from back around the version 7.10-ish timeframe. I had also been running it natively on an Ubuntu host. When I finally came back to GitLab, this time for at work, I decided that manually installing via the scripted omnibus package just wasn’t for me; some of what I remember is that I had to jump through hoops on configuration, fighting dependencies with the Ubuntu repositories, and a surprising amount of upkeep just to upgrade. From what I’ve heard from others since then, it sounds to have smoothed out a bit, or my experience was atypical; always a likely explanation in my case, it would seem.
Another of my recent infatuations is with containerization, specifically Docker. The best part about this new GitLab server we stood up at work is the fact that my admin and I decided to roll it in a docker instance. This was meant to preclude some of the issues I had run into and provide an initial deploy of our first Docker-ized app, for hopefully an easier to upgrade process. This has held true and paid off several times over. In fact, I’ve graduated from merely copying and pasting my
docker run command into wrapping it into an
upgrade.sh shell script, so as to prevent the possibility of my mistakenly not copying or pasting correctly. This has been a great win, especially as the GitLab team is hard at work with new features and plenty of security patches coming out seemingly weekly, or faster.
Why Script Something Already Short?
In all honesty, if you’ve heard of the concept of “configuration over code”, my take on it is that we should go out of our way spend a little bit of programming effort making our code more easily configured. This may or may not match up exactly with any coding ideologies, but the important take-away is that this is all an argument for automation. Automated, or scripted, processes mean not just a reduction in time spent, but also a decrease in likelihood of human error and provides a learning opportunity for those embracing the process.
The GitLab instance I’ve settled on is not far off of the example docker command given on the GitLab site. What is different is a couple of specifics relating to our HTTPS certificates. Here’s the genericized version of the docker command at the heart of things.
The Docker Command
For those wondering, the published ports are binding the exposed ports (80 and 443) on alternate bound ports to the host OS. This then runs through a host OS Nginx reverse proxy. You can note that the executed instance is
--detached, meaning not bound to the immediate shell session (runs in the background),
--restart always is set so that it will start when the host OS is restarted (and the docker daemon starts up). Additionally, you can see our
--volume mount points which bind the local file system (in
/srv/gitlab/) to various directories contained within the docker container; these give persistence, as the upgrade process actually removes, as in deletes, the existing instance entirely, then is created again new, just quickly and consistently enough to not realy seem “new”. It also specifies that we’re going to use the “latest” corresponding tag for gitlab-ce (in the gitlab published space) from Docker Hub.
The BASH Script
Even if you aren’t accustomed to writing or reading shell scripts, you should be able to follow this pretty easily. For the most part, you can see I’m setting some variables such as the
DOCKER_SOURCE (gitlab), and
VERSION (latest). Otherwise the progression is generally to the effect of:
- pull the latest tag from Docker Hub (done while existing container is running, no harm done)
- existing container stopped and removed
- new version of container (from newly pulled tag) is started up in the same fashion, inheriting data (PostgreSQL), log folders, config, and HTTPS certificates
I even included a helpful reminder at the end of the script to watch for the migration task, which consumes a fair amount of the allowed CPU for a minute or two.
All in all, neither the task nor the scripted solution were terribly difficult, but it puts things at a high level of consistency and makes it so easy, that virtually anyone with SSH access to the host server could do the upgrade with virtually no knowledge of either docker or GitLab. To demonstrate how easy this all is, I even went so far as to snag a recording on asciinema.org, but it’s mostly just waiting for progress bars to complete, so I’m not embedding it here.
I hope this may spark some interest for someone out there. I’ve had nothing but great experiences with running GitLab in a docker container, including the couple (incredibly rare) occasions that something went wrong (generally a permissions thing, easily solved with the right command) as being able to roll back a version is pretty darned easy; one can merely replace “latest” with the previous tag as listed on Docker Hub for GitLab and re-run the
upgrade.sh for a reversion. If anyone has further questions, let me know. 🍻
Nov 11, 2016
| Recent Blog Posts
Composing With Docker|
Thu, Nov 2nd 2017 2:00p Eric McCormick
Background About a year ago, I blogged on automating server upgrades with Docker and a BASH script. This met the needs I had at the time, and worked itself out to be pretty stable. But, since I think about such things and always question my preconceptions, I went down a path of creating a Docker compose config file, something I wouldn’t have had to create from scratch by waiting a little while as one appeared as an example from GitLab. As it turns it, it was a great learning experience regardl
Hacktoberfest and More|
Tue, Oct 24th 2017 2:00p Eric McCormick
Hacktoberfest 2017 October brings many good things with it. It’s the beginning of autumnal colors here, along with some yard raking in my case. It also brings with it not just Oktoberfest, but Hacktoberfest! Hacktoberfest 2017 Hacktoberfest is a month long open source support initiative, sponsored by Digital Ocean, partnering with GitHub. It’s meant to promote open source involvement and contribution. As added incentive, if you meet the criteria, you can get a free t-shirt (and stickers).
Tue, Oct 17th 2017 4:00p Eric McCormick
Happy 🎂 Day IE 11! On the 17th of October in 2013, Internet Explorer 11 was released from Microsoft. That means that as of today, this popular* browser is now four years old and, with all respect to it, it really ought to go. Good day sir. I said good day! Evergreen Browsers What makes a browser, or any software for that matter, evergreen? Well, the basic requirements for a browser, or any piece of software for that matter, are specifically the support of automatic updates, that bring in:
Change is in the Air|
Fri, Sep 1st 2017 1:00p Eric McCormick
I’m Back What Can I Say? In Case You Missed It If you find yourself asking “where was Eric?”, this should summarize it all: Instead of trying to do everything all summer, I tend to take a break from blogging and a lot of open source endeavors over the summer. It means I can focus on family time along with yard and house projects. Ah... Summer That’s all paid off and, with fall fast approaching, I’ve found myself wanting to start those things back up; ramping up into winter when
Open Source Contribution|
Fri, Jun 16th 2017 5:00p Eric McCormick
Intro It’s time to clear some of the backlog. I started this post a few months back and it should probably be sent on its way to clear the pile of drafts I haven’t finished yet… 🤔 I have a bit of a passion for open source software. My preferred distribution of Linux has been Ubuntu since 4.10, the Warty Warthog (I was even a minor contributor on a short lived, wildly popular project that aimed at improving the Ubuntu experience early on), I’ve enjoyed most open source projects I’ve
Docker Quick Tips|
Fri, Apr 28th 2017 3:00p Eric McCormick
Docker If you have been living under a rock, Docker is pretty much amazing. If you haven’t been living under a rock, you may be getting used to the idea of Docker, but still have the occasional question. I’ve found myself using Docker in increasing amounts and complexity over the last year or so. I’ve recently decided to start recording some of the tasks I’ve found useful, some of which may be less familiar to a beginner. If you’re so inclined, check out the playlist, embedded here.
Notes in 9: Dev Tools Grab Bg|
Tue, Apr 4th 2017 1:00p Eric McCormick
Intro I’m on Notes in 9 again, with a “grab bag” of a couple of tools I’ve put together recently that may be of a varying degree of useful for other Domino + XPages developers. You don’t need these to do development, but for the right person, they may help with their development workflow. Also of note, with the upgrade to Swiper with the FP8 release of Notes + Domino Designer, the limitations previously mentioned are no longer there! This means that my second tool I talked about, node-
Custom JSON Serialization With GSON|
Mon, Jan 23rd 2017 2:00p Eric McCormick
Mon, Jan 16th 2017 3:00p Eric McCormick
Per usual, I’ve had a little break between things and decided to catch up with a bit of a summary of some recent things that each didn’t necessitate their own post.
2017 IBM Champion
For starters, I’m honored to be named an IBM Champion in Collaboration Solutions (/ Social Business) for the third time. This would be a hat trick in (ice) hockey 🏒. I’m happy to be recognized with a group of people, developers and more, who are passionate about both their work and the plat
Scripting Server Upgrades|
Fri, Nov 11th 2016 12:00a Eric McCormick
Intro This one might be slight departure from my usual, but those that have followed my blogging this past year will have noticed a bit more of a leaning towards DevOps in some of my posts. This echoes a lot of what I’ve been concluding as increasingly a necessary part of development; that we need to consider a picture large enough to encompass the themes surrounding development functions and, like any good developer (DRY ~= “lazy”), automate the heck out of it. Overview I had previously