premier commit
This commit is contained in:
commit
19258aa74a
9 changed files with 136 additions and 0 deletions
43
README.md
Normal file
43
README.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Role : docker_gitea
|
||||||
|
|
||||||
|
|
||||||
|
## Services fournis
|
||||||
|
|
||||||
|
- main.yml : Installation de gitea sur un serveur docker_host
|
||||||
|
- configure_reverse_proxy.yml : Configuration d'un reverse proxy préalablement installé par le role reverse_proxy
|
||||||
|
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
Fournir les variables suivantes. Par exemple :
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
docker_gitea_fqdn: git.libretic.fr
|
||||||
|
docker_gitea_data_dir: /data1
|
||||||
|
docker_gitea_service_id: gitea
|
||||||
|
docker_gitea_rp_cert: LE
|
||||||
|
docker_gitea_rp_docker_host: machine.domaine.local
|
||||||
|
docker_gitea_db_name: gitea
|
||||||
|
docker_gitea_db_user: giteadbuser
|
||||||
|
docker_gitea_db_password: mdp_de_giteadbuser
|
||||||
|
```
|
||||||
|
|
||||||
|
| Option | Valeur par défaut | Description |
|
||||||
|
|-----------------------------|-------------------|-------------------------------------------------------------------------------------------|
|
||||||
|
| docker_gitea_fqdn | | Le nom de domaine pour lequel le service gitea répond |
|
||||||
|
| docker_gitea_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service |
|
||||||
|
| docker_gitea_service_id | | Le nom de service souhaité : conditionne le nommage des volumes et le routage par traefik |
|
||||||
|
| docker_gitea_ssh_port | 222 | Le numero de port local pour l'accès à gitea par ssh |
|
||||||
|
| docker_gitea_rp_docker_host | | pour configure_reverse_proxy.yml: fqdn de la machine contenant le conteneur docker |
|
||||||
|
| docker_gitea_rp_cert | LE | Type de certificat pour le reverse proxy (LE = letsencrypt) |
|
||||||
|
| docker_gitea_db_name | | Nom de la base de données postgres pour gitea |
|
||||||
|
| docker_gitea_db_user | | Nom du user postgres propriétaire de la base de données |
|
||||||
|
| docker_gitea_db_password | | Mot du passe du user postgres |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Poursuite de l'installation dans gitea
|
||||||
|
|
||||||
|
Après le premier lancement :
|
||||||
|
- créer le compte administrateur
|
||||||
|
|
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
docker_gitea_rp_cert: LE
|
||||||
|
docker_gitea_ssh_port: "222"
|
10
handlers/main.yml
Normal file
10
handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
- name: docker-compose-up
|
||||||
|
shell: |
|
||||||
|
docker-compose up -d
|
||||||
|
args:
|
||||||
|
chdir: /opt/{{ docker_gitea_service_id }}/
|
||||||
|
|
||||||
|
- name: reverse-proxy-reload
|
||||||
|
service:
|
||||||
|
name: apache2
|
||||||
|
state: reloaded
|
11
tasks/configure_reverse_proxy.yml
Normal file
11
tasks/configure_reverse_proxy.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
- name: prepare reverse_proxy
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: /etc/apache2/vhosts.d/{{ docker_gitea_fqdn }}/
|
||||||
|
with_items:
|
||||||
|
- 0_vhost.conf
|
||||||
|
- 1_vhost_additional.conf
|
||||||
|
- 2_mds_exclusion.conf
|
||||||
|
notify: reverse-proxy-reload
|
||||||
|
|
||||||
|
|
14
tasks/main.yml
Normal file
14
tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
- name: docker directory
|
||||||
|
file:
|
||||||
|
path: /opt/{{ docker_gitea_service_id }}/
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: prepare docker-compose.yml
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: /opt/{{ docker_gitea_service_id }}/
|
||||||
|
with_items:
|
||||||
|
- docker-compose.yml
|
||||||
|
notify: docker-compose-up
|
||||||
|
|
||||||
|
|
2
templates/0_vhost.conf
Normal file
2
templates/0_vhost.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
Use vhost_HTTPS_Generic {{ docker_gitea_fqdn }} {{ docker_gitea_rp_cert }} http {{ docker_gitea_rp_docker_host }} info OpenAccessPolicy AllowCrawlerIndexing On
|
3
templates/1_vhost_additional.conf
Normal file
3
templates/1_vhost_additional.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
ProxyErrorOverride off
|
||||||
|
AllowEncodedSlashes NoDecode
|
2
templates/2_mds_exclusion.conf
Normal file
2
templates/2_mds_exclusion.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
49
templates/docker-compose.yml
Normal file
49
templates/docker-compose.yml
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
gitea:
|
||||||
|
image: gitea/gitea:1.16.5
|
||||||
|
environment:
|
||||||
|
- USER_UID=1000
|
||||||
|
- USER_GID=1000
|
||||||
|
- GITEA__database__DB_TYPE=postgres
|
||||||
|
- GITEA__database__HOST=db:5432
|
||||||
|
- GITEA__database__NAME={{ docker_gitea_db_name }}
|
||||||
|
- GITEA__database__USER={{ docker_gitea_db_user }}
|
||||||
|
- GITEA__database__PASSWD={{ docker_gitea_db_password }}
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- {{ docker_gitea_data_dir }}/{{ docker_gitea_service_id }}/gitea:/data
|
||||||
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
- "traefik.http.routers.{{ docker_gitea_service_id }}.entrypoints=web"
|
||||||
|
- "traefik.http.routers.{{ docker_gitea_service_id }}.rule=Host(`{{ docker_gitea_fqdn }}`)"
|
||||||
|
- "traefik.http.services.{{ docker_gitea_service_id }}.loadbalancer.server.port=3000"
|
||||||
|
ports:
|
||||||
|
- {{ docker_gitea_ssh_port }}:22
|
||||||
|
networks:
|
||||||
|
- gitea
|
||||||
|
- traefik
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:13
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB={{ docker_gitea_db_name }}
|
||||||
|
- POSTGRES_USER={{ docker_gitea_db_user }}
|
||||||
|
- POSTGRES_PASSWORD={{ docker_gitea_db_password }}
|
||||||
|
networks:
|
||||||
|
- gitea
|
||||||
|
volumes:
|
||||||
|
- {{ docker_gitea_data_dir }}/{{ docker_gitea_service_id }}/postgres:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
gitea:
|
||||||
|
internal: true
|
||||||
|
|
Loading…
Reference in a new issue