Initialise repository structure and placeholder files. Generic functionality works i guess, need to come up with a better solution for compose templates
This commit is contained in:
commit
53695f4fff
411 files changed
+7817
No files matched your search
@@ -0,0 +1,6 @@
|
||||
# gitea
|
||||
|
||||
Deploys Gitea with Docker Compose and host-configurable HTTP/SSH ports.
|
||||
|
||||
Tags: `gitea`, `config`, `compose`, `firewall`.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
gitea_dir: /srv/docker/gitea
|
||||
gitea_image: gitea/gitea:1.23
|
||||
gitea_http_port: 3000
|
||||
gitea_ssh_port: 2222
|
||||
gitea_domain: git.example.invalid
|
||||
gitea_routing_mode: "{{ nbops_service_routing_mode }}"
|
||||
gitea_traefik_network: "{{ nbops_proxy_network }}"
|
||||
gitea_traefik_entrypoint: "{{ nbops_traefik_entrypoint }}"
|
||||
gitea_traefik_tls: "{{ nbops_traefik_tls }}"
|
||||
gitea_publish_ssh: true
|
||||
gitea_env:
|
||||
USER_UID: "1000"
|
||||
USER_GID: "1000"
|
||||
GITEA__server__ROOT_URL: "https://{{ gitea_domain }}/"
|
||||
GITEA__server__SSH_PORT: "{{ gitea_ssh_port }}"
|
||||
gitea_tcp_ports:
|
||||
- "{{ gitea_http_port }}"
|
||||
- "{{ gitea_ssh_port }}"
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: restart gitea
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ gitea_dir }}"
|
||||
state: restarted
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
- name: Create Gitea directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ gitea_dir }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
tags: [gitea]
|
||||
|
||||
- name: Render Gitea environment
|
||||
ansible.builtin.template:
|
||||
src: env.j2
|
||||
dest: "{{ gitea_dir }}/.env"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
no_log: true
|
||||
tags: [gitea, config]
|
||||
|
||||
- name: Ensure Gitea proxy network exists
|
||||
community.docker.docker_network:
|
||||
name: "{{ gitea_traefik_network }}"
|
||||
state: present
|
||||
when: gitea_routing_mode == "traefik"
|
||||
tags: [gitea, docker]
|
||||
|
||||
- name: Render Gitea Compose file
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
dest: "{{ gitea_dir }}/compose.yaml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: restart gitea
|
||||
tags: [gitea, compose]
|
||||
|
||||
- name: Allow Gitea ports
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "{{ item }}"
|
||||
proto: tcp
|
||||
loop: "{{ gitea_tcp_ports }}"
|
||||
when: gitea_routing_mode == "host"
|
||||
tags: [gitea, firewall]
|
||||
|
||||
- name: Allow Gitea SSH port when published behind Traefik
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "{{ gitea_ssh_port }}"
|
||||
proto: tcp
|
||||
when:
|
||||
- gitea_routing_mode == "traefik"
|
||||
- gitea_publish_ssh | bool
|
||||
tags: [gitea, firewall]
|
||||
|
||||
- name: Start Gitea
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ gitea_dir }}"
|
||||
state: present
|
||||
tags: [gitea, compose]
|
||||
@@ -0,0 +1,33 @@
|
||||
services:
|
||||
gitea:
|
||||
image: {{ gitea_image }}
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
{% if gitea_routing_mode == "host" or gitea_publish_ssh | bool %}
|
||||
ports:
|
||||
{% if gitea_routing_mode == "host" %}
|
||||
- "{{ gitea_http_port }}:3000"
|
||||
{% endif %}
|
||||
{% if gitea_publish_ssh | bool %}
|
||||
- "{{ gitea_ssh_port }}:22"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if gitea_routing_mode == "traefik" %}
|
||||
# internal HTTP service port: 3000; not published on the Docker host
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.gitea.rule=Host(`{{ gitea_domain }}`)
|
||||
- traefik.http.routers.gitea.entrypoints={{ gitea_traefik_entrypoint }}
|
||||
- traefik.http.routers.gitea.tls={{ gitea_traefik_tls | bool | ternary('true', 'false') }}
|
||||
- traefik.http.services.gitea.loadbalancer.server.port=3000
|
||||
networks:
|
||||
- default
|
||||
- {{ gitea_traefik_network }}
|
||||
{% endif %}
|
||||
volumes:
|
||||
- ./data:/data
|
||||
{% if gitea_routing_mode == "traefik" %}
|
||||
networks:
|
||||
{{ gitea_traefik_network }}:
|
||||
external: true
|
||||
{% endif %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{% for key, value in gitea_env.items() %}
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
||||
|
||||
Reference in new issue
Block a user