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:
parent
f60d9205f8
commit
9592eb0890
4 changed files with 54 additions and 24 deletions
|
@ -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
|
||||
|
|
38
roles/forgejo/tasks/start_server.yml
Normal file
38
roles/forgejo/tasks/start_server.yml
Normal 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
|
|
@ -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
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
- "80:80"
|
||||
- "389:389"
|
||||
- "443:443"
|
||||
- "8022:8022"
|
||||
- "8448:8448"
|
||||
restart_policy: unless-stopped
|
||||
- name: Reload haproxy
|
||||
|
|
Loading…
Reference in a new issue