<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="https://blog.kali-team.cn/feed_style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>https:&#x2F;&#x2F;blog.kali-team.cn</tabi:base_url>
        <tabi:separator>
            •
        </tabi:separator>
        <tabi:about_feeds>这是Web Feed，又称为Atom Feed，把现在的网址复制到新闻阅读器即可订阅本站文章。造访「About Feeds」来了解更多资讯。</tabi:about_feeds>
        <tabi:visit_the_site>造访网站</tabi:visit_the_site>
        <tabi:recent_posts>近期文章</tabi:recent_posts>
        <tabi:last_updated_on>更新于 $DATE</tabi:last_updated_on>
        <tabi:default_theme></tabi:default_theme>
        <tabi:post_listing_date>date</tabi:post_listing_date>
        <tabi:current_section>gitea</tabi:current_section>
    </tabi:metadata><link rel="extra-stylesheet" href="https://blog.kali-team.cn/skins/arch.css?h=8b651815fde702215b07" /><title>Kali-Team - gitea</title>
        <subtitle>三米前有蕉皮的博客</subtitle>
    <link href="https://blog.kali-team.cn/tags/gitea/atom.xml" rel="self" type="application/atom+xml"/>
    <link href="https://blog.kali-team.cn/tags/gitea/" rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator><updated>2024-09-04T00:00:00+00:00</updated><id>https://blog.kali-team.cn/tags/gitea/atom.xml</id><entry xml:lang="zh">
        <title>NUC主机搭建Homelab</title>
        <published>2024-09-04T00:00:00+00:00</published>
        <updated>2024-09-04T00:00:00+00:00</updated>
        <author>
            <name>三米前有蕉皮</name>
        </author>
        <link rel="alternate" href="https://blog.kali-team.cn/blog/NUC主机搭建Homelab/" type="text/html"/>
        <id>https://blog.kali-team.cn/blog/NUC主机搭建Homelab/</id>
        
            <content type="html">&lt;h1 id=&quot;qian-yan&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#qian-yan&quot; aria-label=&quot;Anchor link for: qian-yan&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
前言&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;之前搭建的esxi服务器用了半年后还是觉得Arch好用一点，esxi系统自身很难做扩展，可玩行不高，所以装完Arch后将之前的服务器迁移到了物理机，还配置了nginx代理和自签名证书。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;zi-tuo-guan-giteafu-wu&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#zi-tuo-guan-giteafu-wu&quot; aria-label=&quot;Anchor link for: zi-tuo-guan-giteafu-wu&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
自托管gitea服务&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;an-zhuang-gitea&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#an-zhuang-gitea&quot; aria-label=&quot;Anchor link for: an-zhuang-gitea&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
安装gitea&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;由于是Arch系统，gitea可以pacman直接安装，所以就不用docker启动服务了，本机配置还能简单点。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sudo pacman -Sy gitea
sudo systemctl enable gitea.service
sudo systemctl status gitea.service
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;安装完成后启动服务，查看服务日志就可以得到gitea的监听端口为本地的3000端口，浏览器打开后完成安装引导和创建管理员用户。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;pei-zhi-gitea&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#pei-zhi-gitea&quot; aria-label=&quot;Anchor link for: pei-zhi-gitea&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
配置gitea&lt;&#x2F;h2&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sudo vim &amp;#x2F;etc&amp;#x2F;gitea&amp;#x2F;app.ini
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;我不想gitea对外暴露端口，而是使用nginx统一代理服务，所以将协议改为了unix的socket文件，再配置nginx代理指向&lt;code&gt;&#x2F;run&#x2F;gitea&#x2F;gitea.socket&lt;&#x2F;code&gt;就可以了。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre&gt;&lt;code&gt;[server]
PROTOCOL = unix
SSH_DOMAIN = git.kali-team.cn
DOMAIN = git.kali-team.cn
HTTP_ADDR = &amp;#x2F;run&amp;#x2F;gitea&amp;#x2F;gitea.socket
ROOT_URL = http:&amp;#x2F;&amp;#x2F;git.kali-team.cn&amp;#x2F;
APP_DATA_PATH = &amp;#x2F;var&amp;#x2F;lib&amp;#x2F;gitea&amp;#x2F;data
DISABLE_SSH = false
SSH_PORT = 2222
LFS_START_SERVER = true
OFFLINE_MODE = true
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h1 id=&quot;nginxpei-zhi&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#nginxpei-zhi&quot; aria-label=&quot;Anchor link for: nginxpei-zhi&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
nginx配置&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;使用DigitalOcean的在线生成配置文件https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tools&#x2F;nginx?global.app.lang=zhCN&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sudo pacman -S nginx
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
sudo vim &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;nginx.conf
sudo openssl dhparam -out &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;dhparam.pem 2048 
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;值得注意的是ssl配置这里需要填写我们的自签名证书信息&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre&gt;&lt;code&gt;server {
    listen              443 ssl;
    listen              [::]:443 ssl;
    server_name         git.kali-team.cn;

    # SSL
    ssl_stapling               on;
    ssl_stapling_verify        on;
    ssl_certificate     &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;ssl&amp;#x2F;git.kali-team.cn.crt;
    ssl_certificate_key &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;ssl&amp;#x2F;git.kali-team.cn.key;
    ssl_trusted_certificate &amp;#x2F;home&amp;#x2F;kali-team&amp;#x2F;.local&amp;#x2F;share&amp;#x2F;mkcert&amp;#x2F;rootCA.pem;

    # security
    include             nginxconfig.io&amp;#x2F;security.conf;

    # logging
    access_log          &amp;#x2F;var&amp;#x2F;log&amp;#x2F;nginx&amp;#x2F;access.log combined buffer=512k flush=1m;
    error_log           &amp;#x2F;var&amp;#x2F;log&amp;#x2F;nginx&amp;#x2F;error.log warn;

    # reverse proxy
    location &amp;#x2F; {
        proxy_pass            http:&amp;#x2F;&amp;#x2F;unix:&amp;#x2F;run&amp;#x2F;gitea&amp;#x2F;gitea.socket:&amp;#x2F;;
        proxy_set_header Host $host;
        include               nginxconfig.io&amp;#x2F;proxy.conf;
    }

    # additional config
    include nginxconfig.io&amp;#x2F;general.conf;
}

