Prepare forgejo for adding more servers

Due to problems with queues and locks, I did not add servers,
I just changed the container name and haproxy settings.
This commit is contained in:
Ivan R. 2024-11-28 14:34:31 +05:00
parent f60d9205f8
commit 9592eb0890
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
4 changed files with 54 additions and 24 deletions

View file

@ -24,26 +24,8 @@
group: 1000
mode: '0660'
register: appini
- name: Create forgejo container
become: true
community.docker.docker_container:
name: forgejo
image: codeberg.org/forgejo/forgejo:{{ tag }}
env:
USER_UID: "{{ user_uid | string }}"
USER_GID: "{{ user_gid | string }}"
FORGEJO_WORK_DIR: "{{ work_path }}"
FORGEJO_CUSTOM: "{{ work_path }}/custom"
networks:
- name: postgresql
- name: forgejo
- name: minio
- name: haproxy
volumes:
- forgejo:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "{{ ssh_listen_port }}:{{ ssh_listen_port }}"
recreate: "{{ appini.changed }}"
restart_policy: unless-stopped
- include_tasks: start_server.yml
# We need to solve the problems with queues/locks before adding more servers.
loop: [1]
loop_control:
loop_var: server_idx

View file

@ -0,0 +1,38 @@
---
- name: Disable forgejo server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: disabled
backend: forgejo
host: s{{ server_idx }}
fail_on_not_found: true
- name: Create forgejo container
become: true
community.docker.docker_container:
name: forgejo-{{ server_idx }}
image: codeberg.org/forgejo/forgejo:{{ tag }}
env:
USER_UID: "{{ user_uid | string }}"
USER_GID: "{{ user_gid | string }}"
FORGEJO_WORK_DIR: "{{ work_path }}"
FORGEJO_CUSTOM: "{{ work_path }}/custom"
networks:
- name: postgresql
- name: forgejo
- name: minio
- name: haproxy
volumes:
- forgejo:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
recreate: "{{ appini.changed }}"
restart_policy: unless-stopped
- name: Enable forgejo server in haproxy
become: true
community.general.haproxy:
socket: /run/haproxy/admin.sock
state: enabled
backend: forgejo
host: s{{ server_idx }}
fail_on_not_found: true

View file

@ -128,6 +128,11 @@ frontend matrix-federation
default_backend matrix
frontend forgejo_ssh
mode tcp
bind :8022
default_backend forgejo_ssh
frontend authentik_ldap
mode tcp
bind *:389
@ -172,7 +177,11 @@ backend minio
backend forgejo
mode http
server green forgejo:3000 check
server s1 forgejo-1:3000 check
backend forgejo_ssh
mode tcp
server s1 forgejo-1:8022 check
backend matrix
mode http

View file

@ -72,6 +72,7 @@
- "80:80"
- "389:389"
- "443:443"
- "8022:8022"
- "8448:8448"
restart_policy: unless-stopped
- name: Reload haproxy