Skip to content

Commit cd3ca65

Browse files
committed
add generation of internal token
Signed-off-by: Phill Kelley <[email protected]>
1 parent 09b675c commit cd3ca65

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.templates/gitea/service.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ gitea:
1818
# - GITEA__server__CERT_FILE=/data/git/cert.pem
1919
- GITEA__security__INSTALL_LOCK=true
2020
- GITEA__security__SECRET_KEY=${GITEA_SECRET_KEY}
21+
- GITEA__security__INTERNAL_TOKEN=${GITEA_INTERNAL_TOKEN}
22+
2123

2224
healthcheck:
2325
test: ["CMD", "curl", "-f", "http://localhost:3000"]

docs/Containers/Gitea.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ Environment variables need to be set in several stages:
5858

5959
If this is the first time you have launched Gitea, docker compose will also build and run the `gitea_db` service.
6060

61-
You can expect to see the following warning:
61+
You can expect to see the following warnings:
6262

6363
```
64-
WARN[0000] The "GITEA_SECRET_KEY" variable is not set. Defaulting to a blank string.
64+
WARN[0000] The "GITEA_SECRET_KEY" variable is not set. Defaulting to a blank string.
65+
WARN[0000] The "GITEA_INTERNAL_TOKEN" variable is not set. Defaulting to a blank string.
6566
```
6667

67-
This is actually a reminder to execute this command:
68+
Those are reminders to execute these commands:
6869

6970
``` console
7071
$ echo "GITEA_SECRET_KEY=$(docker exec gitea gitea generate secret SECRET_KEY)" >>~/IOTstack/.env
72+
$ echo "GITEA_INTERNAL_TOKEN=$(docker exec gitea gitea generate secret INTERNAL_TOKEN)" >>~/IOTstack/.env
7173
```
7274

7375
After that command has run, start the container again:
@@ -113,9 +115,9 @@ Environment variables need to be set in several stages:
113115
``` console
114116
$ docker exec gitea gitea cert --host «hostname»
115117
```
116-
118+
117119
where `«hostname»` should be the first part of the fully-qualified domain name that the **user** uses to reach the Gitea service. Examples:
118-
120+
119121
* `gitea.my.domain.com` = `gitea`
120122
* `host.my.domain.com` = `host`
121123

@@ -127,26 +129,26 @@ Environment variables need to be set in several stages:
127129
# - GITEA__server__KEY_FILE=/data/git/key.pem
128130
# - GITEA__server__CERT_FILE=/data/git/cert.pem
129131
```
130-
132+
131133
These variables tell Gitea where to find the X.509 certificate and matching private key that were generated in the first step.
132-
134+
133135
- Tell Gitea to enable HTTPS:
134136

135137
``` console
136138
$ echo "GITEA_WEB_PROTOCOL=https" >>~/IOTstack/.env
137139
```
138-
140+
139141
- Recreate the container:
140142

141143
``` console
142144
$ cd ~/IOTstack
143145
$ docker compose up -d gitea
144146
```
145-
147+
146148
If everything has gone according to plan, Gitea will be expecting HTTPS traffic and will perform SSL authentication using the key and certificate generated in the first step.
147-
149+
148150
Notes:
149-
151+
150152
* The certificate has a one-year lifetime. It can be regenerated at any time by re-running the command provided earlier.
151153
* Gitea also supports LetsEncrypt. See [using ACME with Let's Encrypt](https://docs.gitea.com/administration/https-setup#using-acme-default-lets-encrypt).
152154

@@ -198,7 +200,7 @@ Use your browser to connect to the Gitea service, either:
198200
https://gitea.my.domain.com
199201
```
200202

201-
This assumes that the reverse proxy redirects the *indirect* form (using HTTPS) to one of the *direct* forms (using HTTP).
203+
This assumes that the reverse proxy redirects the *indirect* form (using HTTPS) to one of the *direct* forms (using either HTTP or HTTPS).
202204

203205
Click on the <kbd>Register</kbd> button to create an account for yourself.
204206

0 commit comments

Comments
 (0)