aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-11-03 18:32:34 +0800
committercrupest <crupest@outlook.com>2024-11-03 18:32:34 +0800
commit9eb8aede09980ca4f85d68af3c733864e30afaba (patch)
treebfff02b0769dc65464cae0fdc4a04aabe4a139ef
parent2c4c1f8559b6371a65ad04c93dfad9d1929432a9 (diff)
downloadcrupest-9eb8aede09980ca4f85d68af3c733864e30afaba.tar.gz
crupest-9eb8aede09980ca4f85d68af3c733864e30afaba.tar.bz2
crupest-9eb8aede09980ca4f85d68af3c733864e30afaba.zip
feat(service): add forgejo.
-rw-r--r--.gitignore1
-rw-r--r--crupest-words.txt3
-rw-r--r--template/docker-compose.yaml.template14
-rw-r--r--template/forgejo.app.ini.template53
-rw-r--r--template/nginx/server.json5
-rw-r--r--tools/aio/modules/config.py10
6 files changed, 86 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 21653c4..9c19f36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,5 +8,6 @@ tmp
backup
v2ray-config.json
v2ray-client-config.json
+forgejo.app.ini
tools/docker-mailserver-setup.sh
diff --git a/crupest-words.txt b/crupest-words.txt
index 62906cb..f62a5e9 100644
--- a/crupest-words.txt
+++ b/crupest-words.txt
@@ -1,5 +1,8 @@
crupest
+# software
+forgejo
+
# secret
vnext
vmess
diff --git a/template/docker-compose.yaml.template b/template/docker-compose.yaml.template
index 678a7e4..f263cbf 100644
--- a/template/docker-compose.yaml.template
+++ b/template/docker-compose.yaml.template
@@ -163,6 +163,20 @@ services:
- ./data/debian-dev:/data
- debian-dev-home:/home/crupest
+ forgejo:
+ image: codeberg.org/forgejo/forgejo:9
+ pull_policy: always
+ container_name: forgejo
+ restart: on-failure:3
+ environment:
+ - USER_UID=1000
+ - USER_GID=1000
+ volumes:
+ - ./forgejo.app.ini:/data/gitea/conf/app.ini
+ - ./data/forgejo:/data
+ - /etc/timezone:/etc/timezone:ro
+ - /etc/localtime:/etc/localtime:ro
+
volumes:
blog-public:
debian-dev-home:
diff --git a/template/forgejo.app.ini.template b/template/forgejo.app.ini.template
new file mode 100644
index 0000000..4fbcdec
--- /dev/null
+++ b/template/forgejo.app.ini.template
@@ -0,0 +1,53 @@
+APP_NAME = Forgejo, loved by crupest.
+RUN_MODE = prod
+
+[repository]
+ROOT = /data/git/repositories
+
+[server]
+APP_DATA_PATH = /data/gitea
+HTTP_ADDR = 0.0.0.0
+HTTP_PORT = 3000
+USE_PROXY_PROTOCOL = true
+DISABLE_SSH = true
+LFS_START_SERVER = true
+
+[database]
+DB_TYPE = sqlite3
+
+[security]
+INSTALL_LOCK = false
+SECRET_KEY = ${CRUPEST_FORGEJO_SECURITY_KEY}
+REVERSE_PROXY_LIMIT = 1
+REVERSE_PROXY_TRUSTED_PROXIES = *
+
+[service]
+DISABLE_REGISTRATION = false
+ALLOW_ONLY_INTERNAL_REGISTRATION = true
+
+[mailer]
+ENABLED = true
+PROTOCOL = smtp
+SMTP_ADDR = mail.${CRUPEST_DOMAIN}
+SMTP_PORT = 465
+USER = ${CRUPEST_FORGEJO_MAILER_USER}
+PASSWD = ${CRUPEST_FORGEJO_MAILER_PASSWD}
+
+[email.incoming]
+ENABLED = true
+HOST = mail.${CRUPEST_DOMAIN}
+PORT = 993
+USERNAME = ${CRUPEST_FORGEJO_EMAIL_INCOMING_USER}
+PASSWORD = ${CRUPEST_FORGEJO_EMAIL_INCOMING_PASSWORD}
+USE_TLS = true
+
+[log]
+MODE = console,file
+
+[cron]
+ENABLED = true
+
+[log.file]
+
+[actions]
+ENABLED = false
diff --git a/template/nginx/server.json b/template/nginx/server.json
index eadce1e..c9a6108 100644
--- a/template/nginx/server.json
+++ b/template/nginx/server.json
@@ -12,6 +12,11 @@
"upstream": "debian-dev:8080"
},
{
+ "type": "reverse-proxy",
+ "subdomain": "git",
+ "upstream": "forgejo:3000"
+ },
+ {
"type": "static-file",
"subdomain": "blog",
"root": "/srv/blog"
diff --git a/tools/aio/modules/config.py b/tools/aio/modules/config.py
index 40b20d1..7dc75a1 100644
--- a/tools/aio/modules/config.py
+++ b/tools/aio/modules/config.py
@@ -55,6 +55,16 @@ config_var_list: list = [
"v2ray user id", generate_uuid),
ConfigVar("CRUPEST_V2RAY_PATH",
"v2ray path, which will be prefixed by _", generate_uuid),
+ ConfigVar("CRUPEST_FORGEJO_SECURITY_KEY",
+ "Forgejo secret key.", generate_uuid),
+ ConfigVar("CRUPEST_FORGEJO_MAILER_USER",
+ "Forgejo SMTP user.", "Please input your Forgejo SMTP user."),
+ ConfigVar("CRUPEST_FORGEJO_MAILER_PASSWD",
+ "Forgejo SMTP password.", "Please input your Forgejo SMTP password."),
+ ConfigVar("CRUPEST_FORGEJO_EMAIL_INCOMING_USER",
+ "Forgejo IMAP user.", "Please input your Forgejo IMAP user."),
+ ConfigVar("CRUPEST_FORGEJO_EMAIL_INCOMING_PASSWORD",
+ "Forgejo IMAP password.", "Please input your Forgejo IMAP password."),
]
config_var_name_set = set([config_var.name for config_var in config_var_list])