study-plan/安装gitea服务.txt

96 lines
4.0 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

重新刷新交换空间使用https://www.cnblogs.com/xiangbing123/p/17376517.html
[root@localhost ~]# vim /etc/sysctl.conf (查看当前配置cat /proc/sys/vm/swappiness)
vm.swappiness=5        #文件末尾追加此参数(设置成 0 表示尽可能使用内存)
[root@localhost ~]# sysctl -p
执行刷盘命令: sync
释放所有缓存: sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'
关闭swap再开启swap:
swapoff -a
再开启
swapon -a
Gitea关闭用户注册:
找到 app.ini 配置文件修改 service 条目下 DISABLE_REGISTRATION  true意思为禁用注册之后只有管理员可以为用户创建帐户。
[service]
DISABLE_REGISTRATION = true # 禁用注册
[openid]
ENABLE_OPENID_SIGNIN = false # 禁用openid登录
ENABLE_OPENID_SIGNUP = false # 禁用openid注册
Gitea 创建tokenhttps://docs.gitea.com/zh-cn/development/api-usage【 gitea web 界面来创建 apiKey token Settings | Applications | Generate New Token.】[b2f9dbed8d2a66c46881c9d1fe02b16b38cb418d]
Gitea-runnerhttps://docs.gitea.com/zh-cn/runner/0.2.11/ (获取token在runners页面的【创建runners】)
创建默认的配置文件docker run --entrypoint="" --rm -it docker.io/gitea/act_runner:latest act_runner generate-config > act_runner-config.yaml
使用 actions/cache 时没有进行额外的配置:vim act_runner-config.yaml
cache:
enabled: true
dir: "/data/actions_cache"
# 使用步骤 1. 获取的 LAN IP(获取 Runner 容器所在主机的 LAN本地局域网 IP 地址)
host: "10.0.0.16"
# 使用步骤 2. 获取的端口号(获取一个 Runner 容器所在主机的空闲端口号。)
port: 8088
# 运行
docker run -dit -p 8088:8088 \
-e GITEA_INSTANCE_URL=https://git.ewancle.com -e GITEA_RUNNER_REGISTRATION_TOKEN=qWUc64Fqg9gRqLa7pMCilsV11hs7N7CqNUr7xHwg \
-e GITEA_RUNNER_NAME=ewancle-gitea_runner -e GITEA_RUNNER_LABELS=oracle_cloud_gitea_runner -e CONFIG_FILE=/config.yaml \
-v /var/run/docker.sock:/var/run/docker.sock -v /home/ubuntu/gitea/act_runner-config.yaml:/config.yaml -v /home/ubuntu/gitea/act_runner_data:/data \
--name gitea_runner gitea/act_runner:latest
docker run \
-v $(pwd)/act_runner-config.yaml:/config.yaml \
-v $(pwd)/data:/data \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/localtime:/etc/localtime:ro \
-e TZ=Asia/Shanghai \
-e CONFIG_FILE=/config.yaml \
-e GITEA_INSTANCE_URL=<instance_url> \
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
-e GITEA_RUNNER_NAME=<runner_name> \
-e GITEA_RUNNER_LABELS=<runner_labels> \
--name my_runner \
-d gitea/act_runner:nightly
创建配置变量后它们将自动填充到 vars 上下文中。您可以在工作流中使用类似 ${{ vars.VARIABLE_NAME }} 这样的表达式来使用它们。
变量名称只能包含字母数字字符 ([a-z], [A-Z], [0-9]) 或下划线 (_)。不允许使用空格。
变量名称不能以 GITHUB_  GITEA_ 前缀开头。
变量名称不能以数字开头。
变量名称不区分大小写。
变量名称在创建它们的级别上必须是唯一的。
变量名称不能为 CI。
docker-compose.yml方式运行https://docs.gitea.com/installation/install-with-docker
version: "3"
networks:
gitea:
external: false
services:
server:
image: docker.gitea.com/gitea:1.24.3
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
runner:
image: docker.io/gitea/act_runner:nightly
environment:
CONFIG_FILE: /config.yaml
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
volumes:
- ./config.yaml:/config.yaml
- ./data:/data
- /var/run/docker.sock:/var/run/docker.sock