1
0
Fork 0
gopoop.org/gitea.yaml

88 lines
2.4 KiB
YAML
Raw Normal View History

2022-03-16 04:52:23 +00:00
---
- name: Setup Gitea
hosts: all
vars_files:
- vault.yaml
- vars.yaml
tasks:
- name: Run Gitea Postgres DB
docker_container:
name: "{{ stack_prefix_name }}gitea-db"
recreate: true
restart_policy: unless-stopped
image: postgres:14.2
env:
USER_UID: "1000"
USER_GID: "1000"
POSTGRES_USER: gitea
POSTGRES_DB: gitea
POSTGRES_PASSWORD: "{{ secret_gitea_db_password }}"
networks:
- name: "{{ stack_internal_network }}"
mounts:
- source: "{{ stack_prefix_name }}gitea_db_data"
target: /var/lib/postgresql/data
state: "{{ container_state }}"
2022-06-20 16:45:27 +00:00
- name: Build Gitea config
template:
src: ./gitea/app.ini.j2
dest: ./gitea/app.ini
- name: Create Gitea Directory
file:
path: ~/gitea
state: directory
recurse: yes
- name: Send Gitea Dockerfile
copy:
src: ./gitea/Dockerfile
dest: ~/gitea/Dockerfile
- name: Build Gitea image
docker_image:
name: gitea_with_asciidoc
source: build
build:
cache_from:
- gitea/gitea:1.16.8
path: "./gitea"
2022-03-16 04:52:23 +00:00
- name: Run Gitea
docker_container:
name: "{{ stack_prefix_name }}gitea"
recreate: true
restart_policy: unless-stopped
2022-06-20 16:45:27 +00:00
image: gitea_with_asciidoc
2022-03-16 04:52:23 +00:00
published_ports:
- "3000:3000"
env:
USER_UID: "1000"
USER_GID: "1000"
GITEA__database__DB_TYPE: postgres
GITEA__database__HOST: "{{ stack_prefix_name }}gitea-db:5432"
GITEA__database__NAME: gitea
GITEA__database__USER: gitea
GITEA__database__PASSWD: "{{ secret_gitea_db_password }}"
networks:
- name: "{{ stack_internal_network }}"
- name: "{{ stack_external_network }}"
# May need to open ssh ports for some things. Maybe not.
mounts:
2022-06-20 16:45:27 +00:00
- source: "/home/server/gitea/app.ini"
2022-05-08 15:15:39 +00:00
target: /data/gitea/conf/app.ini
type: bind
2022-03-16 04:52:23 +00:00
- source: "{{ stack_prefix_name }}gitea_data"
target: /data
- source: /etc/timezone
target: /etc/timezone:ro
type: bind
- source: /etc/localtime
target: /etc/localtime:ro
type: bind
state: "{{ container_state }}"