Compare commits

..

1 Commits

Author SHA1 Message Date
Marius Meyer
97bd47a03d gitea v1.21.0 entfernt die database CHARSET option
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 12s
2024-03-01 18:53:34 +01:00
8 changed files with 43 additions and 79 deletions

View File

@ -1,6 +0,0 @@
offline: false
warn_list:
- yaml[line-length]
- yaml[empty-lines]
- yaml[new-line-at-end-of-file]

View File

@ -1,5 +1,5 @@
name: ansible-lint
on: [push, pull_request] # yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
@ -14,7 +14,7 @@ jobs:
- name: Run ansible-lint
# replace `main` with any valid ref, or tags like `v6`
uses: https://github.com/ansible/ansible-lint-action@v6
uses: https://github.com/ansible/ansible-lint-action@main
# optional:
# with:
# path: "playbooks/" # <-- only one value is allowed

View File

@ -5,10 +5,11 @@
listen:
- Backup Gitea
- name: Stop Gitea for backup
community.docker.docker_compose_v2:
- name: Stop Gitea for Backup
community.docker.docker_compose:
project_src: /opt/gitea
state: stopped
state: present
stopped: true
register: docker_compose
listen:
- Backup Gitea
@ -16,10 +17,10 @@
- Ensure Gitea is running
when: docker_compose_stat.stat.exists is defined and docker_compose_stat.stat.exists
- name: Backup Gitea directory
- name: Backup Gitea Directory
community.general.archive:
path: "{{ gitea_vars.base_path }}/"
dest: "/var/backups/gitea-{{ gitea.hostname }}.{{ gitea.domain }}@{{ lookup('pipe', 'date -u +%Y-%m-%dT%H:%M:%SZ') }}.tar.gz"
path: /opt/gitea/
dest: "/var/backups/gitea-{{ gitea.hostname }}.{{ gitea.domain }}@{{ lookup('pipe', 'date --utc --iso-8601=seconds') }}.tar.gz"
force_archive: true
format: gz
owner: root

View File

@ -1,24 +1,19 @@
- name: Import backup handler
- name: Import Backup Handler
ansible.builtin.import_tasks:
file: backup.yaml
- name: Ensure Docker images are up to date
community.docker.docker_compose_v2_pull:
project_src: /opt/gitea
- name: Ensure Gitea is restarted
community.docker.docker_compose_v2:
community.docker.docker_compose:
project_src: /opt/gitea
state: restarted
recreate: always
restarted: true
register: docker_compose
- name: Ensure Gitea is running
community.docker.docker_compose_v2:
community.docker.docker_compose:
project_src: /opt/gitea
register: docker_compose
- name: Get Gitea HTTP response
- name: Get Gitea HTTP Response
ansible.builtin.uri:
url: "https://{{ gitea.hostname }}.{{ gitea.domain }}"
register: gitea_http_response
@ -32,6 +27,6 @@
retries: 30
delay: 2
- name: Output docker compose state
- name: Output Docker Compose State
ansible.builtin.debug:
var: docker_compose

View File

@ -1,8 +0,0 @@
# actions/run-ansible-lint forces me to name this file .yml instead of .yaml :(
collections:
- name: community.docker
source: https://galaxy.ansible.com
- name: community.general
source: https://galaxy.ansible.com

View File

@ -5,43 +5,40 @@
# - docker.io
# - python3-docker
- name: Ensure git user exists
- name: Create git USER
ansible.builtin.user:
name: git
register: git_user
- name: Ensure Gitea directories exist
- name: Create Gitea
ansible.builtin.file:
path: "{{ item }}"
path: "/opt/gitea"
state: directory
owner: root
mode: "755"
with_items: ["/opt/gitea", "{{ gitea_vars.base_path }}"]
- name: Ensure data and config directories exist
- name: Create Data Directory
ansible.builtin.file:
path: "{{ gitea_vars.base_path }}/{{ item }}"
path: "/opt/gitea/data"
state: directory
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: "700"
with_items: ["data", "config"]
- name: Ensure docker daemon is started
- name: Create Config Directory
ansible.builtin.file:
path: "/opt/gitea/config"
state: directory
owner: "{{ git_user.uid }}"
group: "{{ git_user.group }}"
mode: "700"
- name: Start Docker Daemon
ansible.builtin.systemd:
name: docker
enabled: true
state: started
- name: Ensure old backups will get deleted
ansible.builtin.cron:
name: gitea backup cleanup
minute: "0"
hour: "8"
user: root
job: find /var/backups -path '/var/backups/gitea-*' -mtime +7 -type f -exec rm {} +
cron_file: gitea-backup-cleanup
- name: Check if environment.env will get changed
ansible.builtin.template:
src: environment.env.j2
@ -64,10 +61,10 @@
notify:
- Backup Gitea
- name: Execute handlers before changing configfiles
- name: Execute Handlers before changing configfiles
ansible.builtin.meta: flush_handlers
- name: Upload environment.env
- name: Upload Environment File
ansible.builtin.template:
src: environment.env.j2
dest: "/opt/gitea/environment.env"
@ -84,7 +81,6 @@
owner: root
mode: "600"
notify:
- Ensure Docker images are up to date
- Output docker compose state
- Output Docker Compose State
- Ensure Gitea is restarted
- Wait until Gitea is up

