mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-09 13:06:45 +03:00
refactor: update Proxmox LXC deployment instructions and replace deprecated script
This commit is contained in:
@@ -20,8 +20,8 @@ docker compose --profile production up -d
|
|||||||
bun run setup && bun run dev
|
bun run setup && bun run dev
|
||||||
|
|
||||||
# Using LXC Containers
|
# Using LXC Containers
|
||||||
# For Proxmox VE (online)
|
# For Proxmox VE (online) - Community script by Tobias ([CrazyWolf13](https://github.com/CrazyWolf13))
|
||||||
curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-proxmox.sh | bash
|
curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/gitea-mirror-install.sh | bash
|
||||||
|
|
||||||
# For local testing (offline-friendly)
|
# For local testing (offline-friendly)
|
||||||
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
|
||||||
@@ -175,8 +175,9 @@ Gitea Mirror offers two deployment options for LXC containers:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# One-command installation on Proxmox VE
|
# One-command installation on Proxmox VE
|
||||||
# Optional env overrides: CTID HOSTNAME STORAGE DISK_SIZE CORES MEMORY BRIDGE IP_CONF
|
# Uses the community-maintained script by Tobias ([CrazyWolf13](https://github.com/CrazyWolf13))
|
||||||
curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-proxmox.sh | bash
|
# at [community-scripts/ProxmoxVED](https://github.com/community-scripts/ProxmoxVED)
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/gitea-mirror-install.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
**2. Local testing (offline-friendly, works on developer laptops)**
|
**2. Local testing (offline-friendly, works on developer laptops)**
|
||||||
|
|||||||
@@ -18,17 +18,18 @@ Run **Gitea Mirror** in an isolated LXC container, either:
|
|||||||
### One-command install
|
### One-command install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# optional env overrides: CTID HOSTNAME STORAGE DISK_SIZE CORES MEMORY BRIDGE IP_CONF
|
# Community-maintained script for Proxmox VE by Tobias ([CrazyWolf13](https://github.com/CrazyWolf13))
|
||||||
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/arunavo4/gitea-mirror/main/scripts/gitea-mirror-lxc-proxmox.sh)"
|
# at [community-scripts/ProxmoxVED](https://github.com/community-scripts/ProxmoxVED)
|
||||||
|
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/gitea-mirror-install.sh)"
|
||||||
```
|
```
|
||||||
|
|
||||||
What it does:
|
What it does:
|
||||||
|
|
||||||
* Creates **privileged** CT `$CTID` with nesting enabled
|
* Uses the community-maintained script from ProxmoxVED
|
||||||
* Installs curl / git / Bun (official installer)
|
* Installs dependencies and Bun runtime
|
||||||
* Clones & builds `arunavo4/gitea-mirror`
|
* Clones & builds `arunavo4/gitea-mirror`
|
||||||
* Writes a root-run systemd service and starts it
|
* Creates a systemd service and starts it
|
||||||
* Prints the container IP + random `JWT_SECRET`
|
* Sets up a random `JWT_SECRET` for security
|
||||||
|
|
||||||
Browse to:
|
Browse to:
|
||||||
|
|
||||||
|
|||||||
@@ -107,9 +107,11 @@ bun scripts/make-events-old.ts
|
|||||||
|
|
||||||
### LXC Container Deployment
|
### LXC Container Deployment
|
||||||
|
|
||||||
Two scripts are provided for deploying Gitea Mirror in LXC containers:
|
Two deployment options are available for LXC containers:
|
||||||
|
|
||||||
1. **gitea-mirror-lxc-proxmox.sh**: For online deployment on a Proxmox VE host
|
1. **Proxmox VE (online)**: Using the community-maintained script by Tobias ([CrazyWolf13](https://github.com/CrazyWolf13))
|
||||||
|
- Author: Tobias ([CrazyWolf13](https://github.com/CrazyWolf13))
|
||||||
|
- Available at: [community-scripts/ProxmoxVED](https://github.com/community-scripts/ProxmoxVED/blob/main/install/gitea-mirror-install.sh)
|
||||||
- Pulls everything from GitHub
|
- Pulls everything from GitHub
|
||||||
- Creates a privileged container with the application
|
- Creates a privileged container with the application
|
||||||
- Sets up systemd service
|
- Sets up systemd service
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# gitea-mirror-lxc-proxmox.sh
|
|
||||||
# Fully online installer for a Proxmox LXC guest running Gitea Mirror + Bun.
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# ────── adjustable defaults ──────────────────────────────────────────────
|
|
||||||
CTID=${CTID:-106} # container ID
|
|
||||||
HOSTNAME=${HOSTNAME:-gitea-mirror}
|
|
||||||
STORAGE=${STORAGE:-local-lvm} # where rootfs lives
|
|
||||||
DISK_SIZE=${DISK_SIZE:-8G}
|
|
||||||
CORES=${CORES:-2}
|
|
||||||
MEMORY=${MEMORY:-2048} # MiB
|
|
||||||
BRIDGE=${BRIDGE:-vmbr0}
|
|
||||||
IP_CONF=${IP_CONF:-dhcp} # or "192.168.1.240/24,gw=192.168.1.1"
|
|
||||||
|
|
||||||
PORT=4321
|
|
||||||
JWT_SECRET=$(openssl rand -hex 32)
|
|
||||||
|
|
||||||
REPO="https://github.com/arunavo4/gitea-mirror.git"
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
TEMPLATE='ubuntu-22.04-standard_22.04-1_amd64.tar.zst'
|
|
||||||
TEMPLATE_PATH="/var/lib/vz/template/cache/${TEMPLATE}"
|
|
||||||
|
|
||||||
echo "▶️ Ensuring template exists…"
|
|
||||||
if [[ ! -f $TEMPLATE_PATH ]]; then
|
|
||||||
pveam update >/dev/null
|
|
||||||
pveam download "$STORAGE" "$TEMPLATE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "▶️ Creating container $CTID (if missing)…"
|
|
||||||
if ! pct status "$CTID" &>/dev/null; then
|
|
||||||
pct create "$CTID" "$TEMPLATE_PATH" \
|
|
||||||
--rootfs "$STORAGE:$DISK_SIZE" \
|
|
||||||
--hostname "$HOSTNAME" \
|
|
||||||
--cores "$CORES" --memory "$MEMORY" \
|
|
||||||
--net0 "name=eth0,bridge=$BRIDGE,ip=$IP_CONF" \
|
|
||||||
--features nesting=1 \
|
|
||||||
--unprivileged 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
pct start "$CTID"
|
|
||||||
|
|
||||||
echo "▶️ Installing base packages inside CT $CTID…"
|
|
||||||
pct exec "$CTID" -- bash -c 'apt update && apt install -y curl git build-essential openssl sqlite3 unzip'
|
|
||||||
|
|
||||||
echo "▶️ Installing Bun runtime…"
|
|
||||||
pct exec "$CTID" -- bash -c '
|
|
||||||
export BUN_INSTALL=/opt/bun
|
|
||||||
curl -fsSL https://bun.sh/install | bash -s -- --yes
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bun
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bunx
|
|
||||||
bun --version
|
|
||||||
'
|
|
||||||
|
|
||||||
echo "▶️ Cloning & building Gitea Mirror…"
|
|
||||||
pct exec "$CTID" -- bash -c "
|
|
||||||
git clone --depth=1 '$REPO' /opt/gitea-mirror || (cd /opt/gitea-mirror && git pull)
|
|
||||||
cd /opt/gitea-mirror
|
|
||||||
bun install
|
|
||||||
bun run build
|
|
||||||
bun run manage-db init
|
|
||||||
"
|
|
||||||
|
|
||||||
echo "▶️ Creating systemd service…"
|
|
||||||
pct exec "$CTID" -- bash -c "
|
|
||||||
cat >/etc/systemd/system/gitea-mirror.service <<SERVICE
|
|
||||||
[Unit]
|
|
||||||
Description=Gitea Mirror
|
|
||||||
After=network.target
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/opt/gitea-mirror
|
|
||||||
ExecStart=/usr/local/bin/bun dist/server/entry.mjs
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
Environment=HOST=0.0.0.0
|
|
||||||
Environment=PORT=$PORT
|
|
||||||
Environment=DATABASE_URL=file:data/gitea-mirror.db
|
|
||||||
Environment=JWT_SECRET=$JWT_SECRET
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
SERVICE
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable gitea-mirror
|
|
||||||
systemctl restart gitea-mirror
|
|
||||||
"
|
|
||||||
|
|
||||||
echo -e "\n🔍 Service status:"
|
|
||||||
pct exec "$CTID" -- systemctl status gitea-mirror --no-pager | head -n15
|
|
||||||
|
|
||||||
GUEST_IP=$(pct exec "$CTID" -- hostname -I | awk '{print $1}')
|
|
||||||
echo -e "\n🌐 Browse to: http://$GUEST_IP:$PORT\n"
|
|
||||||
echo "🗝️ JWT_SECRET = $JWT_SECRET"
|
|
||||||
echo -e "\n✅ Done – Gitea Mirror is running in CT $CTID."
|
|
||||||
@@ -104,7 +104,6 @@ gitea-mirror/
|
|||||||
├── data/ # Database and persistent data
|
├── data/ # Database and persistent data
|
||||||
├── docker/ # Docker configuration
|
├── docker/ # Docker configuration
|
||||||
└── scripts/ # Utility scripts for deployment and maintenance
|
└── scripts/ # Utility scripts for deployment and maintenance
|
||||||
├── gitea-mirror-lxc-proxmox.sh # Proxmox LXC deployment script
|
|
||||||
├── gitea-mirror-lxc-local.sh # Local LXC deployment script
|
├── gitea-mirror-lxc-local.sh # Local LXC deployment script
|
||||||
└── manage-db.ts # Database management tool
|
└── manage-db.ts # Database management tool
|
||||||
```
|
```
|
||||||
@@ -114,7 +113,7 @@ gitea-mirror/
|
|||||||
Gitea Mirror supports multiple deployment options:
|
Gitea Mirror supports multiple deployment options:
|
||||||
|
|
||||||
1. **Docker**: Run as a containerized application using Docker and docker-compose
|
1. **Docker**: Run as a containerized application using Docker and docker-compose
|
||||||
2. **LXC Containers**: Deploy in Linux Containers (LXC) on Proxmox VE or local workstations
|
2. **LXC Containers**: Deploy in Linux Containers (LXC) on Proxmox VE (using community script by [Tobias/CrazyWolf13](https://github.com/CrazyWolf13)) or local workstations
|
||||||
3. **Native**: Run directly on the host system using Bun runtime
|
3. **Native**: Run directly on the host system using Bun runtime
|
||||||
|
|
||||||
Each deployment method has its own advantages:
|
Each deployment method has its own advantages:
|
||||||
|
|||||||
Reference in New Issue
Block a user