hugo/content/posts/1.Learning/A3.Reflections/DevOps/mac_install_homepage.md
2026-03-18 22:36:05 +08:00

2.9 KiB
Raw Blame History

title date tags categories
Mac安装homepage 2024-03-15T21:38:06+08:00
DevOps
Learning
Reflections

1. homepage介绍

官网地址:这里

一个现代化、完全静态、快速、安全、完全代理、高度可定制的应用程序仪表板,集成了 100 多种服务,并可翻译成多种语言。通过 YAML 文件或 Docker 标签发现轻松配置。

2. 为什么要写这个?

因为官网提供的是docker、k8s等安装方式并没有提供mac本地安装而我想在自己电脑上有这么一个。所以就要用源码安装了。

3. 普通安装会出来什么问题?

mac新版本用iTrem2的nohup启动后退出iTrem2后Session会关闭导致nohup不成功

4. 如何处理?

4.1 下载源码,切换分支

git clone https://github.com/gethomepage/homepage.git HomePage
git checkout tags/v0.8.9

4.2 确定node版本编译

# 应该在18以上我是20
# 到工作目录
npm install -g pnpm
pnpm install
pnpm build

4.3 创建plist

地址:~/Library/LaunchAgents

名称:wiki.micah.homepage.plist 注意这里必须plist结尾的

内容:xxx表示你的用户目录

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>

        <key>Label</key>
        <string>wiki.micah.homepage</string>

        <key>RunAtLoad</key>
        <true/>

        <key>KeepAlive</key>
        <true/>

        <key>ThrottleInterval</key>
        <integer>60</integer>

        <key>EnvironmentVariables</key>
        <dict>
               <key>HOME_DIR</key>
               <string>/Users/xxx</string>
               <key>APP_DIR</key>
               <string>/Users/xxx/gethomepage/homepage</string>
               <key>HOMEPAGE_ALLOWED_HOSTS</key>
               <string>homepage.xxxx,localhost:3000</string>
        </dict>

        <key>ProgramArguments</key>
        <array>
            <string>/bin/zsh</string>
            <string>-c</string>
            <string>-l</string>
            <string>source $HOME_DIR/.zshrc; /Users/micah/xxx/bin/pnpm start</string>
        </array>
        <key>WorkingDirectory</key>
        <string>/Users/xxx/gethomepage/homepage</string>

        <key>StandardOutPath</key>
        <string>/Users/xxx/homepage.micah.wiki.node.info.log</string>

        <key>StandardErrorPath</key>
        <string>/Users/xxx/logs/homepage.micah.wiki.node.error.log</string>

    </dict>
</plist>

4.4 加入到启动项目中

# 加入到启动项目
launchctl load ~/Library/LaunchAgents/wiki.micah.homepage.plist
# 从启动项目删除
launchctl unload ~/Library/LaunchAgents/wiki.micah.homepage.plist