Skip to content

Commit d13ed1c

Browse files
ibizamanibizaman
ibizaman
authored andcommitted
update forgejo documentation
1 parent d529382 commit d13ed1c

File tree

3 files changed

+49
-37
lines changed

3 files changed

+49
-37
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Template:
1616

1717
# Upcoming Release
1818

19+
# v0.2.10
20+
1921
## New Features
2022

2123
- Add `shb.forgejo.users` option to create users declaratively.

docs/redirects.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1235,17 +1235,17 @@
12351235
"services-forgejo-options-shb.forgejo.subdomain": [
12361236
"services-forgejo.html#services-forgejo-options-shb.forgejo.subdomain"
12371237
],
1238-
"services-forgejo-secrets": [
1239-
"services-forgejo.html#services-forgejo-secrets"
1240-
],
12411238
"services-forgejo-usage": [
12421239
"services-forgejo.html#services-forgejo-usage"
12431240
],
12441241
"services-forgejo-usage-backup": [
12451242
"services-forgejo.html#services-forgejo-usage-backup"
12461243
],
1247-
"services-forgejo-usage-basic": [
1248-
"services-forgejo.html#services-forgejo-usage-basic"
1244+
"services-forgejo-usage-configuration": [
1245+
"services-forgejo.html#services-forgejo-usage-configuration"
1246+
],
1247+
"services-forgejo-usage-https": [
1248+
"services-forgejo.html#services-forgejo-usage-https"
12491249
],
12501250
"services-forgejo-usage-extra-settings": [
12511251
"services-forgejo.html#services-forgejo-usage-extra-settings"

modules/services/forgejo/docs/default.md

+42-32
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,62 @@ LDAP and SSO integration as well as one local runner.
1010

1111
## Features {#services-forgejo-features}
1212

13-
- Declarative [LDAP](#services-forgejo-options-shb.forgejo.ldap) Configuration. [Manual](#services-forgejo-usage-ldap).
13+
- Declarative creation of users, admin or not.
14+
- Also declarative [LDAP](#services-forgejo-options-shb.forgejo.ldap) Configuration. [Manual](#services-forgejo-usage-ldap).
1415
- Declarative [SSO](#services-forgejo-options-shb.forgejo.sso) Configuration. [Manual](#services-forgejo-usage-sso).
1516
- Declarative [local runner](#services-forgejo-options-shb.forgejo.localActionRunner) Configuration.
16-
- Access through [subdomain](#services-forgejo-options-shb.forgejo.subdomain) using reverse proxy. [Manual](#services-forgejo-usage-basic).
17-
- Access through [HTTPS](#services-forgejo-options-shb.forgejo.ssl) using reverse proxy. [Manual](#services-forgejo-usage-basic).
17+
- Access through [subdomain](#services-forgejo-options-shb.forgejo.subdomain) using reverse proxy. [Manual](#services-forgejo-usage-configuration).
18+
- Access through [HTTPS](#services-forgejo-options-shb.forgejo.ssl) using reverse proxy. [Manual](#services-forgejo-usage-configuration).
1819
- [Backup](#services-forgejo-options-shb.forgejo.sso) through the [backup block](./blocks-backup.html). [Manual](#services-forgejo-usage-backup).
1920

2021
## Usage {#services-forgejo-usage}
2122

22-
### Secrets {#services-forgejo-secrets}
23+
### Initial Configuration {#services-forgejo-usage-configuration}
2324

24-
All the secrets should be readable by the forgejo user.
25-
26-
Secrets should not be stored in the nix store.
27-
If you're using [sops-nix](https://github.com/Mic92/sops-nix)
28-
and assuming your secrets file is located at `./secrets.yaml`,
29-
you can define a secret with:
25+
The following snippet enables Forgejo and makes it available under the `forgejo.example.com` endpoint.
3026

3127
```nix
32-
sops.secrets."forgejo/adminPasswordFile" = {
33-
sopsFile = ./secrets.yaml;
34-
mode = "0400";
35-
owner = "forgejo";
36-
group = "forgejo";
37-
restartUnits = [ "forgejo.service" ];
28+
shb.forgejo = {
29+
enable = true;
30+
subdomain = "forgejo";
31+
enable = "example.com";
32+
33+
users = {
34+
"theadmin" = {
35+
isAdmin = true;
36+
email = "[email protected]";
37+
password.result = config.shb.hardcodedsecret.forgejoAdminPassword.result;
38+
};
39+
"theuser" = {
40+
email = "[email protected]";
41+
password.result = config.shb.hardcodedsecret.forgejoUserPassword.result;
42+
};
43+
};
3844
};
39-
```
4045
41-
Then you can use that secret:
46+
shb.hardcodedsecret."forgejo/admin/password" = {
47+
request = config.shb.forgejo.users."theadmin".password.request;
48+
};
4249
43-
```nix
44-
shb.forgejo.adminPasswordFile = config.sops.secrets."forgejo/adminPasswordFile".path;
50+
shb.hardcodedsecret."forgejo/user/password" = {
51+
request = config.shb.forgejo.users."theuser".password.request;
52+
};
4553
```
4654

47-
### Forgejo through HTTPS {#services-forgejo-usage-basic}
55+
Two users are created, `theadmin` and `theuser`,
56+
respectively with the passwords `foregejo/admin/password`
57+
and `foregejo/user/password` from a SOPS file.
4858

49-
This will set up a Forgejo service that runs on the NixOS target machine,
50-
reachable at `http://forgejo.example.com`.
59+
This assumes secrets are setup with SOPS
60+
as mentioned in [the secrets setup section](usage.html#usage-secrets) of the manual.
61+
Secrets can be randomly generated with `nix run nixpkgs#openssl -- rand -hex 64`.
5162

52-
```nix
53-
shb.forgejo = {
54-
enable = true;
55-
domain = "example.com";
56-
subdomain = "forgejo";
57-
};
58-
```
63+
### Forgejo through HTTPS {#services-forgejo-usage-https}
64+
65+
:::: {.note}
66+
We will build upon the [Initial Configuration](#services-forgejo-usage-configuration) section,
67+
so please follow that first.
68+
::::
5969

6070
If the `shb.ssl` block is used (see [manual](blocks-ssl.html#usage) on how to set it up),
6171
the instance will be reachable at `https://fogejo.example.com`.
@@ -77,14 +87,14 @@ Then you can tell Forgejo to use those certificates.
7787
shb.certs.certs.letsencrypt."example.com".extraDomains = [ "forgejo.example.com" ];
7888
7989
shb.forgejo = {
80-
ssl = config.shb.certs.certs.selfsigned.forgejo;
90+
ssl = config.shb.certs.certs.letsencrypt."example.com";
8191
};
8292
```
8393

8494
### With LDAP Support {#services-forgejo-usage-ldap}
8595

8696
:::: {.note}
87-
We will build upon the [HTTPS](#services-forgejo-usage-basic) section,
97+
We will build upon the [HTTPS](#services-forgejo-usage-https) section,
8898
so please follow that first.
8999
::::
90100

0 commit comments

Comments
 (0)