# subdomains redirect
server {
    listen              443 ssl;
    listen              [::]:443 ssl;
    server_name         *.git.kali-team.cn;

    # SSL
    ssl_certificate     &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;ssl&amp;#x2F;git.kali-team.cn.crt;
    ssl_certificate_key &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;ssl&amp;#x2F;git.kali-team.cn.key;
    # ssl_trusted_certificate &amp;#x2F;home&amp;#x2F;kali-team&amp;#x2F;.local&amp;#x2F;share&amp;#x2F;mkcert&amp;#x2F;rootCA.pem
    return              301 https:&amp;#x2F;&amp;#x2F;git.kali-team.cn$request_uri;
}

# HTTP redirect
server {
    listen      80;
    listen      [::]:80;
    server_name .git.kali-team.cn;
    return      301 https:&amp;#x2F;&amp;#x2F;git.kali-team.cn$request_uri;
}

&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h1 id=&quot;zi-qian-ming-zheng-shu&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#zi-qian-ming-zheng-shu&quot; aria-label=&quot;Anchor link for: zi-qian-ming-zheng-shu&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
自签名证书&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;这里使用mkcert快速生产本地测试的自签名证书，生成证书的时候不用root权限，但是将根证书加入系统需要root权限，如果提示需要root密码需要输入一下。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sudo pacman -S mkcert nss
mkcert -install
mkcert -CAROOT
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;安装后可以查看当前用户的&lt;code&gt;CAROOT&lt;&#x2F;code&gt;文件夹有你生成的根证书，也就是上面nginx配置的&lt;code&gt;ssl_trusted_certificate&lt;&#x2F;code&gt;路径。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;@arch ➜ ~  mkcert -CAROOT
&amp;#x2F;home&amp;#x2F;kali-team&amp;#x2F;.local&amp;#x2F;share&amp;#x2F;mkcert
@arch ➜ ~  ls &amp;#x2F;home&amp;#x2F;kali-team&amp;#x2F;.local&amp;#x2F;share&amp;#x2F;mkcert
󰌆 rootCA-key.pem  󰌆 rootCA.pem
@arch ➜ ~  
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;使用下面命令生成指定域名的测试证书，要是你创建根证书这个用户执行，再将证书移动到nginx证书配置文件夹。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;mkcert -cert-file git.kali-team.cn.crt -key-file git.kali-team.cn.key git.kali-team.cn 127.0.0.1
sudo mv git.kali-team.cn.* &amp;#x2F;etc&amp;#x2F;nginx&amp;#x2F;ssl
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;重启nginx服务后可以发现curl和浏览器都信任了当前的证书。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;blog.kali-team.cn&#x2F;blog&#x2F;NUC%E4%B8%BB%E6%9C%BA%E6%90%AD%E5%BB%BAHomelab&#x2F;2024-09-04_00-41.png&quot; alt=&quot;2024-09-04_00-41.png&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h1 id=&quot;action-runner&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#action-runner&quot; aria-label=&quot;Anchor link for: action-runner&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Action Runner&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;平时写点rust项目,经常用到ci自动编译和发布docker，之前都习惯使用github的action编译，发现gitea的大部分workflow其实是兼容github的，所以也将一部分自己代码迁移回gitea编译。&lt;&#x2F;li&gt;
&lt;li&gt;当然要想使用action runner，必须在上面提到的配置文件开启runner，在配置文件中找到并修改为&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;ini&quot; class=&quot;language-ini &quot;&gt;&lt;code class=&quot;language-ini&quot; data-lang=&quot;ini&quot;&gt;[actions]
ENABLED = true
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;an-zhuang-act-runner&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#an-zhuang-act-runner&quot; aria-label=&quot;Anchor link for: an-zhuang-act-runner&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
安装act runner&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;我不希望弄乱本地环境,所以更偏向使用docker部署安装&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;docker pull gitea&amp;#x2F;act_runner:latest
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;如果你的gitea也是最新的可以直接执行上面命令，不然需要安装对应支持的版本，最新版的act可能有些新特性旧版的gitea不支持。&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;sheng-cheng-pei-zhi-wen-jian&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#sheng-cheng-pei-zhi-wen-jian&quot; aria-label=&quot;Anchor link for: sheng-cheng-pei-zhi-wen-jian&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
生成配置文件&lt;&#x2F;h2&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;docker run --entrypoint=&amp;quot;&amp;quot; --rm -it gitea&amp;#x2F;act_runner:latest act_runner generate-config &amp;gt; config.yaml
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;将生成的配置文件模板,根据文档简单修改&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;yaml&quot; class=&quot;language-yaml &quot;&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;# Example configuration file, it&amp;#x27;s safe to copy this as the default config file without any modification.

