62 lines
2.1 KiB
Markdown
62 lines
2.1 KiB
Markdown
# Gitea Self-Host Docker-Compose
|
|
|
|
This repository provides a complete setup for self-hosting Gitea using Docker Compose. It also includes a custom backup solution using `s3cmd` to securely store your backups in S3-compatible object storage with GPG encryption.
|
|
|
|
## Prerequisites
|
|
|
|
Before you begin, ensure you have the following installed:
|
|
|
|
- Docker
|
|
- Docker Compose
|
|
|
|
## Getting Started
|
|
|
|
### 1. Clone the Repository
|
|
|
|
### 2. Set Up Docker Compose
|
|
|
|
Ensure the `docker-compose.yml` is configured correctly with your preferred settings for Gitea and any additional services like PostgreSQL or MySQL.
|
|
|
|
### 3. Start the Gitea Service
|
|
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
This will start Gitea along with the configured services.
|
|
|
|
### 4. Custom Backup Solution
|
|
|
|
We provide a custom backup solution that uses `s3cmd` to upload your Gitea backups to an S3-compatible storage service with GPG encryption. Both `s3cmd` and GPG are included in the backup Docker container, so you do not need to install them locally.
|
|
|
|
### 4.1 Configure `s3cmd` in Docker
|
|
|
|
You need to configure `s3cmd` within the backup Docker container. This will generate the necessary configuration file that the backup script will use.
|
|
|
|
1. Run the Docker container with the volume mounted to store the configuration:
|
|
|
|
```bash
|
|
docker run --rm -it -v ./s3cfg:/root/ d3fk/s3cmd --configure
|
|
```
|
|
|
|
2. Follow the prompts to input your access key, secret key, gpg application path `/usr/bin/gpg`, gpg passphrase and other settings. The configuration file will be saved to the `s3cfg` directory in your project.
|
|
|
|
3. Extract the .s3cfg inside the s3cfg folder and change the permissions of the file to the proper user
|
|
|
|
### 4.2 Schedule Backups with Cron
|
|
|
|
You change change the backup schedule inside the Dockerfile directly. Don't forget to build the container for the change to take effect.
|
|
```bash
|
|
docker compose up -d --build
|
|
```
|
|
|
|
## Additional Resources
|
|
|
|
- [Gitea Documentation](https://docs.gitea.io/)
|
|
- [s3cmd Documentation](https://s3tools.org/s3cmd)
|
|
- [GPG Documentation](https://www.gnupg.org/documentation/)
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License.
|