From 8a35c0368f78da7753e7b1d9ced4c45f9d8f90ac Mon Sep 17 00:00:00 2001 From: Arunavo Ray Date: Wed, 21 May 2025 13:58:07 +0530 Subject: [PATCH] Address Copilot suggestions for LXC installer improvements --- scripts/README-lxc.md | 23 ++++++++++++++++++++++- scripts/gitea-mirror-lxc-installer.sh | 7 ++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/scripts/README-lxc.md b/scripts/README-lxc.md index 0914589..7bb2c48 100644 --- a/scripts/README-lxc.md +++ b/scripts/README-lxc.md @@ -75,7 +75,28 @@ If you prefer to set up manually or the automatic script doesn't work for your e 5. Create a systemd service manually: ```bash nano /etc/systemd/system/gitea-mirror.service - # Add the service configuration as shown in the setup-lxc.sh script + # Add the service configuration as shown below: + + [Unit] + Description=Gitea Mirror + After=network.target + + [Service] + 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 systemctl daemon-reload systemctl enable gitea-mirror.service diff --git a/scripts/gitea-mirror-lxc-installer.sh b/scripts/gitea-mirror-lxc-installer.sh index 7625148..4a97e44 100755 --- a/scripts/gitea-mirror-lxc-installer.sh +++ b/scripts/gitea-mirror-lxc-installer.sh @@ -122,6 +122,11 @@ JWT_SECRET=${JWT_SECRET:-$(openssl rand -hex 32)} # Create systemd service echo -e "${BLUE}Step 6/7: Creating systemd service...${NC}" + +# Store Bun path in a variable for better maintainability +BUN_PATH=$(command -v bun) +echo -e "${GREEN}Using Bun from: $BUN_PATH${NC}" + cat >/etc/systemd/system/gitea-mirror.service <