# You don&amp;#x27;t have to copy this file to your instance,
# just run `.&amp;#x2F;act_runner generate-config &amp;gt; config.yaml` to generate a config file.

log:
  # The level of logging, can be trace, debug, info, warn, error, fatal
  level: info

runner:
  # Where to store the registration result.
  file: .runner
  # Execute how many tasks concurrently at the same time.
  capacity: 1
  # Extra environment variables to run jobs.
  envs: 
   # 设置代理
    RUNNER_TOOL_CACHE: &amp;#x2F;toolcache
    #HTTP_PROXY: http:&amp;#x2F;&amp;#x2F;127.0.0.1:7890&amp;#x2F;
    #HTTPS_PROXY: http:&amp;#x2F;&amp;#x2F;127.0.0.1:7890&amp;#x2F;
    NO_PROXY: 127.0.0.1,localhost,172.17.0.1,192.168.222.11
  # Extra environment variables to run jobs from a file.
  # It will be ignored if it&amp;#x27;s empty or the file doesn&amp;#x27;t exist.
  env_file: .env
  # The timeout for a job to be finished.
  # Please note that the Gitea instance also has a timeout (3h by default) for the job.
  # So the job could be stopped by the Gitea instance if it&amp;#x27;s timeout is shorter than this.
  timeout: 3h
  # The timeout for the runner to wait for running jobs to finish when shutting down.
  # Any running jobs that haven&amp;#x27;t finished after this timeout will be cancelled.
  shutdown_timeout: 0s
  # Whether skip verifying the TLS certificate of the Gitea instance.
  insecure: false
  # The timeout for fetching the job from the Gitea instance.
  fetch_timeout: 5s
  # The interval for fetching the job from the Gitea instance.
  fetch_interval: 2s
  # The labels of a runner are used to determine which jobs the runner can run, and how to run them.
  # Like: &amp;quot;macos-arm64:host&amp;quot; or &amp;quot;ubuntu-latest:docker:&amp;#x2F;&amp;#x2F;gitea&amp;#x2F;runner-images:ubuntu-latest&amp;quot;
  # Find more images provided by Gitea at https:&amp;#x2F;&amp;#x2F;gitea.com&amp;#x2F;gitea&amp;#x2F;runner-images .
  # If it&amp;#x27;s empty when registering, it will ask for inputting labels.
  # If it&amp;#x27;s empty when execute `daemon`, will use labels in `.runner` file.
  labels:
    - &amp;quot;ubuntu-latest:docker:&amp;#x2F;&amp;#x2F;gitea&amp;#x2F;runner-images:ubuntu-latest&amp;quot;

