updated readme
This commit is contained in:
parent
3383fa7579
commit
0a1033c65f
175
README.md
175
README.md
@ -1,101 +1,152 @@
|
|||||||
# Gitea Incus Deployment Script
|
# 🚀 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 and install Gitea with PostgreSQL.
|
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
|
## 📋 Table of Contents
|
||||||
- [Prerequisites](#prerequisites)
|
- [✅ Prerequisites](#prerequisites)
|
||||||
- [Usage](#usage)
|
- [🚀 Usage](#usage)
|
||||||
- [Create Profile](#create-profile)
|
- [🔧 Create Profile](#create-profile)
|
||||||
- [Install Gitea](#install-gitea)
|
- [📦 Install Gitea](#install-gitea)
|
||||||
- [Script Behavior](#script-behavior)
|
- [💾 Backup Gitea](#backup-gitea)
|
||||||
- [Notes](#notes)
|
- [🔄 Update Gitea](#update-gitea)
|
||||||
- [Customization](#customization)
|
- [⚙️ Configuration](#configuration)
|
||||||
- [Troubleshooting](#troubleshooting)
|
- [🔍 Script Behavior](#script-behavior)
|
||||||
|
- [📝 Notes](#notes)
|
||||||
|
- [🛠️ Customization](#customization)
|
||||||
|
- [❓ Troubleshooting](#troubleshooting)
|
||||||
|
|
||||||
## Table of Contents
|
## ✅ Prerequisites
|
||||||
- [Prerequisites](#prerequisites)
|
|
||||||
- [Usage](#usage)
|
|
||||||
- [Create Profile](#create-profile)
|
|
||||||
- [Install Gitea](#install-gitea)
|
|
||||||
- [Secure Configuration](#secure-configuration)
|
|
||||||
- [Script Behavior](#script-behavior)
|
|
||||||
- [Notes](#notes)
|
|
||||||
- [Customization](#customization)
|
|
||||||
- [Troubleshooting](#troubleshooting)
|
|
||||||
|
|
||||||
## Prerequisites
|
- 📦 Incus installed and configured on your system
|
||||||
|
- 🔑 Sudo or root access
|
||||||
|
|
||||||
- Incus installed and configured on your system
|
## 🚀 Usage
|
||||||
- Sudo or root access
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Make the script executable:
|
Make the script executable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x gitea.sh
|
chmod +x gitea
|
||||||
```
|
```
|
||||||
|
|
||||||
### Create Profile
|
### 🔧 Create Profile
|
||||||
|
|
||||||
Create an Incus profile for Gitea:
|
Create an Incus profile for Gitea:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./gitea.sh profile [-c cpu] [-r ram]
|
./gitea profile [-c cpu] [-r ram]
|
||||||
```
|
```
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
- `-c cpu`: Specify the number of CPUs (optional)
|
- `-c cpu` : Specify the number of CPUs (optional, default: 2)
|
||||||
- `-r ram`: Specify the amount of RAM in GB (optional)
|
- `-r ram` : Specify the amount of RAM in GB (optional, default: 2GB)
|
||||||
|
|
||||||
If CPU or RAM is not specified, the default Incus values will be used.
|
### 📦 Install Gitea
|
||||||
|
|
||||||
### Install Gitea
|
|
||||||
|
|
||||||
Install Gitea and PostgreSQL using Docker Compose:
|
Install Gitea and PostgreSQL using Docker Compose:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./gitea.sh install [-p dbpassword]
|
./gitea install [-p dbpassword]
|
||||||
```
|
```
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
- `-p dbpassword` : Specify a custom database password (optional)
|
- `-p dbpassword` : Specify a custom database password (optional)
|
||||||
|
|
||||||
If no password is provided, a default password will be used.
|
If no password is provided, a secure random password will be generated automatically.
|
||||||
|
|
||||||
## Script Behavior
|
### 💾 Backup Gitea
|
||||||
|
|
||||||
|
Create a backup of your Gitea installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./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"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **💽 Data Volumes**: By default, the script creates data volumes for persistence. You can customize the paths in the script:
|
||||||
|
```bash
|
||||||
|
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:
|
1. The script enforces the correct order of operations:
|
||||||
- Profile must be created before installation
|
- ✓ Profile must be created before installation
|
||||||
2. The script will create a network named "incusbr0" if it doesn't exist
|
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
|
3. 💾 The root disk size for the Incus container is set to 20GB by default
|
||||||
4. Gitea will be accessible on port 3000, and SSH access will be on port 2222
|
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
|
5. 📦 The script creates a single Incus container with nesting enabled
|
||||||
6. Docker and Docker Compose are installed inside the Incus container
|
6. 🐳 Docker and Docker Compose are installed inside the Incus container
|
||||||
7. Gitea and PostgreSQL are deployed using Docker Compose within 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
|
## 📝 Notes
|
||||||
|
|
||||||
- After installation, access Gitea through the web interface to complete the setup
|
- 🖥️ After installation, access Gitea through the web interface to complete the setup
|
||||||
- The script provides the URL to access Gitea after installation
|
- 🔗 The script provides the URL to access Gitea after installation
|
||||||
- The latest versions of Gitea and PostgreSQL Docker images are used
|
- 📌 The latest versions of Gitea and PostgreSQL Docker images are used
|
||||||
|
- 📂 Backups are stored in the `./backups/` directory with timestamps
|
||||||
|
|
||||||
## Customization
|
## 🛠️ Customization
|
||||||
|
|
||||||
You can modify the following variables at the top of the script to customize your deployment:
|
You can modify the following variables in the script or through the `.env` file:
|
||||||
|
|
||||||
- `CONTAINER_NAME`: Name of the Incus container
|
| Variable | Description | Default |
|
||||||
- `WEB_PORT`: Port for accessing Gitea web interface
|
|----------|-------------|---------|
|
||||||
- `SSH_PORT`: Port for SSH access
|
| `CONTAINER_NAME` | Name of the Incus container | `gitea` |
|
||||||
- `PROFILE_NAME`: Name of the Incus profile
|
| `HTTP_PORT` | Port for HTTP traffic | `80` |
|
||||||
- `ROOT_DISK_SIZE`: Size of the root disk for the container
|
| `HTTPS_PORT` | Port for HTTPS traffic | `443` |
|
||||||
- `NETWORK_NAME`: Name of the Incus network
|
| `SSH_PORT` | Port for SSH access | `2222` |
|
||||||
- `DB_USER`: PostgreSQL database user for Gitea
|
| `PROFILE_NAME` | Name of the Incus profile | `gitea` |
|
||||||
- `DB_PASS`: Default PostgreSQL database password (can be overridden during installation)
|
| `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
|
## ❓ Troubleshooting
|
||||||
|
|
||||||
If you encounter any issues:
|
If you encounter any issues:
|
||||||
1. Check the Incus container status: `incus list`
|
|
||||||
2. View the container logs: `incus exec gitea -- docker-compose logs`
|
1. 🔄 Check the Incus container status:
|
||||||
3. Ensure all required ports are open and not in use by other services
|
```bash
|
||||||
|
incus list
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 📋 View the container logs:
|
||||||
|
```bash
|
||||||
|
incus exec gitea -- docker-compose logs
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 🔌 Ensure all required ports are open and not in use by other services
|
||||||
|
|
||||||
|
4. 📊 Check Gitea logs:
|
||||||
|
```bash
|
||||||
|
incus exec gitea -- docker-compose logs server
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 🔍 Check Nginx logs:
|
||||||
|
```bash
|
||||||
|
incus exec gitea -- cat /var/log/nginx/error.log
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user