Introduction
Recently, I embarked on the journey of upgrading our GitLab server and GitLab Runner hosted on an AWS EC2 instance. Though the process is documented, there's nothing like hands-on experience to understand the nuances. In this article, I'll share my step-by-step approach, the challenges I faced, and the commands that saved my day!
📦 Prerequisites:
- An EC2 instance with GitLab already humming along.
- A GitLab runner, tirelessly building and testing our projects.
- Trusty SSH access to the EC2 instance.
🛡️ Step 1: Backing Up Data
Before diving into the upgrade, I made sure to backup. Can't stress this enough!
GitLab:
sudo gitlab-rake gitlab:backup:create
GitLab Runner:
Backing up the runner configuration was a breeze:
cp /etc/gitlab-runner/config.toml ~/gitlab-runner-config-backup.toml
🚀 Step 2: Upgrading the GitLab Server:
Checking Available Versions:
My curiosity led me to check which versions were available:
sudo yum list available gitlab-ce --showduplicates | sort -r
Updating Repository Information:
Ensuring I had the latest repository info was crucial:
https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
The Actual Upgrade:
Choosing the desired version, I proceeded:
sudo yum install gitlab-ce-<version_number>
Verification:
Post-upgrade, I had to ensure everything was in order:
sudo gitlab-rake gitlab:env:info
🏃 Step 3: Upgrading the GitLab Runner:
Repository Update:
A quick refresh of the repository information:
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
Runner Upgrade:
With a leap of faith:
sudo yum install gitlab-runner
🔍 Step 4: Verifying the GitLab Runner Upgrade:
I made sure the runner was back on its feet:
sudo gitlab-runner restart
sudo gitlab-runner status
🚒 Step 5: Potential Rollback:
Though everything went smoothly, I was prepared for a rollback:
GitLab:
sudo gitlab-rake gitlab:backup:restore BACKUP=<backup timestamp>
GitLab Runner:
cp ~/gitlab-runner-config-backup.toml /etc/gitlab-runner/config.toml
sudo gitlab-runner restart
🌟 Conclusion:
My adventure upgrading GitLab and GitLab Runner on AWS EC2 was both challenging and rewarding. While the process is generally straightforward, it's the small nuances that make the experience unique.
To all the DevOps enthusiasts out there, always backup, stay updated, and happy coding!
Top comments (0)