cache:
  # Enable cache server to use actions&amp;#x2F;cache.
  enabled: true
  # The directory to store the cache data.
  # If it&amp;#x27;s empty, the cache data will be stored in $HOME&amp;#x2F;.cache&amp;#x2F;actcache.
  dir: &amp;quot;&amp;quot;
  # The host of the cache server.
  # It&amp;#x27;s not for the address to listen, but the address to connect from job containers.
  # So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
  host: &amp;quot;172.17.0.1&amp;quot;
  # The port of the cache server.
  # 0 means to use a random available port.
  port: 8088
  # The external cache server URL. Valid only when enable is true.
  # If it&amp;#x27;s specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
  # The URL should generally end with &amp;quot;&amp;#x2F;&amp;quot;.
  external_server: &amp;quot;&amp;quot;

container:
  # Specifies the network to which the container will connect.
  # Could be host, bridge or the name of a custom network.
  # If it&amp;#x27;s empty, act_runner will create a network automatically.
  network: &amp;quot;&amp;quot;
  # Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
  privileged: false
  # And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
  options:
  # The parent directory of a job&amp;#x27;s working directory.
  # NOTE: There is no need to add the first &amp;#x27;&amp;#x2F;&amp;#x27; of the path as act_runner will add it automatically. 
  # If the path starts with &amp;#x27;&amp;#x2F;&amp;#x27;, the &amp;#x27;&amp;#x2F;&amp;#x27; will be trimmed.
  # For example, if the parent directory is &amp;#x2F;path&amp;#x2F;to&amp;#x2F;my&amp;#x2F;dir, workdir_parent should be path&amp;#x2F;to&amp;#x2F;my&amp;#x2F;dir
  # If it&amp;#x27;s empty, &amp;#x2F;workspace will be used.
  workdir_parent:
  # Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;gobwas&amp;#x2F;glob
  # You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
  # For example, if you only allow containers to mount the `data` volume and all the json files in `&amp;#x2F;src`, you should change the config to:
  # valid_volumes:
  #   - data
  #   - &amp;#x2F;src&amp;#x2F;*.json
  # If you want to allow any volume, please use the following configuration:
  # valid_volumes:
  #   - &amp;#x27;**&amp;#x27;
  valid_volumes: []
  # overrides the docker client host with the specified one.
  # If it&amp;#x27;s empty, act_runner will find an available docker host automatically.
  # If it&amp;#x27;s &amp;quot;-&amp;quot;, act_runner will find an available docker host automatically, but the docker host won&amp;#x27;t be mounted to the job containers and service containers.
  # If it&amp;#x27;s not empty or &amp;quot;-&amp;quot;, the specified docker host will be used. An error will be returned if it doesn&amp;#x27;t work.
  docker_host: &amp;quot;&amp;quot;
  # Pull docker image(s) even if already present
  force_pull: false
  # Rebuild docker image(s) even if already present
  force_rebuild: false

