roles/containers: gitea should work properly now

This commit is contained in:
dogeystamp 2023-08-27 21:59:01 -04:00
parent dd0de3139e
commit e8f762a4cb
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
6 changed files with 19 additions and 21 deletions

View File

@ -13,7 +13,7 @@ backup_disk: no
# where data goes
# if you have external_disk on, you should probably set this to a path there
dataroot: /var/www/data
dataroot: /var/lib/serv_data
# send dynamic DNS update for this domain
dyndns_domain: null

View File

@ -4,3 +4,5 @@
# change these in group/host vars
docker_compose_dir: "/opt/services"
gitea_domain: "git.{{ domain }}"

View File

@ -22,22 +22,16 @@
template:
src: "docker-compose.yml.j2"
dest: "{{ docker_compose_dir }}/docker-compose.yml"
register: docker-comp
register: generateComp
- name: Create systemd unit file
template:
src: "docker-compose.service.j2"
dest: "/etc/systemd/system/docker-compose.service"
- name: Compose up
- name: Compose up (update images if necessary)
systemd:
name: docker-compose
state: "{{ 'restarted' if docker-comp.changed else 'started' }}"
state: reloaded
enabled: true
# for some reason port mappings don't work without this?
- name: Restart docker for good measure
systemd:
name: docker
state: restarted
when: docker-comp.changed
register: compUp

View File

@ -11,7 +11,7 @@ ExecStartPre=-/usr/bin/docker compose pull
ExecStart=/usr/bin/docker compose up --remove-orphans
ExecStop=/usr/bin/docker compose down
ExecReload=/usr/bin/docker compose pull
ExecReload=/usr/bin/docker compose up --remove-orphans
ExecReload=/usr/bin/docker compose up --remove-orphans --detach
[Install]
WantedBy=multi-user.target

View File

@ -3,26 +3,23 @@
version: "3"
networks:
gitea:
external: false
services:
{% if "gitea" in group_names %}
gitea:
network_mode: host
container_name: gitea
image: gitea/gitea:latest
environment:
- USER=gitea
- GITEA__server__SSH_PORT=2499
- GITEA__server__SSH_LISTEN_PORT=2499
- GITEA__service__DISABLE_REGISTRATION=true
- GITEA__server__DOMAIN={{ gitea_domain }}
- GITEA__server__SSH_DOMAIN={{ gitea_domain }}
restart: unless-stopped
networks:
- gitea
volumes:
- {{ dataroot }}/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2499:22"
{% endif %}

View File

@ -53,3 +53,8 @@
name: cronie
state: started
enabled: yes
- name: Create data root dir
file:
path: "{{ dataroot }}"
state: directory