add gateway automatic template and fefan vm

This commit is contained in:
2026-01-19 17:05:38 +01:00
parent d98c7b8bdb
commit f851ead7cd
56 changed files with 1243 additions and 82 deletions

View File

@@ -5,6 +5,6 @@ source /opt/gitea/env.sh
TIMESTAMP=$(date +'%Y-%m-%d_%H%M%S')
sudo -u "$GITEA_USER" gitea dump -c "$GITEA_HOME/app.ini" -f $GITEA_BACKUPS_DIR/gitea-dump-\$TIMESTAMP.zip
sudo -u "$GITEA_USER" gitea dump -c "$GITEA_HOME/app.ini" -f $GITEA_BACKUPS_DIR/gitea-dump-$TIMESTAMP.zip
ls -1dt $GITEA_BACKUPS_DIR/gitea-dump-*.zip | tail -n +5 | xargs -r rm -f

View File

@@ -1,12 +1,4 @@
#!/bin/bash
set -euo pipefail
GITEA_HOME="/var/lib/gitea"
GITEA_CONF="$GITEA_HOME/app.ini"
GITEA_USER="git"
GITEA_VERSION="1.25.3"
GITEA_BINARY="/usr/local/bin/gitea"
GITEA_SERVICE="/etc/systemd/system/gitea.service"
DB_NAME="giteadb"
DB_USER="gitea"
GITEA_BACKUPS_DIR="/backups/gitea"
set -a
[ -f /opt/gitea/gitea.env ] && source /opt/gitea/gitea.env
set +a

View File

@@ -21,6 +21,12 @@ mkdir -p $GITEA_HOME/{custom,data,log}
chown -R $GITEA_USER:$GITEA_USER $GITEA_HOME
chmod -R 750 $GITEA_HOME
mkdir -p /home/$GITEA_USER/.ssh
touch /home/$GITEA_USER/.ssh/authorized_keys
chown -R $GITEA_USER:$GITEA_USER /home/$GITEA_USER/.ssh
chmod 700 /home/$GITEA_USER/.ssh
chmod 600 /home/$GITEA_USER/.ssh/authorized_keys
if [ ! -f $GITEA_BINARY ]; then
wget -O /tmp/gitea "https://dl.gitea.com/gitea/$GITEA_VERSION/gitea-$GITEA_VERSION-linux-amd64"
chmod +x /tmp/gitea
@@ -67,6 +73,7 @@ INTERNAL_TOKEN = $GITEA_INTERNAL_TOKEN
[server]
DOMAIN = gitea.aldon.fr
SSH_AUTHORIZED_KEYS = /home/git/.ssh/authorized_keys
HTTP_PORT = 3000
ROOT_URL = https://gitea.aldon.fr
DISABLE_SSH = false
@@ -89,5 +96,9 @@ chmod 640 $GITEA_CONF
systemctl daemon-reload
systemctl enable gitea
sudo -u git gitea --config $GITEA_CONF admin regenerate keys
systemctl is-active --quiet gitea || systemctl start gitea
echo "---- Gitea installation completed ----"