host:
  # The parent directory of a job&amp;#x27;s working directory.
  # If it&amp;#x27;s empty, $HOME&amp;#x2F;.cache&amp;#x2F;act&amp;#x2F; will be used.
  workdir_parent:
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;这里有一个&lt;code&gt;labels&lt;&#x2F;code&gt;标签参数，开始不理解在docker环境这浪费了很多时间，这里的host宿主机其实就是你运行act_runner程序的环境，如果你的act_runner运行在物理机，使用host标签运行action就会在你的物理机上运行,这是非常不安全的，如果你的act_runner运行在docker，使用host标签action就会在当前的docker运行，没错就是&lt;code&gt;gitea&#x2F;act_runner&lt;&#x2F;code&gt;这个docker，host后面不要接任何docker&lt;&#x2F;li&gt;
&lt;li&gt;例如:&lt;code&gt;&quot;ubuntu-latest:host:&#x2F;&#x2F;my-images:ubuntu-latest&quot;&lt;&#x2F;code&gt;，这个是&lt;strong&gt;无效&lt;&#x2F;strong&gt;的，它根本就不会调用&lt;code&gt;my-images:ubuntu-latest&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;不要改动默认的&lt;code&gt;labels&lt;&#x2F;code&gt;，乖乖用官方的镜像或者自己在&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;actions&#x2F;runner-images&quot;&gt;runner-images&lt;&#x2F;a&gt;找,不然还要自己安装nodejs等等这些action运行环境&lt;&#x2F;li&gt;
&lt;li&gt;如果想在action中调用你自己的docker镜像，正确的做法应该在工作流中的yaml填写&lt;code&gt;container&lt;&#x2F;code&gt;字段&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;yaml&quot; class=&quot;language-yaml &quot;&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;    runs-on: ubuntu-latest
    container:             
        image: rust-base:dev 
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;由于rust编译过程非常缓慢，我开启了缓存，也就是添加了&lt;code&gt;cache&lt;&#x2F;code&gt;下面的&lt;code&gt;172.17.0.1&lt;&#x2F;code&gt;docker网络地址和&lt;code&gt;8088&lt;&#x2F;code&gt;端口参数,同时也设置了缓存文件夹&lt;&#x2F;li&gt;
&lt;li&gt;为了方便启动docker，编写一个&lt;code&gt;docker-compose.yml&lt;&#x2F;code&gt;文件保存启动参数&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;yaml&quot; class=&quot;language-yaml &quot;&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;version: &amp;quot;3&amp;quot;
services:
  act-runner-rust:
    image: gitea&amp;#x2F;act_runner:latest
    environment:
      - GITEA_INSTANCE_URL=你的Gitea服务器地址
      - GITEA_RUNNER_REGISTRATION_TOKEN=你的Token
      - GITEA_RUNNER_NAME=act_runner_rust
      - CONFIG_FILE=&amp;#x2F;config.yaml
    volumes:
      - &amp;#x2F;var&amp;#x2F;run&amp;#x2F;docker.sock:&amp;#x2F;var&amp;#x2F;run&amp;#x2F;docker.sock
      - .&amp;#x2F;act_data:&amp;#x2F;data
      - .&amp;#x2F;act_cache:&amp;#x2F;root&amp;#x2F;.cache
      - .&amp;#x2F;config.yaml:&amp;#x2F;config.yaml
    ports:
      - &amp;quot;8088:8088&amp;quot;
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;这里需要一个注册Token，可以看一下&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.gitea.com&#x2F;zh-cn&#x2F;usage&#x2F;actions&#x2F;act-runner#runner%E7%BA%A7%E5%88%AB&quot;&gt;获取注册令牌&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;映射端口和上面设置缓存的那个端口一样&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;yun-xing&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#yun-xing&quot; aria-label=&quot;Anchor link for: yun-xing&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
运行&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;运行后刷新action列表就可以看到激活的action runner了，如果看不见可以检查一下action runner docker的日志&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash &quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;docker compose up -d
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h1 id=&quot;can-kao&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#can-kao&quot; aria-label=&quot;Anchor link for: can-kao&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
参考&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;Gitea&quot;&gt;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;Gitea&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.gitea.com&#x2F;zh-cn&#x2F;&quot;&gt;https:&#x2F;&#x2F;docs.gitea.com&#x2F;zh-cn&#x2F;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;FiloSottile&#x2F;mkcert&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;FiloSottile&#x2F;mkcert&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.gitea.com&#x2F;installation&#x2F;install-with-docker&quot;&gt;https:&#x2F;&#x2F;docs.gitea.com&#x2F;installation&#x2F;install-with-docker&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener nofollow noreferrer&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.gitea.com&#x2F;usage&#x2F;actions&#x2F;act-runner&quot;&gt;https:&#x2F;&#x2F;docs.gitea.com&#x2F;usage&#x2F;actions&#x2F;act-runner&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        <summary type="html">NUC主机搭建Homelab</summary>
        </entry>
</feed>
