Add Gitea docker role

This commit is contained in:
Kris Lamoureux 2020-07-27 23:20:50 -04:00
parent 0942a9b52c
commit 241b8715b0
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
4 changed files with 63 additions and 0 deletions

View File

@ -8,5 +8,6 @@
- docker - docker
- traefik - traefik
- nextcloud - nextcloud
- gitea
- jenkins - jenkins
- prometheus - prometheus

View File

@ -19,6 +19,12 @@ nextcloud_domain: cloud.vm.krislamo.org
nextcloud_dbversion: latest nextcloud_dbversion: latest
nextcloud_dbpass: password nextcloud_dbpass: password
# gitea
gitea_domain: git.vm.krislamo.org
gitea_version: 1
gitea_dbversion: latest
gitea_dbpass: password
# jenkins # jenkins
jenkins_version: lts jenkins_version: lts
jenkins_domain: jenkins.vm.krislamo.org jenkins_domain: jenkins.vm.krislamo.org

View File

@ -0,0 +1,10 @@
# container settings
gitea_name: gitea
gitea_dbname: "{{ gitea_name }}-db"
# database settings
gitea_dbuser: "{{ gitea_dbname }}"
# host
gitea_root: "/opt/{{ gitea_name }}/data"
gitea_dbroot: "/opt/{{ gitea_name }}/database"

View File

@ -0,0 +1,46 @@
- name: Create Gitea Network
docker_network:
name: "{{ gitea_name }}"
- name: Start Gitea's database container
docker_container:
name: "{{ gitea_dbname }}"
image: mariadb:{{ gitea_dbversion }}
restart_policy: always
volumes: "{{ gitea_dbroot }}:/var/lib/mysql"
networks_cli_compatible: true
networks:
- name: "{{ gitea_name }}"
env:
MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_DATABASE: "{{ gitea_dbname }}"
MYSQL_USER: "{{ gitea_dbuser }}"
MYSQL_PASSWORD: "{{ gitea_dbpass }}"
- name: Start Gitea container
docker_container:
name: "{{ gitea_name }}"
image: gitea/gitea:{{ gitea_version }}
restart_policy: always
networks_cli_compatible: true
networks:
- name: "{{ gitea_name }}"
- name: traefik
volumes:
- "{{ gitea_root }}:/data"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
env:
USER_UID: "1000"
USER_GID: "1000"
DB_TYPE: mysql
DB_HOST: "{{ gitea_dbname }}"
DB_NAME: "{{ gitea_dbname }}"
DB_USER: "{{ gitea_dbuser }}"
DB_PASSWD: "{{ gitea_dbpass }}"
labels:
traefik.http.routers.gitea.rule: "Host(`{{ gitea_domain }}`)"
traefik.http.routers.gitea.entrypoints: websecure
traefik.http.services.gitea.loadbalancer.server.port: "3000"
traefik.docker.network: traefik
traefik.enable: "true"