View File

@ -4,6 +4,8 @@
# -- Diese Datei wird via Ansible verwaltet und automatisch überschrieben!
# https://azubi-gitea.int.sernet.de/mmeyer/ansible-role-gitea/src/branch/main/templates/docker-compose.yaml.j2
version: "3.8"
networks:
gitea:
external: false
@ -11,10 +13,10 @@ networks:
services:
gitea:
image: gitea/gitea:{{ gitea_vars['version'] }}-rootless
restart: unless-stopped
restart: always
volumes:
- {{ gitea_vars.base_path }}/data:/var/lib/gitea
- {{ gitea_vars.base_path }}/config:/etc/gitea
- ./data:/var/lib/gitea
- ./config:/etc/gitea
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
@ -29,7 +31,7 @@ services:
db:
image: "{{ gitea_vars['database']['db_type'] }}:{{ gitea_vars['database']['docker_image_tag'] }}"
restart: unless-stopped
restart: always
environment:
- "MYSQL_DATABASE={{ gitea_vars.database.name }}"
- "MYSQL_USER={{ gitea_vars.database.user }}"
@ -38,6 +40,5 @@ services:
networks:
- gitea
volumes:
- {{ gitea_vars.base_path }}/mysql:/var/lib/mysql
cap_add:
- SYS_NICE
- ./mysql:/var/lib/mysql

View File

@ -184,7 +184,7 @@ GITEA__attachment__MINIO_BASE_PATH={{ gitea_vars.attachment.minio_base_path }}
GITEA__attachment__MINIO_USE_SSL={{ gitea_vars.attachment.minio_use_ssl }}
{% endif %}
{% endif %} {# /attachment #}
{# Disabled logging for now
{% if 'log' in gitea_vars %}
{% if 'root_path' in gitea_vars['log'] %}
GITEA__log__ROOT_PATH={{ gitea_vars.log.root_path }}
@ -205,7 +205,7 @@ GITEA__log__ENABLE_log_LOG={{ gitea_vars.log.enable_log_log }}
GITEA__log__ENABLE_XORM_LOG={{ gitea_vars.log.enable_xorm_log }}
{% endif %}
{% endif %} {# /logging#}
#}
{% if 'ssh' in gitea_vars %}
{% if 'minimum_key_sizes' in gitea_vars['ssh'] %}
{% if 'ed25519' in gitea_vars['ssh']['minimum_key_sizes'] %}
@ -302,18 +302,3 @@ GITEA__actions__ENABLED={{ gitea_vars.actions.enabled }}
GITEA__actions__DEFAULT_ACTIONS_URL={{ gitea_vars.actions.default_actions_url }}
{% endif %}
{% endif %} {# /actions #}
{% if 'metrics' in gitea_vars %}
{% if 'enabled' in gitea_vars['metrics'] %}
GITEA__metrics__ENABLED={{ gitea_vars.metrics.enabled }}
{% endif %}
{% if 'enabled_issue_by_label' in gitea_vars['metrics'] %}
GITEA__metrics__ENABLED_ISSUE_BY_LABEL={{ gitea_vars.metrics.enabled_issue_by_label }}
{% endif %}
{% if 'enabled_issue_by_repository' in gitea_vars['metrics'] %}
GITEA__metrics__ENABLED_ISSUE_BY_REPOSITORY={{ gitea_vars.metrics.enabled_issue_by_repository }}
{% endif %}
{% if 'token' in gitea_vars['metrics'] %}
GITEA__metrics__TOKEN={{ gitea_vars.metrics.token }}
{% endif %}
{% endif %} {# /actions #}