Port git service

This commit is contained in:
Wojciech Kozlowski 2022-12-17 00:09:05 +01:00
parent b126304227
commit e4adcf5afe
6 changed files with 79 additions and 13 deletions

View File

@ -57,6 +57,7 @@ services:
smtp_host: "{{ vault_services.git.smtp_host }}" smtp_host: "{{ vault_services.git.smtp_host }}"
smtp_user: "{{ vault_services.git.smtp_user }}" smtp_user: "{{ vault_services.git.smtp_user }}"
smtp_passwd: "{{ vault_services.git.smtp_passwd }}" smtp_passwd: "{{ vault_services.git.smtp_passwd }}"
ssh_port: 2770
notes: notes:
domain: "{{ vault_services.notes.domain }}" domain: "{{ vault_services.notes.domain }}"
database_name: "{{ vault_services.notes.database_name }}" database_name: "{{ vault_services.notes.database_name }}"

View File

@ -44,6 +44,6 @@ services_host_services:
address: "{{ vpn_bridge_prefix }}.4" address: "{{ vpn_bridge_prefix }}.4"
git: git:
address: "{{ vpn_bridge_prefix }}.5" address: "{{ vpn_bridge_prefix }}.5"
tcp: [2770] tcp: ["{{ services.git.ssh_port }}"]
notes: notes:
address: "{{ vpn_bridge_prefix }}.6" address: "{{ vpn_bridge_prefix }}.6"

View File

@ -113,3 +113,16 @@
vars: vars:
services_service_name: "cloud" services_service_name: "cloud"
tags: "always" tags: "always"
- name: "deploy"
ansible.builtin.include_role:
name: "deploy/git"
apply:
tags:
- "services:{{ services_service_name }}"
- "services:deploy"
- "services:deploy:{{ services_service_name }}"
- "services:{{ services_service_name }}:deploy"
vars:
services_service_name: "git"
tags: "always"

View File

@ -0,0 +1,52 @@
- name: "set the user variables"
ansible.builtin.import_role:
name: "include"
vars_from: "user"
- name: "set the version variables"
ansible.builtin.import_role:
name: "deploy/include"
vars_from: "versions"
- block:
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0644
loop:
- "pod-git.service"
- "container-git-gitea.service"
register: services_deploy_git_systemd_files
- name: "systemd user daemon reload"
ansible.builtin.systemd:
daemon_reload: true
scope: "user"
when:
services_deploy_git_systemd_files.changed
- name: "enable the service"
ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service"
enabled: true
scope: "user"
- name: "start the service"
ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service"
state: "started"
scope: "user"
register: services_deploy_git_service_start
- name: "restart the service"
ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service"
state: restarted
scope: user
when:
services_deploy_git_systemd_files.changed and
not services_deploy_git_service_start.changed
become_user: "{{ services_service_user_name }}"

View File

@ -20,7 +20,7 @@ ExecStart=/usr/bin/podman run \
--replace \ --replace \
--label "io.containers.autoupdate=image" \ --label "io.containers.autoupdate=image" \
-dt \ -dt \
--add-host=pod-database:{{ services['database'].address }} \ --add-host=pod-database:{{ services_all_services['database'].address }} \
-v /var/lib/yggdrasil/valkyrie-resolv.conf:/etc/resolv.conf:ro \ -v /var/lib/yggdrasil/valkyrie-resolv.conf:/etc/resolv.conf:ro \
-v /var/lib/yggdrasil/data/pod-git/data/_data:/data \ -v /var/lib/yggdrasil/data/pod-git/data/_data:/data \
-v /etc/timezone:/etc/timezone:ro \ -v /etc/timezone:/etc/timezone:ro \
@ -29,24 +29,24 @@ ExecStart=/usr/bin/podman run \
-e USER_GID="1000" \ -e USER_GID="1000" \
-e GITEA__database__DB_TYPE="postgres" \ -e GITEA__database__DB_TYPE="postgres" \
-e GITEA__database__HOST="pod-database:5432" \ -e GITEA__database__HOST="pod-database:5432" \
-e GITEA__database__NAME="{{ services[service_name].database_name }}" \ -e GITEA__database__NAME="{{ services[services_service_name].database_name }}" \
-e GITEA__database__USER="{{ services[service_name].database_user }}" \ -e GITEA__database__USER="{{ services[services_service_name].database_user }}" \
-e GITEA__database__PASSWD="{{ services[service_name].database_passwd }}" \ -e GITEA__database__PASSWD="{{ services[services_service_name].database_passwd }}" \
-e GITEA__server__DOMAIN="{{ services[service_name].domain }}" \ -e GITEA__server__DOMAIN="{{ services[services_service_name].domain }}" \
-e GITEA__server__ROOT_URL="https://%(DOMAIN)s/" \ -e GITEA__server__ROOT_URL="https://%(DOMAIN)s/" \
-e GITEA__server__START_SSH_SERVER="true" \ -e GITEA__server__START_SSH_SERVER="true" \
-e GITEA__server__SSH_PORT="{{ services[service_name].ssh_port }}" \ -e GITEA__server__SSH_PORT="{{ services[services_service_name].ssh_port }}" \
-e GITEA__server__SSH_LISTEN_PORT="{{ services[service_name].ssh_port }}" \ -e GITEA__server__SSH_LISTEN_PORT="{{ services[services_service_name].ssh_port }}" \
-e GITEA__mailer__ENABLED="true" \ -e GITEA__mailer__ENABLED="true" \
-e GITEA__mailer__FROM="Gitea <git@{{ services[service_name].domain }}>" \ -e GITEA__mailer__FROM="Gitea <git@{{ services[services_service_name].domain }}>" \
-e GITEA__mailer__MAILER_TYPE="smtp" \ -e GITEA__mailer__MAILER_TYPE="smtp" \
-e GITEA__mailer__HOST="{{ services[service_name].smtp_host }}" \ -e GITEA__mailer__HOST="{{ services[services_service_name].smtp_host }}" \
-e GITEA__mailer__USER="{{ services[service_name].smtp_user }}" \ -e GITEA__mailer__USER="{{ services[services_service_name].smtp_user }}" \
-e GITEA__mailer__PASSWD="{{ services[service_name].smtp_passwd }}" \ -e GITEA__mailer__PASSWD="{{ services[services_service_name].smtp_passwd }}" \
-e GITEA__service__DISABLE_REGISTRATION="true" \ -e GITEA__service__DISABLE_REGISTRATION="true" \
-e GITEA__service__ENABLE_NOTIFY_MAIL="true" \ -e GITEA__service__ENABLE_NOTIFY_MAIL="true" \
--name=pod-git-gitea \ --name=pod-git-gitea \
docker.io/gitea/gitea:{{ versions.git.gitea }} docker.io/gitea/gitea:{{ services_deploy_versions.git.gitea }}
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-git-gitea.ctr-id -t 10 ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-git-gitea.ctr-id -t 10
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-git-gitea.ctr-id ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-git-gitea.ctr-id
PIDFile=%t/container-git-gitea.pid PIDFile=%t/container-git-gitea.pid