From e4ceefd575d2e84c1f277fc5f750d3a33826cd76 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Fri, 23 Dec 2022 21:46:30 +0100 Subject: [PATCH] Fix config for gitea log dir --- roles/gitea/files/gitea-backup.cron | 2 +- roles/gitea/tasks/main.yml | 30 +++++----------------- roles/gitea/templates/app.ini.j2 | 2 +- roles/gitea/templates/gitea_backup.sh.j2 | 6 ++--- roles/gitea_fail2ban/files/gitea-jail.conf | 2 +- 5 files changed, 13 insertions(+), 29 deletions(-) diff --git a/roles/gitea/files/gitea-backup.cron b/roles/gitea/files/gitea-backup.cron index 21154a0..5fd22fb 100644 --- a/roles/gitea/files/gitea-backup.cron +++ b/roles/gitea/files/gitea-backup.cron @@ -1 +1 @@ -0 5 * * * git USER=git /home/git/gitea_backup.sh backup >>/var/log/gitea/gitea_backup.log 2>>/var/log/gitea/gitea_backup.err.log && USER=git /home/git/gitea_backup.sh prune 2 >>/var/log/gitea/gitea_backup.log 2>>/var/log/gitea/gitea_backup.err.log +0 5 * * * git USER=git /home/git/gitea_backup.sh backup && USER=git /home/git/gitea_backup.sh prune 2 diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml index d8198bf..74e1058 100644 --- a/roles/gitea/tasks/main.yml +++ b/roles/gitea/tasks/main.yml @@ -42,36 +42,20 @@ mode: 0440 validate: /usr/sbin/visudo -csf %s -- name: Create /var/lib/gitea directory +- name: Create needed directories become: true ansible.builtin.file: - path: /var/lib/gitea - state: directory - owner: git - group: git - mode: 0750 - -- name: Create /var/lib/gitea subdirectories - become: true - ansible.builtin.file: - path: "/var/lib/gitea/{{ item }}" + path: "{{ item }}" state: directory owner: git group: git mode: 0750 with_items: - - custom - - data - - log - -- name: Create /etc/gitea directory - become: true - ansible.builtin.file: - path: /etc/gitea - state: directory - owner: git - group: git - mode: 0750 + - /etc/gitea + - /var/lib/gitea + - /var/lib/gitea/custom + - /var/lib/gitea/data + - /var/log/gitea - name: Find latest gitea version ansible.builtin.uri: diff --git a/roles/gitea/templates/app.ini.j2 b/roles/gitea/templates/app.ini.j2 index d3a39de..feca427 100644 --- a/roles/gitea/templates/app.ini.j2 +++ b/roles/gitea/templates/app.ini.j2 @@ -74,7 +74,7 @@ PROVIDER = file [log] MODE = file LEVEL = info -ROOT_PATH = /var/lib/gitea/log +ROOT_PATH = /var/log/gitea [other] SHOW_FOOTER_BRANDING = false diff --git a/roles/gitea/templates/gitea_backup.sh.j2 b/roles/gitea/templates/gitea_backup.sh.j2 index 8949257..f490283 100644 --- a/roles/gitea/templates/gitea_backup.sh.j2 +++ b/roles/gitea/templates/gitea_backup.sh.j2 @@ -12,15 +12,15 @@ INSTALL_DIR=/usr/local/bin TMP_DIR=/home/git/tmp WORK_DIR=/var/lib/gitea/ DATA_DIR=/var/lib/gitea/data/ -LOG_DIR=/var/lib/gitea/log/ +LOG_DIR=/var/log/gitea/ REPO_DIR=/home/git/gitea-repositories/ CONFIG_FILE=/etc/gitea/app.ini DUMP_DIR=/home/git/gitea-dumps MYSQL_USER={{ user_gitea_db }} MYSQL_DB={{ name_gitea_db }} MYSQL_PW={{ pass_gitea_db }} -SCRIPT_LOGFILE=/home/git/gitea_backup.log -SCRIPT_ERRLOGFILE=/home/git/gitea_backup.err +SCRIPT_LOGFILE=/var/log/gitea/gitea_backup.log +SCRIPT_ERRLOGFILE=/var/log/gitea/gitea_backup.err.log {% raw %} if [ "$USER" != git ]; then diff --git a/roles/gitea_fail2ban/files/gitea-jail.conf b/roles/gitea_fail2ban/files/gitea-jail.conf index f84565d..a04b358 100644 --- a/roles/gitea_fail2ban/files/gitea-jail.conf +++ b/roles/gitea_fail2ban/files/gitea-jail.conf @@ -1,7 +1,7 @@ [gitea] enabled = true filter = gitea -logpath = /var/lib/gitea/log/gitea.log +logpath = /var/log/gitea/gitea.log maxretry = 10 findtime = 3600 bantime = 900