update from sparkleup

This commit is contained in:
Madison Scott-Clary 2022-06-26 18:20:06 -07:00
parent 43a05fdcf5
commit 919ab78054
1 changed files with 54 additions and 0 deletions

54
work/gitea-2.md Normal file
View File

@ -0,0 +1,54 @@
[Gitea](https://gitea.io) is a source code repository based on the version control system, [Git](https://git-scm.org). While there are several self-hosted solutions available such as GitLab and Gogs, Gitea has the benefit of being light-weight and easy to run on a small server.
However, having a small server, especially in the realm of VPSes, often means being limited on space. Thankfully, many hosting providers also offer additional storage in the form of block storage or networked file storage (NFS). This gives small and medium businesses the option to save money on smaller VPS hosts for their applications while not sacrificing storage.
With Gitea and the ability to decide where your source code is stored, it's easy to ensure that your projects and files have room to expand.
## Prerequisites
Before you get started, you will need the following:
* A server running Ubuntu 20.04
* An installation of Gitea. If you'd like a quick way to get started, you can see this tutorial on [Installing Gitea on Ubuntu 20.04 Using Docker](link-goes-here). <!-- TODO -->
* An additional Linux volume; for example, DigitalOcean's [block storage volumes](https://docs.digitalocean.com/products/volumes/) attached to a Droplet.
## Step 1 — Mounting a Linux Volume
A volume can take many different forms. It could be an NFS volume, which is storage available on the network provided via a file share. Another possibility is that it takes the form of block storage via a service such as DigitalOcean's Volumes or Amazon's EBS. In both cases, storage is mounted on a system using the `mount` command.
These volumes will be visible as a device, files which live in `/dev`.
## Step 2 — Configuring Gitea to Store Data on a Linux Volume
Gitea maintains all of its repositories in a central location. This includes repositories from all users and organizations. Unless configured otherwise, all information is kept in a single directory. This directory is named `data` in default installations. For the purposes of this demo, we will be using a version of Gitea running on Docker as in the tutorial linked above.
First of all, let's see what this data directory contains. You can do this by moving to the data directory and running the `ls` command. Using the `-l` format will tell us more information about the files:
```command
cd gitea
ls -l
```
This should provide a listing that looks something like this:
```
[secondary_label Output]
total 20
drwxr-xr-x 5 root root 4096 Jun 23 22:34 ./
drwxrwxr-x 3 sammy sammy 4096 Jun 26 22:35 ../
drwxr-xr-x 5 git git 4096 Jun 23 22:42 git/
drwxr-xr-x 12 git git 4096 Jun 26 22:35 gitea/
drwx------ 2 root root 4096 Jun 23 22:34 ssh/
```
Let's break down the output of this command. It lists one file or directory per line. In this case, it lists five directories. The entry for `.` is a special entry that just means the current directory, and `..` stands for the directory one level up. You can see that the current directory is owned by the `root` user, which is the case in this instance because Docker runs as a privileged user, and the directory one level up is owned by `sammy`.
The `git` directory is important to us because it contains all of the repositories that we might want to store on a separate volume. Within it are two directories of note: the `repositories` directory contains the git repositories managed by Gitea sorted by user/organization, and the `lfs` directory contains data for Git's Large File Storage functionality. The `gitea` directory contains plenty of information that Gitea uses in the background, including archives of repositories that it creates during its normal usage, as well the database that contains information such as users and repository information used by the web service. The `ssh` directory contains various SSH keypairs that are used in Gitea's operation.
Given that all of the information stored in this directory is important to us, we will want to include the entire directory's contents on our attached volume.
### Using a new installation of Gitea
### Using an existing installation of Gitea
## Step 3 — Creating Snapshots of Volumes (optional)