Skip to content

Commit 4266bd9

Browse files
authored
Update document to use FHS /usr/local/bin/gitea instead of /app/... for Docker (#19794)
* Update document to use FHS `/usr/local/bin/gitea` instead of `/app/...` in Docker * Update docs/content/doc/installation/with-docker.zh-cn.md
1 parent 7671a33 commit 4266bd9

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

docker/root/usr/local/bin/gitea

-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ CUSTOM_PATH="/data/gitea"
1313

1414
# Provide docker defaults
1515
GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" GITEA_CUSTOM="${GITEA_CUSTOM:-$CUSTOM_PATH}" exec -a "$0" "$GITEA" $CONF_ARG "$@"
16-
17-

docs/content/doc/installation/with-docker.en-us.md

+1-11
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,6 @@ In this option, the idea is that the host simply uses the `authorized_keys` that
389389
sudo chmod +x /usr/local/bin/gitea
390390
```
391391

392-
- For Gitea v1.15.x and earlier. As an administrative user on the host run:
393-
394-
```bash
395-
cat <<"EOF" | sudo tee /app/gitea/gitea
396-
#!/bin/sh
397-
ssh -p 2222 -o StrictHostKeyChecking=no [email protected] "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
398-
EOF
399-
sudo chmod +x /app/gitea/gitea
400-
```
401-
402392
Here is a detailed explanation what is happening when a SSH request is made:
403393

404394
1. The client adds their SSH public key to Gitea using the webpage.
@@ -431,7 +421,7 @@ Never add the `Gitea Host Key` as a SSH key to a user on the Gitea interface.
431421

432422
In this option, the idea is that the host simply uses the `authorized_keys` that gitea creates but at step 8 above we change the shell that the host runs to ssh directly into the docker and then run the shell there. This means that the `gitea` that is then run is the real docker `gitea`.
433423

434-
- In this case we setup as per SSHing Shim except instead of creating `/usr/local/bin/gitea` or `/app/gitea/gitea`
424+
- In this case we setup as per SSHing Shim except instead of creating `/usr/local/bin/gitea`
435425
we create a new shell for the git user. As an administrative user on the host run:
436426

437427
```bash

docs/content/doc/installation/with-docker.zh-cn.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ volumes:
301301
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
302302
```
303303

304-
在下一步中,需要在主机上创建一个名为 `/app/gitea/gitea` 的文件(具有可执行权限)。该文件将发出从主机到容器的 SSH 转发。将以下内容添加到 `/app/gitea/gitea`
304+
在下一步中,需要在主机上创建一个名为 `/user/local/bin/gitea` 的文件(具有可执行权限)。该文件将发出从主机到容器的 SSH 转发。将以下内容添加到 `/user/local/bin/gitea`
305305

306306
```bash
307307
ssh -p 2222 -o StrictHostKeyChecking=no [email protected] "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
@@ -324,14 +324,14 @@ ports:
324324
ssh-rsa <Gitea Host Key>
325325

326326
# other keys from users
327-
command="/app/gitea/gitea --config=/data/gitea/conf/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty <user pubkey>
327+
command="/user/local/bin/gitea --config=/data/gitea/conf/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty <user pubkey>
328328
```
329329

330330
这是详细的说明,当发出 SSH 请求时会发生什么:
331331

332332
1. 使用 `git` 用户向主机发出 SSH 请求,例如 `git clone git@domain:user/repo.git`
333-
2.`/home/git/.ssh/authorized_keys` 中,该命令执行 `/app/gitea/gitea` 脚本。
334-
3. `/app/gitea/gitea` 将 SSH 请求转发到端口 2222,该端口已映射到容器的 SSH 端口(22)。
333+
2.`/home/git/.ssh/authorized_keys` 中,该命令执行 `/user/local/bin/gitea` 脚本。
334+
3. `/user/local/bin/gitea` 将 SSH 请求转发到端口 2222,该端口已映射到容器的 SSH 端口(22)。
335335
4. 由于 `/home/git/.ssh/authorized_keys` 中存在 `git` 用户的公钥,因此身份验证主机 → 容器成功,并且 SSH 请求转发到在 docker 容器中运行的 Gitea。
336336

337337
如果在 Gitea Web 界面中添加了新的 SSH 密钥,它将以与现有密钥相同的方式附加到 `.ssh/authorized_keys` 中。

docs/content/doc/usage/backup-and-restore.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The command has to be executed with the `RUN_USER = <OS_USERNAME>` specified in
5757
Example:
5858

5959
```none
60-
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf 'name=^<NAME_OF_DOCKER_CONTAINER>$') bash -c '/app/gitea/gitea dump -c </path/to/app.ini>'
60+
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf 'name=^<NAME_OF_DOCKER_CONTAINER>$') bash -c '/user/local/bin/gitea dump -c </path/to/app.ini>'
6161
```
6262

6363
\*Note: `--tempdir` refers to the temporary directory of the docker environment used by Gitea; if you have not specified a custom `--tempdir`, then Gitea uses `/tmp` or the `TMPDIR` environment variable of the docker container. For `--tempdir` adjust your `docker exec` command options accordingly.

0 commit comments

Comments
 (0)