mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-10 13:36:45 +03:00
Update LXC deployment guide references and remove outdated documentation
This commit is contained in:
@@ -27,7 +27,7 @@ curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/
|
|||||||
sudo LOCAL_REPO_DIR=~/Development/gitea-mirror ./scripts/gitea-mirror-lxc-local.sh
|
sudo LOCAL_REPO_DIR=~/Development/gitea-mirror ./scripts/gitea-mirror-lxc-local.sh
|
||||||
````
|
````
|
||||||
|
|
||||||
See the [LXC Container Deployment Guide](docs/LXC.md).
|
See the [LXC Container Deployment Guide](scripts/README-lxc.md).
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src=".github/assets/dashboard.png" alt="Dashboard" width="80%"/>
|
<img src=".github/assets/dashboard.png" alt="Dashboard" width="80%"/>
|
||||||
@@ -199,7 +199,7 @@ Both scripts:
|
|||||||
|
|
||||||
The application includes a health check endpoint at `/api/health` for monitoring.
|
The application includes a health check endpoint at `/api/health` for monitoring.
|
||||||
|
|
||||||
See the [LXC Container Deployment Guide](docs/LXC.md) for detailed instructions.
|
See the [LXC Container Deployment Guide](scripts/README-lxc.md) for detailed instructions.
|
||||||
|
|
||||||
##### Building Your Own Image
|
##### Building Your Own Image
|
||||||
|
|
||||||
|
|||||||
131
docs/LXC.md
131
docs/LXC.md
@@ -1,131 +0,0 @@
|
|||||||
# LXC Container Deployment Guide
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
Run **Gitea Mirror** in an isolated LXC container, either:
|
|
||||||
|
|
||||||
1. **Online, on a Proxmox VE host** – script pulls everything from GitHub
|
|
||||||
2. **Offline / LAN-only, on a developer laptop** – script pushes your local checkout + Bun ZIP
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. Proxmox VE (online, recommended for prod)
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
* Proxmox VE node with the default `vmbr0` bridge
|
|
||||||
* Root shell on the node
|
|
||||||
* Ubuntu 22.04 LXC template present (`pveam update && pveam download ...`)
|
|
||||||
|
|
||||||
### One-command install
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# optional env overrides: CTID HOSTNAME STORAGE DISK_SIZE CORES MEMORY BRIDGE IP_CONF
|
|
||||||
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-installer.sh)"
|
|
||||||
```
|
|
||||||
|
|
||||||
What it does:
|
|
||||||
|
|
||||||
* Creates **privileged** CT `$CTID` with nesting enabled
|
|
||||||
* Installs curl / git / Bun (official installer)
|
|
||||||
* Clones & builds `arunavo4/gitea-mirror`
|
|
||||||
* Writes a root-run systemd service and starts it
|
|
||||||
* Prints the container IP + random `JWT_SECRET`
|
|
||||||
|
|
||||||
Browse to:
|
|
||||||
|
|
||||||
```
|
|
||||||
http://<container-ip>:4321
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. Local testing (LXD on a workstation, works offline)
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
* `lxd` installed (`sudo apt install lxd`; `lxd init --auto`)
|
|
||||||
* Your repo cloned locally – e.g. `~/Development/gitea-mirror`
|
|
||||||
* Bun ZIP downloaded once:
|
|
||||||
`https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip`
|
|
||||||
|
|
||||||
### Offline installer script
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/arunavo4/gitea-mirror.git # if not already
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-local.sh -o gitea-mirror-lxc-local.sh
|
|
||||||
chmod +x gitea-mirror-lxc-local.sh
|
|
||||||
|
|
||||||
sudo LOCAL_REPO_DIR=~/Development/gitea-mirror \
|
|
||||||
./gitea-mirror-lxc-local.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
What it does:
|
|
||||||
|
|
||||||
* Launches privileged LXC `gitea-test` (`lxc launch ubuntu:22.04 ...`)
|
|
||||||
* Pushes **Bun ZIP** + tarred **local repo** into `/opt`
|
|
||||||
* Unpacks, builds, initializes DB
|
|
||||||
* Symlinks both `bun` and `bunx` → `/usr/local/bin`
|
|
||||||
* Creates a root systemd unit and starts it
|
|
||||||
|
|
||||||
Access from host:
|
|
||||||
|
|
||||||
```
|
|
||||||
http://$(lxc exec gitea-test -- hostname -I | awk '{print $1}'):4321
|
|
||||||
```
|
|
||||||
|
|
||||||
(Optional) forward to host localhost:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo lxc config device add gitea-test mirror proxy \
|
|
||||||
listen=tcp:0.0.0.0:4321 connect=tcp:127.0.0.1:4321
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Health-check endpoint
|
|
||||||
|
|
||||||
Gitea Mirror includes a built-in health check endpoint at `/api/health` that provides:
|
|
||||||
|
|
||||||
- System status and uptime
|
|
||||||
- Database connectivity check
|
|
||||||
- Memory usage statistics
|
|
||||||
- Environment information
|
|
||||||
|
|
||||||
You can use this endpoint for monitoring your deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Basic check (returns 200 OK if healthy)
|
|
||||||
curl -I http://<container-ip>:4321/api/health
|
|
||||||
|
|
||||||
# Detailed health information (JSON)
|
|
||||||
curl http://<container-ip>:4321/api/health
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
| Check | Command |
|
|
||||||
| -------------- | ----------------------------------------------------- |
|
|
||||||
| Service status | `systemctl status gitea-mirror` |
|
|
||||||
| Live logs | `journalctl -u gitea-mirror -f` |
|
|
||||||
| Verify Bun | `bun --version && bunx --version` |
|
|
||||||
| DB perms | `chown -R root:root /opt/gitea-mirror/data` (Proxmox) |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Connecting LXC and Docker Containers
|
|
||||||
|
|
||||||
If you need your LXC container to communicate with Docker containers:
|
|
||||||
|
|
||||||
1. On your host machine, create a bridge network:
|
|
||||||
```bash
|
|
||||||
docker network create gitea-network
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Find the bridge interface created by Docker:
|
|
||||||
```bash
|
|
||||||
ip a | grep docker
|
|
||||||
# Look for something like docker0 or br-xxxxxxxx
|
|
||||||
```
|
|
||||||
|
|
||||||
3. In Proxmox, edit the LXC container's network configuration to use this bridge.
|
|
||||||
@@ -1,109 +1,117 @@
|
|||||||
# LXC Container Deployment Guide
|
# LXC Container Deployment Guide
|
||||||
|
|
||||||
This guide explains how to deploy the Gitea Mirror application on Proxmox LXC containers while keeping your existing Docker containers.
|
## Overview
|
||||||
|
Run **Gitea Mirror** in an isolated LXC container, either:
|
||||||
|
|
||||||
## Prerequisites
|
1. **Online, on a Proxmox VE host** – script pulls everything from GitHub
|
||||||
|
2. **Offline / LAN-only, on a developer laptop** – script pushes your local checkout + Bun ZIP
|
||||||
|
|
||||||
- Proxmox VE installed and configured
|
---
|
||||||
- Basic knowledge of LXC containers and Proxmox
|
|
||||||
- Access to Proxmox web interface or CLI
|
|
||||||
|
|
||||||
## Creating an LXC Container
|
## 1. Proxmox VE (online, recommended for prod)
|
||||||
|
|
||||||
1. In Proxmox web interface, create a new LXC container:
|
### Prerequisites
|
||||||
- Choose Ubuntu 22.04 as the template
|
* Proxmox VE node with the default `vmbr0` bridge
|
||||||
- Allocate appropriate resources (2GB RAM, 2 CPU cores recommended)
|
* Root shell on the node
|
||||||
- At least 10GB of disk space
|
* Ubuntu 22.04 LXC template present (`pveam update && pveam download ...`)
|
||||||
- Configure networking as needed
|
|
||||||
|
|
||||||
2. Start the container and get a shell (either via Proxmox web console or SSH)
|
### One-command install
|
||||||
|
|
||||||
## Deploying Gitea Mirror
|
```bash
|
||||||
|
# optional env overrides: CTID HOSTNAME STORAGE DISK_SIZE CORES MEMORY BRIDGE IP_CONF
|
||||||
|
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-installer.sh)"
|
||||||
|
```
|
||||||
|
|
||||||
### Option 1: One-Command Installation (Recommended)
|
What it does:
|
||||||
|
|
||||||
This method allows you to install Gitea Mirror with a single command, without having to copy files manually:
|
* Creates **privileged** CT `$CTID` with nesting enabled
|
||||||
|
* Installs curl / git / Bun (official installer)
|
||||||
|
* Clones & builds `arunavo4/gitea-mirror`
|
||||||
|
* Writes a root-run systemd service and starts it
|
||||||
|
* Prints the container IP + random `JWT_SECRET`
|
||||||
|
|
||||||
1. SSH into your LXC container:
|
Browse to:
|
||||||
```bash
|
|
||||||
ssh root@lxc-container-ip
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Run the installer script directly:
|
```
|
||||||
```bash
|
http://<container-ip>:4321
|
||||||
curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-installer.sh | bash
|
```
|
||||||
```
|
|
||||||
|
|
||||||
3. The installer will:
|
---
|
||||||
- Download the Gitea Mirror repository
|
|
||||||
- Install all dependencies including Bun
|
|
||||||
- Build the application
|
|
||||||
- Set up a systemd service
|
|
||||||
- Start the application
|
|
||||||
- Display access information
|
|
||||||
|
|
||||||
### Option 2: Manual Setup
|
## 2. Local testing (LXD on a workstation, works offline)
|
||||||
|
|
||||||
If you prefer to set up manually or the automatic script doesn't work for your environment:
|
### Prerequisites
|
||||||
|
|
||||||
1. Install dependencies:
|
* `lxd` installed (`sudo apt install lxd`; `lxd init --auto`)
|
||||||
```bash
|
* Your repo cloned locally – e.g. `~/Development/gitea-mirror`
|
||||||
apt update
|
* Bun ZIP downloaded once:
|
||||||
apt install -y curl git sqlite3 build-essential
|
`https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip`
|
||||||
```
|
|
||||||
|
|
||||||
2. Install Bun:
|
### Offline installer script
|
||||||
```bash
|
|
||||||
curl -fsSL https://bun.sh/install | bash
|
|
||||||
export BUN_INSTALL="/root/.bun"
|
|
||||||
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Clone or copy your project:
|
```bash
|
||||||
```bash
|
git clone https://github.com/arunavo4/gitea-mirror.git # if not already
|
||||||
git clone https://github.com/yourusername/gitea-mirror.git /opt/gitea-mirror
|
curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-local.sh -o gitea-mirror-lxc-local.sh
|
||||||
cd /opt/gitea-mirror
|
chmod +x gitea-mirror-lxc-local.sh
|
||||||
```
|
|
||||||
|
|
||||||
4. Build and initialize:
|
sudo LOCAL_REPO_DIR=~/Development/gitea-mirror \
|
||||||
```bash
|
./gitea-mirror-lxc-local.sh
|
||||||
bun install
|
```
|
||||||
bun run build
|
|
||||||
bun run manage-db init
|
|
||||||
```
|
|
||||||
|
|
||||||
5. Create a systemd service manually:
|
What it does:
|
||||||
```bash
|
|
||||||
nano /etc/systemd/system/gitea-mirror.service
|
|
||||||
# Add the service configuration as shown below:
|
|
||||||
|
|
||||||
[Unit]
|
* Launches privileged LXC `gitea-test` (`lxc launch ubuntu:22.04 ...`)
|
||||||
Description=Gitea Mirror
|
* Pushes **Bun ZIP** + tarred **local repo** into `/opt`
|
||||||
After=network.target
|
* Unpacks, builds, initializes DB
|
||||||
|
* Symlinks both `bun` and `bunx` → `/usr/local/bin`
|
||||||
|
* Creates a root systemd unit and starts it
|
||||||
|
|
||||||
[Service]
|
Access from host:
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/opt/gitea-mirror
|
|
||||||
ExecStart=/root/.bun/bin/bun dist/server/entry.mjs
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
User=gitea-mirror
|
|
||||||
Group=gitea-mirror
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
Environment=HOST=0.0.0.0
|
|
||||||
Environment=PORT=4321
|
|
||||||
Environment=DATABASE_URL=file:data/gitea-mirror.db
|
|
||||||
Environment=JWT_SECRET=your-secure-secret-key
|
|
||||||
|
|
||||||
[Install]
|
```
|
||||||
WantedBy=multi-user.target
|
http://$(lxc exec gitea-test -- hostname -I | awk '{print $1}'):4321
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Enable and start the service:
|
(Optional) forward to host localhost:
|
||||||
```bash
|
|
||||||
systemctl enable gitea-mirror.service
|
```bash
|
||||||
systemctl start gitea-mirror.service
|
sudo lxc config device add gitea-test mirror proxy \
|
||||||
```
|
listen=tcp:0.0.0.0:4321 connect=tcp:127.0.0.1:4321
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Health-check endpoint
|
||||||
|
|
||||||
|
Gitea Mirror includes a built-in health check endpoint at `/api/health` that provides:
|
||||||
|
|
||||||
|
- System status and uptime
|
||||||
|
- Database connectivity check
|
||||||
|
- Memory usage statistics
|
||||||
|
- Environment information
|
||||||
|
|
||||||
|
You can use this endpoint for monitoring your deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Basic check (returns 200 OK if healthy)
|
||||||
|
curl -I http://<container-ip>:4321/api/health
|
||||||
|
|
||||||
|
# Detailed health information (JSON)
|
||||||
|
curl http://<container-ip>:4321/api/health
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
| Check | Command |
|
||||||
|
| -------------- | ----------------------------------------------------- |
|
||||||
|
| Service status | `systemctl status gitea-mirror` |
|
||||||
|
| Live logs | `journalctl -u gitea-mirror -f` |
|
||||||
|
| Verify Bun | `bun --version && bunx --version` |
|
||||||
|
| DB perms | `chown -R root:root /opt/gitea-mirror/data` (Proxmox) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Connecting LXC and Docker Containers
|
## Connecting LXC and Docker Containers
|
||||||
|
|
||||||
@@ -121,32 +129,3 @@ If you need your LXC container to communicate with Docker containers:
|
|||||||
```
|
```
|
||||||
|
|
||||||
3. In Proxmox, edit the LXC container's network configuration to use this bridge.
|
3. In Proxmox, edit the LXC container's network configuration to use this bridge.
|
||||||
|
|
||||||
## Accessing the Application
|
|
||||||
|
|
||||||
Once deployed, you can access the Gitea Mirror application at:
|
|
||||||
```
|
|
||||||
http://lxc-container-ip:4321
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
- Check service status:
|
|
||||||
```bash
|
|
||||||
systemctl status gitea-mirror
|
|
||||||
```
|
|
||||||
|
|
||||||
- View logs:
|
|
||||||
```bash
|
|
||||||
journalctl -u gitea-mirror -f
|
|
||||||
```
|
|
||||||
|
|
||||||
- If the service fails to start, check permissions on the data directory:
|
|
||||||
```bash
|
|
||||||
chown -R gitea-mirror:gitea-mirror /opt/gitea-mirror/data
|
|
||||||
```
|
|
||||||
|
|
||||||
- Verify Bun is installed correctly:
|
|
||||||
```bash
|
|
||||||
bun --version
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user