DEV Community

Cover image for How to Backup and Restore GitHub Enterprise Server with GitHub Actions Enabled
GitProtect Team for GitProtect

Posted on • Updated on • Originally published at gitprotect.io

How to Backup and Restore GitHub Enterprise Server with GitHub Actions Enabled

Each of us, more or less, uses various services or software during our daily work. Especially in IT, we are confused with a huge number of products, libraries, frameworks, or services. But is this a bad thing? That’s why these tools exist, to use them. Transportation companies use trucks or container ships, after all, they don’t carry goods on their backs. It’s the same in the software development industry – let’s use existing solutions to do things better and faster.

GitHub Enterprise Server
One of the most popular collaboration tools for Git is GitHub. According to their databases, there are around 83 million users (mid of 2022) and their number is constantly increasing. The future of this tool looks bright thanks to the continuous development of new functionalities, such as GitHub Actions. Currently, it is not only a repository of our code but also a tool for CI/CD and teamwork by using Wikis, Issues, and so on.

GitHub Enterprise is much more than the basic version. It is an advanced collaboration tool that provides security, compliance, or flexible deployment features. Actually, it is an on-premise version of GitHub. What is GitHub Enterprise Server? In short, it is a self-hosted platform for software development, and thanks to that we can manage security policies, access controls, and do a number of other tasks on our own.

With Enterprise Server in place, we have the ability to relatively easily create a backup and a restore plan for our instance. The quickest way to do this is to use something called GitHub Enterprise Server Backup Utilities. In short, it is a backup system installed on a separate host. Such a system takes backup snapshots at defined intervals and on its basis, we can restore the Server instance if needed. You can read more about it here.

GitHub Actions

I have mentioned this functionality before. Nowadays, I can’t imagine working professionally with GitHub without using Actions, although on the bright side, it is a quite new feature and still under development. In hindsight, competing products for this Microsoft tool had one advantage, namely, other services were better equipped to integrate and manage CI/CD processes. However, it was only a matter of time before we would see such support here as well. It appeared a few years ago precisely in the form of GitHub Actions.

At this point, I recommend reading this article. There we can find some useful information related to this service and its use, for example, dependency graph and Dependabot alerts. However, we can do many more interesting things. A good idea is to create backups with GitHub Actions enabled. With proper configuration, we can build nice workflows to increase automation in our projects. I would refer to the official documentation, which will help us create the right actions.

GitHub Enterprise Server and GitHub Actions usage

It is crucial to know that GitHub Actions uses external storage to store workflow artifacts and logs. This storage needs to be set up by us, but what is crucial here is that Enterprise Server backups or High Availability configurations are separated from the aforementioned data and we need to take care of them separately.

Let’s look now at how we can include Actions during the restore to a new appliance. These steps and example ghe-config commands can be found in the official documentation but let me do a quick overview:

  • shut down an original appliance
  • configure network settings on the replacement GitHub Enterprise server appliance
  • NOTE: network settings are excluded from the backup snapshot
  • configure the replacement appliance to use the same GitHub Actions external storage as the original one

Example for Amazon S3:

scripts-1
Source: GitHub

  • Enable GitHub Actions on the replacement appliance:

scripts-2
Source: GitHub

  • use ghe-restore command to restore the data
  • update self-hosted runners if needed

So, as you can see it is not a very long list. However, we must be careful with every step, especially with proper configuration or connection details. We must not make a mistake, give the details of the right instances, and on the right appliances perform the steps. Ok, maybe it is not rocket science, though every manual configuration needs special attention and verification.

GitHub Enterprise Server with GitProtect

GitProtect is a new-generation backup solution focused on DevOps tools. It presents a holistic approach to data protection. GitProtect provides your organization with advanced GitHub backup&restore, real Disaster Recovery, detailed auditing, central monitoring, and the best security. In other words, all your organization needs to become SOC 2 and ISO compliance-ready. Security comes first – and that’s exactly what modern data protection should offer.

Summary

GitHub Actions is not enabled for GitHub Enterprise Server by default. We must keep in mind that we have to manually set the appropriate configuration ourselves and provide the necessary data. The first configuration may also involve an infrastructure update to fulfill CPU and memory requirements. Many issues may appear, so we need to be doubly careful. These types of situations should always remind us how crucial and essential it is for us to take care of the backup and restoration plan. Especially in situations when we make a mistake ourselves and expose ourselves to problems at our own request.

✍️ Subscribe to GitProtect DevSecOps X-Ray Newsletter – your guide to the latest DevOps & security insights

🚀 Ensure compliant DevOps backup and recovery with a 14-day free trial

📅 Let’s discuss your needs and see a live product tour

Top comments (0)