This repository has been archived on 2026-02-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2025-03-18 20:15:05 -04:00
2024-08-01 21:16:22 -04:00
2025-03-18 20:12:55 -04:00
2024-07-12 15:39:18 -04:00
2025-03-18 20:15:05 -04:00

πŸš€ Gitea Incus Deployment Script πŸš€

This script automates the deployment of Gitea using a single Incus container with Docker Compose. It provides a simple command-line interface to create a profile, install Gitea with PostgreSQL, backup data, and update the installation.

πŸ“‹ Table of Contents

βœ… Prerequisites

  • πŸ“¦ Incus installed and configured on your system
  • πŸ”‘ Sudo or root access

πŸš€ Usage

Make the script executable:

chmod +x gitea

πŸ”§ Create Profile

Create an Incus profile for Gitea:

./gitea profile [-c cpu] [-r ram]

Options:

  • -c cpu : Specify the number of CPUs (optional, default: 2)
  • -r ram : Specify the amount of RAM in GB (optional, default: 2GB)

πŸ“¦ Install Gitea

Install Gitea and PostgreSQL using Docker Compose:

./gitea install [-p dbpassword]

Options:

  • -p dbpassword : Specify a custom database password (optional)

If no password is provided, a secure random password will be generated automatically.

πŸ’Ύ Backup Gitea

Create a backup of your Gitea installation:

./gitea backup

This will create a backup of your Gitea data and PostgreSQL database in the ./backups/ directory.

πŸ”„ Update Gitea

Update Gitea to the latest version:

./gitea update

This will pull the latest Docker images and restart the services.

βš™οΈ Configuration

You can customize the deployment by:

  1. πŸ“„ Environment File: Create a .env file in the same directory as the script to override the default settings:
CONTAINER_NAME="my-gitea"
HTTP_PORT="8080"
DB_USER="custom_user"
  1. πŸ’½ Data Volumes: By default, the script creates data volumes for persistence. You can customize the paths in the script:
incus config device add $CONTAINER_NAME gitea-data disk source=/path/to/host/storage path=/var/lib/gitea
incus config device add $CONTAINER_NAME postgres-data disk source=/path/to/host/postgres path=/var/lib/postgresql/data

πŸ” Script Behavior

  1. The script enforces the correct order of operations:
    • βœ“ Profile must be created before installation
  2. 🌐 The script will create a network named "incusbr0" if it doesn't exist
  3. πŸ’Ύ The root disk size for the Incus container is set to 20GB by default
  4. πŸ”Œ Gitea will be accessible on port 80/443, and SSH access will be on port 2222
  5. πŸ“¦ The script creates a single Incus container with nesting enabled
  6. 🐳 Docker and Docker Compose are installed inside the Incus container
  7. πŸš€ Gitea and PostgreSQL are deployed using Docker Compose within the Incus container
  8. πŸ”’ Nginx is configured as a reverse proxy with SSL via Certbot

πŸ“ Notes

  • πŸ–₯️ After installation, access Gitea through the web interface to complete the setup
  • πŸ”— The script provides the URL to access Gitea after installation
  • πŸ“Œ The latest versions of Gitea and PostgreSQL Docker images are used
  • πŸ“‚ Backups are stored in the ./backups/ directory with timestamps

πŸ› οΈ Customization

You can modify the following variables in the script or through the .env file:

Variable Description Default
CONTAINER_NAME Name of the Incus container gitea
HTTP_PORT Port for HTTP traffic 80
HTTPS_PORT Port for HTTPS traffic 443
SSH_PORT Port for SSH access 2222
PROFILE_NAME Name of the Incus profile gitea
ROOT_DISK_SIZE Size of the root disk for the container 20GB
NETWORK_NAME Name of the Incus network incusbr0
DB_USER PostgreSQL database user for Gitea gitea
DB_PASS PostgreSQL database password Generated or specified during install

❓ Troubleshooting

If you encounter any issues:

  1. πŸ”„ Check the Incus container status:

    incus list
    
  2. πŸ“‹ View the container logs:

    incus exec gitea -- docker-compose logs
    
  3. πŸ”Œ Ensure all required ports are open and not in use by other services

  4. πŸ“Š Check Gitea logs:

    incus exec gitea -- docker-compose logs server
    
  5. πŸ” Check Nginx logs:

    incus exec gitea -- cat /var/log/nginx/error.log
    
Description
Quick setup script for an gitea in a nested container utilizing incus and docker-compose.
Readme MIT 91 KiB
Languages
Shell 100%