From 20cd7971f30515dc7b05058d78adad42b1e75170 Mon Sep 17 00:00:00 2001
From: M <98937938+NeonMinnen@users.noreply.github.com>
Date: Wed, 6 Sep 2023 05:53:44 -0700
Subject: [PATCH] Add Forgejo (#92)
* Create forgejo.md
* Update mash_servers
Add Forgejo
* Update requirements.yml
* Update releases.opml
* Update setup.yml
* Update supported-services.md
* Update requirements.yml
Fix typo
* Update mash_servers
Forgot "+"
* Fix Syntax Error
* Update Version for Requirement.yml
---
docs/services/forgejo.md | 59 +++++++++++++++++++++++++++++++++++++
docs/supported-services.md | 1 +
group_vars/mash_servers | 60 ++++++++++++++++++++++++++++++++++++++
releases.opml | 3 +-
requirements.yml | 3 ++
setup.yml | 2 ++
6 files changed, 127 insertions(+), 1 deletion(-)
create mode 100644 docs/services/forgejo.md
diff --git a/docs/services/forgejo.md b/docs/services/forgejo.md
new file mode 100644
index 0000000..555efa4
--- /dev/null
+++ b/docs/services/forgejo.md
@@ -0,0 +1,59 @@
+# Forgejo
+
+[Forgejo](https://forgejo.org/) is a painless self-hosted Git service, an alternative fork to Gitea.
+
+
+## Dependencies
+
+This service requires the following other services:
+
+- a [Postgres](postgres.md) database
+- a [Traefik](traefik.md) reverse-proxy server
+
+
+## Configuration
+
+To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process:
+
+```yaml
+########################################################################
+# #
+# forgejo #
+# #
+########################################################################
+
+forgejo_enabled: true
+
+# Forgejo uses port 22 by default.
+# We recommend that you move your regular SSH server to another port,
+# and stick to this default.
+#
+# If you wish to use another port, uncomment the variable below
+# and adjust the port as you see fit.
+# forgejo_ssh_port: 222
+
+forgejo_hostname: mash.example.com
+forgejo_path_prefix: /forgejo
+
+########################################################################
+# #
+# /forgejo #
+# #
+########################################################################
+```
+
+In the example configuration above, we configure the service to be hosted at `https://mash.example.com/forgejo`.
+
+You can remove the `forgejo_path_prefix` variable definition, to make it default to `/`, so that the service is served at `https://mash.example.com/`.
+
+
+## Usage
+
+After installation, you should be able to access your new Forgejo instance at the configured URL (see above).
+
+Going there, you'll be taken to the initial setup wizard, which will let you assign some paswords and other configuration.
+
+
+## Recommended other services
+
+You may also wish to look into [Woodpecker CI](woodpecker-ci.md), which can integrate nicely with Forgejo.
diff --git a/docs/supported-services.md b/docs/supported-services.md
index a08616e..eb9e327 100644
--- a/docs/supported-services.md
+++ b/docs/supported-services.md
@@ -59,6 +59,7 @@
| [Vaultwarden](https://github.com/dani-garcia/vaultwarden) | A lightweight unofficial and compatible implementation of the [Bitwarden](https://bitwarden.com/) password manager | [Link](services/vaultwarden.md) |
| [Uptime-kuma](https://uptime.kuma.pet/) | A fancy self-hosted monitoring tool | [Link](services/uptime-kuma.md) |
| [WireGuard Easy](https://github.com/WeeJeWel/wg-easy) | The easiest way to run [WireGuard](https://www.wireguard.com/) VPN + Web-based Admin UI. | [Link](services/wg-easy.md) |
+| [Forgejo](https://forgejo.org/) | An alternative fork of Gitea. Easy and painless self-hosted git server. | [Link](services/forgejo.md) |
| [Woodpecker CI](https://woodpecker-ci.org/) | A simple Continuous Integration (CI) engine with great extensibility. | [Link](services/woodpecker-ci.md) |
| System-related | A collection of various system-related components | [Link](services/system.md) |
diff --git a/group_vars/mash_servers b/group_vars/mash_servers
index 4e5608e..4e29a0d 100644
--- a/group_vars/mash_servers
+++ b/group_vars/mash_servers
@@ -216,6 +216,8 @@ devture_systemd_service_manager_services_list_auto: |
([{'name': (uptime_kuma_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'uptime-kuma']}] if uptime_kuma_enabled else [])
+
([{'name': (wg_easy_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'wg-easy']}] if wg_easy_enabled else [])
+ +
+ ([{'name': (forgejo_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'forgejo', 'forgejo-server']}] if forgejo_enabled else [])
}}
########################################################################
@@ -374,6 +376,12 @@ devture_postgres_managed_databases_auto: |
'username': vaultwarden_database_username,
'password': vaultwarden_database_password,
}] if vaultwarden_enabled else [])
+ +
+ ([{
+ 'name': forgejo_config_database_name,
+ 'username': forgejo_config_database_username,
+ 'password': forgejo_config_database_password,
+ }] if forgejo_enabled else [])
}}
########################################################################
@@ -1453,6 +1461,14 @@ hubsite_service_woodpecker_ci_logo_location: "{{ role_path }}/assets/woodpecker.
hubsite_service_woodpecker_ci_description: "Check you CI"
hubsite_service_woodpecker_ci_priority: 1000
+# Forgejo
+hubsite_service_forgejo_enabled: "{{ forgejo_enabled }}"
+hubsite_service_forgejo_name: Forgejo
+hubsite_service_forgejo_url: "https://{{ forgejo_hostname }}{{ forgejo_path_prefix }}"
+hubsite_service_forgejo_logo_location: "{{ role_path }}/assets/forgejo.png"
+hubsite_service_forgejo_description: "Another git service"
+hubsite_service_forgejo_priority: 1000
+
hubsite_service_list_auto: |
{{
([{'name': hubsite_service_adguard_home_name, 'url': hubsite_service_adguard_home_url, 'logo_location': hubsite_service_adguard_home_logo_location, 'description': hubsite_service_adguard_home_description, 'priority': hubsite_service_adguard_home_priority}] if hubsite_service_adguard_home_enabled else [])
@@ -2884,6 +2900,50 @@ wg_easy_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResol
# #
########################################################################
+########################################################################
+# #
+# forgejo #
+# #
+########################################################################
+
+forgejo_enabled: false
+
+forgejo_identifier: "{{ mash_playbook_service_identifier_prefix }}forgejo"
+
+forgejo_base_path: "{{ mash_playbook_base_path }}/{{ mash_playbook_service_base_directory_name_prefix }}forgejo"
+
+forgejo_uid: "{{ mash_playbook_uid }}"
+forgejo_gid: "{{ mash_playbook_gid }}"
+
+forgejo_systemd_required_systemd_services_list: |
+ {{
+ (['docker.service'])
+ +
+ ([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled and forgejo_config_database_hostname == devture_postgres_identifier else [])
+ }}
+
+forgejo_container_additional_networks: |
+ {{
+ ([mash_playbook_reverse_proxyable_services_additional_network] if mash_playbook_reverse_proxyable_services_additional_network else [])
+ +
+ ([devture_postgres_container_network] if devture_postgres_enabled and forgejo_config_database_hostname == devture_postgres_identifier and forgejo_container_network != devture_postgres_container_network else [])
+ }}
+
+forgejo_container_labels_traefik_enabled: "{{ mash_playbook_traefik_labels_enabled }}"
+forgejo_container_labels_traefik_docker_network: "{{ mash_playbook_reverse_proxyable_services_additional_network }}"
+forgejo_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}"
+forgejo_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}"
+
+forgejo_config_database_hostname: "{{ devture_postgres_identifier if devture_postgres_enabled else '' }}"
+forgejo_config_database_port: "{{ '5432' if devture_postgres_enabled else '' }}"
+forgejo_config_database_username: "forgejo"
+forgejo_config_database_password: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'db.forgejo', rounds=655555) | to_uuid }}"
+
+########################################################################
+# #
+# /forgejo #
+# #
+########################################################################
########################################################################
diff --git a/releases.opml b/releases.opml
index 8acde0b..5dfffd7 100644
--- a/releases.opml
+++ b/releases.opml
@@ -42,5 +42,6 @@
+