How to Backup and Restore GitHub Enterprise Server with GitHub Actions Enabled
Tags: github, backup, coding, data
Published: 2023-08-10 09:44:48

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](https://gitprotect.io/blog/github-actions-how-to-use-it-for-security-and-compliance-needs/). 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](https://gitprotect.io/blog/github-enterprise-server-overview/)? 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](https://github.com/github/backup-utils).

## 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](https://gitprotect.io/blog/github-actions-how-to-use-it-for-security-and-compliance-needs/). 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jwiv1mf0lh604vsd0n9k.png)
Source: [GitHub](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled)

- Enable GitHub Actions on the replacement appliance:

![scripts-2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fzdq0j2k17b1bpiyso9b.png)
Source: [GitHub](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/advanced-configuration-and-troubleshooting/backing-up-and-restoring-github-enterprise-server-with-github-actions-enabled)

- 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](https://gitprotect.io/gitprotect-newsletter.html?utm_source=d&utm_medium=m) – your guide to the latest DevOps & security insights

🚀 Ensure compliant [DevOps backup and recovery with a 14-day free trial](https://gitprotect.io/sign-up.html?utm_source=d&utm_medium=m)

📅 Let’s discuss your needs and [see a live product tour](https://calendly.com/d/3s9-n9z-pgc/gitprotect-live-demo?month=2024-04&utm_source=d&utm_medium=m)