add gateway automatic template and fefan vm
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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 ----"
|
||||
9
modules/apps/gitea/lib/services/create-backup.service
Normal file
9
modules/apps/gitea/lib/services/create-backup.service
Normal file
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Backup Service
|
||||
Wants=network.target
|
||||
After=network.target gitea.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/backup.sh
|
||||
@@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description=Run Gitea backup weekly
|
||||
Description=Run backup weekly
|
||||
|
||||
[Timer]
|
||||
OnCalendar=Sun *-*-* 01:00:00
|
||||
@@ -1,11 +1,9 @@
|
||||
[Unit]
|
||||
Description=Restore latest Gitea backup
|
||||
Description=Restore latest backup
|
||||
After=network.target postgresql.service gitea.service
|
||||
Requires=postgresql.service gitea.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/restore-backup.sh
|
||||
WorkingDirectory=/var/lib/gitea
|
||||
TimeoutStartSec=600
|
||||
ExecStart=/usr/local/bin/restore-backup.sh
|
||||
@@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Weekly Gitea Backup
|
||||
Wants=network.target
|
||||
After=network.target gitea.service
|
||||
Before=shutdown.target reboot.target halt.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/backup.sh
|
||||
Reference in New Issue
Block a user