Compare commits

..

2 commits

Author SHA1 Message Date
2c9a70f0fd
forgejo working 2025-07-20 00:07:13 +02:00
f439eec43e
improve forgejo playbook 2025-07-19 20:25:09 +02:00
3 changed files with 40 additions and 17 deletions

View file

@ -102,3 +102,24 @@ Vaultwarden is a credentials manager.
* Stop Vaultwarden. * Stop Vaultwarden.
* Overwrite the data folder with one of the backups. * Overwrite the data folder with one of the backups.
* Start it up again. * Start it up again.
## Forgejo
Forgejo is a git server.
### Deploy
* Decide what subdomain you want to serve Forgejo on and add it to `services/forgejo/forgejo_vars.yml` on the `forgejo_subdomain`.
* Note that you will have to add a DNS entry to point to the VPS public IP.
* Run the deployment playbook: `ansible-playbook -i inventory.ini services/forgejo/deploy_forgejo_playbook.yml`.
### Configure
* Forgejo will be available for you to create a user on first start. Do that and store the creds safely.
* Default behaviour after that is not allow for registrations.
* You can tweak more settings from that point on.
* SSH cloning should work out of the box (after you've set up your SSH pub key in Forgejo, that is).
### Backups
No explicit backups. It's assumed that important repos will be in Lapy, and that perhaps you might even backup lapy as well.

View file

@ -1,6 +1,9 @@
- name: Install Forgejo on Debian 12 with Caddy reverse proxy - name: Install Forgejo on Debian 12 with Caddy reverse proxy
hosts: vipy hosts: vipy
become: yes become: yes
vars_files:
- ../../infra_vars.yml
- ./forgejo_vars.yml
vars: vars:
forgejo_domain: "{{ forgejo_subdomain }}.{{ root_domain }}" forgejo_domain: "{{ forgejo_subdomain }}.{{ root_domain }}"
@ -48,10 +51,22 @@
file: file:
path: "{{ forgejo_config_dir }}" path: "{{ forgejo_config_dir }}"
state: directory state: directory
owner: "root" owner: "{{ forgejo_user }}"
group: "{{ forgejo_user }}" group: "{{ forgejo_user }}"
mode: '0770' mode: '0770'
- name: Create Forgejo config file
ansible.builtin.copy:
dest: "{{ forgejo_config_dir }}/app.ini"
content: |
APP_NAME = ; Countergit
[server]
HTTP_PORT = {{ forgejo_port }}
owner: "{{ forgejo_user }}"
group: "{{ forgejo_user }}"
mode: '0644'
- name: Download Forgejo systemd service file - name: Download Forgejo systemd service file
get_url: get_url:
url: "{{ forgejo_service_url }}" url: "{{ forgejo_service_url }}"
@ -68,21 +83,12 @@
enabled: yes enabled: yes
state: started state: started
- name: Add Caddy reverse proxy config for Forgejo - name: Create Caddy reverse proxy configuration for forgejo
copy:
dest: "{{ caddy_config_path }}"
mode: '0644'
content: |
{{ caddy_site_domain }} {
reverse_proxy localhost:3000
}
- name: Create Caddy reverse proxy configuration for uptime kuma
copy: copy:
dest: "{{ caddy_sites_dir }}/forgejo.conf" dest: "{{ caddy_sites_dir }}/forgejo.conf"
content: | content: |
{{ uptime_kuma_domain }} { {{ forgejo_domain }} {
reverse_proxy localhost:{{ uptime_kuma_port }} reverse_proxy localhost:{{ forgejo_port }}
} }
owner: root owner: root
group: root group: root

View file

@ -17,7 +17,3 @@ forgejo_subdomain: forgejo
remote_host: "{{ groups['vipy'][0] }}" remote_host: "{{ groups['vipy'][0] }}"
remote_user: "{{ hostvars[remote_host]['ansible_user'] }}" remote_user: "{{ hostvars[remote_host]['ansible_user'] }}"
remote_key_file: "{{ hostvars[remote_host]['ansible_ssh_private_key_file'] | default('') }}" remote_key_file: "{{ hostvars[remote_host]['ansible_ssh_private_key_file'] | default('') }}"
# Local backup
local_backup_dir: "{{ lookup('env', 'HOME') }}/forgejo-backups"
backup_script_path: "{{ lookup('env', 'HOME') }}/.local/bin/forgejo_backup.sh"