JoyLau's Blog

JoyLau 的技术学习与思考

记录

MacOS 升级到 10.15 后,每次打开 Tunnelblick 都会提示 The tmp system folder (/tmp) is not secure
虽然点继续可以使用,但是无法打开软件的配置界面, 会直接闪退
于是就想着修复这个问题
可是过程并没有那么顺利

  1. 首先查看官方文档

https://tunnelblick.net/cSystemFolderNotSecure.html

根据文档提示执行操作:

1
2
sudo chown root:admin /tmp; sudo chmod 0755 /tmp
sudo chown root:wheel /private/tmp; sudo chmod 01777 /private/tmp

重启,问题继续…..

  1. 升级最新版本
    通过查看官方文档, 了解到官方在 Tunnelblick 3.8.0+ 版本后修复这一问题
    于是想着升级就可以了
    首先升级到最新版本 Tunnelblick 3.8.2 (build 5480)
    可是,问题继续…..

  2. 完全卸载
    于是继续查看官方文档,发现官方有个卸载程序: Tunnelblick Uninstaller 1.12
    于是下载下来完全卸载程序
    之后重装,问题继续……

  3. 再读文档

Disconnect all configurations and quit Tunnelblick*
Control-click the “Uninstaller” and click “Open”
Click on “Test” or “Uninstall”
When the uninstall is complete, restart your computer.

restart your computer.

我忽略了这个问题

于是完全卸载完后重启, 重启之后再重装, 问题继续……

但是这次提示不太一样, 错误信息:

The installation or repair took too long or failed. Try again?

  1. 再次执行第一步的命令
    重启软件,解决!!!

备注:

For OS X 10.11 and higher (including all versions of macOS):

Folder Owner Group Permissions Octal Terminal command to repair
/Applications root admin rwxrwxr-x 0775 sudo chown root:admin /Applications; sudo chmod 0775 /Applications
/Library root wheel rwxr-xr-x 0755 sudo chown root:wheel /Library; sudo chmod 0755 /Library
/Library/Application Support root admin rwxr-xr-x 0755 sudo chown root:admin /Library/Application\ Support; sudo chmod 0755 /Library/Application\ Support
/tmp (10.11 - 10.14) root wheel rwxr-xr-x 0755 sudo chown root:wheel /tmp; sudo chmod 0755 /tmp
/tmp (10.15+) root admin rwxr-xr-x 0755 sudo chown root:admin /tmp; sudo chmod 0755 /tmp
/private root wheel rwxr-xr-x 0755 sudo chown root:wheel /private; sudo chmod 0755 /private
/private/tmp root wheel rwxrwxrwt 1777 sudo chown root:wheel /private/tmp; sudo chmod 01777 /private/tmp
/Users root admin rwxr-xr-x 0755 sudo chown root:admin /Users; sudo chmod 0755 /Users
/usr root wheel rwxr-xr-x 0755 sudo chown root:wheel /usr; sudo chmod 0755 /usr
/usr/bin root wheel rwxr-xr-x 0755 sudo chown root:wheel /usr; sudo chmod 0755 /usr/bin

背景

继续上篇文章来写, 本次基于 Breed 系统刷入集客 AP 系统, 来完成 KVR 漫游配置

材料

  1. 集客 AP 固件 GECOOS_AP243P_mt7621_LLELL_5.8_2020013000.bin : http://file.cnrouter.com/index.php/Index/index.html?model_id=40&device_type_id=6

我目前为止下载的版本为: 5.8_2020013000

步骤

  1. 打开 Breed 管理界面: http://192.168.1.1
  2. 选择固件,上传
  3. 耐心等待重启
  4. 由于 AP 没有 DHCP 功能, 没有自动分配 IP, 我们需要手动将 ip 设置为 6.6.6.x 网段, 子网掩码: 255.255.255.0, 网关不填
  5. 浏览器访问: http://6.6.6.6, 默认密码为 admin

这时前期工作已经完成, 可以把路由器接入家里的主路由了

配置 AP

  1. 首先进入系统管理设置设备名称和重新修改密码
  2. 进入无线管理->SSID 设置WIFI 信息, 只要设置一台即可,下面通过克隆的方式来配置其他的 AP
  3. 进入微AC->AP列表

配置信息如下

注意

  1. 我三台 新路由 3,其中有一台是 1.1 版本的,无法开启 5G WIFI
    新路由 3 版本识别:
    查询路由器底部 SN 前三位:
    PND: 1.1
    MND: 1.1+
    HND: 1.2

  2. 注意 WIFI 切换不同的信道,防止互相干扰

信道切换

之后可以使用 WIFI 魔盒对家里的各个地方进行网速和稳定性及漫游的测试了✿✿ヽ(°▽°)ノ✿

背景

目前想要组 WIFI 漫游可选的方案有 AC + AP 或者 mesh 组网, 可这些的价格都不便宜, 而我选择用 2 台之前很火的矿机新路由 3 (Newifi D2) 来组 AP 实现 KVR 漫游
想要组 KVR 漫游, 2 台路由必须刷入集客 AP 固件, 而刷入集客 AP 固件前必须先刷入 Breed 固件
本篇介绍新路由 3 如何刷入该固件

我的新路由 3

一次性搞了 3 台

新路由 3

概念介绍

802.11k

通过创建优化的频道列表,802.11k 标准可帮助设备快速搜索附近可作为漫游目标的 AP。如果当前接入点的信号强度变弱,您的设备将进行扫描来确定是否有此列表中的目标接入点。

802.11v

具备“即将解除关联”功能的 BSS 转换管理可向网络的控制层提供附近接入点的负载信息,从而影响客户端漫游行为。设备在确定可能的漫游目标时会考量这些信息。

DMS 可优化无线网络上的多播流量传输。设备会利用这些信息来增强多播通信,并保持电池续航能力。

BSS 最大空闲服务有助于客户端和接入点在没有流量传输时,高效地决定保持关联的时长。设备会利用这些信息来保持电池续航能力。

802.11r

当您的设备在同一网络中从一个 AP 漫游到另一个 AP 时,802.11r 会使用一项名为“快速基本服务集转换”(FT) 的功能更快地进行认证。FT 适用于预共享密钥 (PSK) 和 802.1X 鉴定方法。

以上来自苹果官网对于 KVR 的介绍: https://support.apple.com/zh-cn/HT202628

步骤

材料准备

  1. newifi-d2-jail-break.ko

操作

  1. 重置现有路由器系统: 开机状态下按住 reset 键 5 秒,等待重启
  2. 进入 http://192.168.99.1 初始化路由器,设置好 WIFI 和密码
  3. 浏览器访问 http://192.168.99.1/newifi/ifiwen_hss.html 开启路由器的 ssh 登录, 用户名为 root ,密码为刚才设置的密码
  4. 使用 scp 命令拷贝 newifi-d2-jail-break.ko 到 tmp 目录下: scp ./newifi-d2-jail-break.ko root@192.168.99.1:/tmp
  5. 刷入系统: insmod /tmp/newifi-d2-jail-break.ko
  6. 等待 30 秒左右, 断电, 再按住 reset 键通电
  7. 此时路由器分配的网段为 192.168.1.0
  8. 访问 http://192.168.1.1 进行设置

注意

  1. newifi-d2-jail-break.ko 是恩山论坛上一个大神破解的,如果在 Breed 官网(https://breed.hackpascal.net/)下载固件 breed-mt7621-newifi-d2.bin,是无法通过自身恢复模式刷入固件的,别问我怎么知道的

错误信息

1
Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.1.2:dockerBuild (default-cli) on project xxxxx: Build to Docker daemon failed, perhaps you should use a registry that supports HTTPS so credentials can be sent safely, or set the 'sendCredentialsOverHttp' system property to true

解决

这是由于 from image 配置的基础镜像需要认证信息

提示你指定 sendCredentialsOverHttp 参数为 true 即可

于是可以在命令行手动执行:

1
mvn compile com.google.cloud.tools:jib-maven-plugin:1.1.2:dockerBuild -DsendCredentialsOverHttp=true

注意是 DsendCredentialsOverHttp

每次去手动执行就很烦

在 idea 里配置如下, 以后双击即可构建

Docker-Jib-SendCredentialsOverHttp

背景

以前博客多多少少写个一些常用工具的代理设置,这里做一个汇总, 以后有更多工具使用代理直接在此处记录了

说明

如果代理有用户名密码的话, 使用

1
2
3
http://username:password@127.0.0.1:1087
# 或者
sockts5://username:password@127.0.0.1:1087

Mac 终端代理设置

export HTTP_PROXY=http://127.0.0.1:1087

export SOCKS5_PROXY=socks5://127.0.0.1:1086

export ALL_PROXY=socks5://127.0.0.1:1086

我一般直接使用最后一种方式,简单粗暴

HomeBrew 代理设置

同上, 因为 brew 走的 curl,代理设置通用

Git 代理配置

需要全局 git 都走代理

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

取消

git config --global --unset http.proxy
git config --global --unset https.proxy

但是有时候我们并不需要所有的 git 仓库都走代理,可以去掉上述的命令中的 –global,然后到你需要走代理的那个 git 仓库下执行命令,或者添加配置:

单独配置 git 走代理
在 .git => config 文件中加入配置

1
2
3
4
[https]
proxy = socks5://127.0.0.1:1080
[http]
proxy = socks5://127.0.0.1:1080

配置仅 Github 走代理

1
git config --global http.https://github.com.proxy http://127.0.0.1:7890

注意这里不需要配置 https, 配置 http 就可以生效了

Linux 终端代理

Mac 终端代理设置

Ubuntu 桌面版使用全局代理

以前我使用的是: http://blog.joylau.cn/2018/08/08/Git-Proxy-And-Ubuntu-Global-Proxy/
现在我使用的是: Clash

Gradle 配置代理

配置 gradle.properties

1
2
3
4
5
6
7
8
9
10
11
12
13
## http
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

## https
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

另一种快速的方法是使用阿里云的 maven 仓库
配置如下:
在用户目录下的 .gradle 的目录下新建文件 init.gradle

1
2
3
4
5
6
7
8
9
allprojects {
repositories {
mavenLocal()
maven {
url "http://maven.aliyun.com/nexus/content/groups/public"
}
mavenCentral()
}
}

Docker 配置代理

在命令行使用 export HTTP_PROXY=xxxx:xx , 命令行里绝大部分命令都可以使用此代理联网,但是安装的 docker 不行,无法 pull 下来镜像文件,想要 pull 使用代理的话,需要添加代理的变量
vim /usr/lib/systemd/system/docker.service
添加

Environment=HTTP_PROXY=http://xxxx:xxx
Environment=HTTPS_PROXY=http://xxxx:xxx

保存

systemctl deamon-reload
systemctl restart docker

或者在配置文件 daemon.json 配置代理

1
2
3
4
5
6
7
{
"proxies": {
"http-proxy": "http://proxy.example.com:3128",
"https-proxy": "https://proxy.example.com:3129",
"no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}

npm 使用代理

npm 支持 http 代理,但是不支持 socks 代理

1
2
npm config set proxy "http://localhost:1087"
npm config set https-proxy "http://localhost:1087"

该设置方式是永久的,全局的,想要取消的话,使用

删除代理

1
2
npm config delete proxy
npm config delete https-proxy

apt-get 使用代理

使用参数 -o Acquire

1
sudo apt-get -o Acquire::http::proxy="http://host:port" update/install ...

该代理是一次性的,关闭 shell 即失效

JVM 使用代理配置

1
-DsocksProxyHost=172.16.1.201 -DsocksProxyPort=60798

在该代理基础上需要排除一些不需要使用代理的, 需要再加上

1
-Dhttp.nonProxyHosts="192.168.1.*|172.16.*.*" -DsocksNonProxyHosts="192.168.1.*|172.16.*.*"

Postman 使用 socks5 代理

默认的 Postman 不支持使用 socks5 代理,支持 http和 https 代理, 需要转换下即可
使用方法:

  1. 安装 http-proxy-to-socks npm install -g http-proxy-to-socks
  2. 开启转发 hpts -s 172.16.1.200:60798 -p 7951 本地的 7951 端口转发到远程的 60798 端口
  3. 之后正常设置 http 代理即可

Chrome 使用 socks5 代理

使用快捷方式设置代理或者使用命令行启动设置代理参数

1
"C:\Program Files\JumpServer\applications\Chrome\Application\chrome.exe" --proxy-server=socks5://ip:port

何为

以前我都是服务器上执行定时任务,在凌晨的时候 pull 博客仓库在 hexo 编译, 在上传到 github 静态资源库, 在 pull 静态资源库到 nginx 目录下,这样实现个人博客的发布

真: 放弃定时任务, 采用 github 的钩子, 在博客仓库有 push 行为时,立马执行上述操作, 以前直接在服务器上写的脚本来执行,这次决定将这些操作打包成一个 docker 镜像, 随时随地可部署

避免了部署还需要配置定时任务和写一批脚本的问题.

环境准备

  1. 以 Ubuntu 18.04 为基础镜像,进行镜像的制作
  2. docker run -it -name blog-auto-publish ubuntu:18.04 /bin/bash
  3. apt update
  4. apt install git
  5. apt install vim
  6. rm -rf /etc/apt/sources.list
  7. vim /etc/apt/sources.list
script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

  1. apt update
  2. apt install curl
  3. curl -sL https://deb.nodesource.com/setup_13.x | bash
  4. apt-get install -y nodejs
  5. npm install hexo -g
  6. apt install nginx
  7. apt install fcgiwrap

新建目录

mkdir /my-blog
mkdir -p /my-blog/bash
mkdir -p /my-blog/logs

克隆仓库

git clone https://github.com/JoyLau/blog.git

cd blog

npm install

建立命令

vim /my-blog/bash/init.sh

vim init.sh

1
2
3
#!/usr/bin/env bash
chown -R www-data:www-data /my-blog/* && service fcgiwrap start && service nginx start && tail -f -n 500 /my-blog/logs/publish.log

vim /my-blog/bash/pull-deploy.sh

1
2
3
4
5
6
7
8
9
10
11
#! /usr/bin/env bash
cd /my-blog/blog && \
## git checkout -- _config.yml && \
git pull && \
echo `pwd` && \
## update config
## sed -i "s/https:\/\/name:password@github.com\/JoyLau\/blog-public.git/https:\/\/$GITHUB_REPO_USERNAME:$GITHUB_REPO_PASSWORD@github.com\/$GITHUB_REPO_USERNAME\/$GITHUB_REPO_NAME.git/g" _config.yml && \
## hexo clean && \
hexo g
## hexo d

vim /my-blog/bash/publish.sh

1
2
3
4
5
6
#!/bin/bash
echo "Content-Type:text/html"
echo ""
echo "ok"
/my-blog/bash/pull-deploy.sh>/my-blog/logs/publish.log

注意: 前 2 行是必须的.这样发出请求会有返回

配置 nginx

vim /etc/nginx/sites-available/default

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
server {
listen 80 default_server;
listen [::]:80 default_server;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

}

server {
listen 8080 default_server;
listen [::]:8080 default_server;

root /my-blog/bash;

server_name _;

location ~ ^/.*\.sh {
gzip off;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}


nginx -t 检查错误

注意

  1. fcgiwrap 不能以 root 组或者 root 用户运行, 这点在配置文件 /etc/init.d/fcgiwrap 可以配置,默认为 www-data, 因此 nginx 的用户也设置为 www-data,同时设置 /my-blog 目录下所属者为 www-data

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
FROM nas.joylau.cn:5007/joy/blog.joylau.cn:1.0

LABEL maintainer="blog.joylau.cn"

ENV GITHUB_REPO_USERNAME ""
ENV GITHUB_REPO_PASSWORD ""
ENV GITHUB_REPO_NAME ""
ENV REPO_INFO ""

EXPOSE 80

EXPOSE 8080

CMD ["sh", "/my-blog/bash/init.sh"]

打包镜像:
docker build -t nas.joylau.cn:5007/joy/blog.joylau.cn:1.0 .

打包后镜像大小为: 294 MB

使用

docker run -p 8081:80 -p 8082:8080 -d –name blog.joylau.cn nas.joylau.cn:5007/joy/blog.joylau.cn:1.0

备注

  1. 80 端口提供的服务为 blog 页面
  2. 8080 端口提供的服务为执行 shell 命令
  3. 提供 webhook 为 http://host:port/publish.sh ,通过请求这个请求来更新博客
  4. 查看日志文件有 /my-blog/logs/publish.log 和 nginx 的日志文件 /var/log/nginx/error.log

后续优化备忘

  1. 删除原来的 /var/log/nginx/error.log 日志里的错误信息,现有的错误信息是是测试使用产生的
  2. 在镜像里就执行一遍 chown -R www-data:www-data /my-blog/* , 否则的话容器刚启动的时候会很慢, 可以不执行 hexo g ,使用 hexo g –watch 实时监听文件变化,也不需要 nginx 了,直接使用 hexo-server ,开启 –debug 参数打印详细日志信息
  3. 考虑将 publish.sh 的最后一行命令不等待执行完就返回,现在的情况是部署到配置较低的机器上执行很慢,会导致请求超时,虽然不影响执行结果
  4. 配置好容器内的时区,使得日志的时间戳更明显

优化更新记录 [2020-04-01]

  1. 设置时区:
1
2
3
4
apt-get install tzdata
然后依次选择 6 , 70 即可

使用 dpkg-reconfigure tzdata 来重写选择
  1. 清空 nginx 日志文件
1
2
echo "" > /var/log/nginx/error.log 
echo "" > /var/log/nginx/access.log
  1. webhooks 不等待执行完就返回
    vim /my-blog/bash/publish.sh
1
2
3
4
5
#!/bin/bash
echo "Content-Type:text/html"
echo ""
echo "ok"
/my-blog/bash/pull-deploy.sh>/my-blog/logs/publish.log 2>&1 &
  1. 实时监听文件变化
    vim /my-bog/bash/init.sh
1
2
3
4
5
#!/usr/bin/env bash
service fcgiwrap start
service nginx start
cd /my-blog/blog/ && nohup hexo g --watch >/my-blog/logs/hexo-generate.log 2>&1 &
tail -f -n 500 /my-blog/logs/publish.log /my-blog/logs/hexo-generate.log /var/log/nginx/error.log /var/log/nginx/access.log
  1. 不使用 dockerfile 来构建,直接使用 docker commit
1
docker commit -c 'CMD ["sh", "/my-blog/bash/init.sh"]' -c "EXPOSE 80" -c "EXPOSE 8080" -a "JoyLau" -m "JoyLau's Blog Docker Image"  blog nas.joylau.cn:5007/joy/blog.joylau.cn:2.1

优化更新记录 [2020-04-02]

更新脚本:

  1. init.sh
1
2
3
4
5
6
7
8
#!/usr/bin/env bash
echo "Hello! log file in /my-blog/logs/publish.log"
service fcgiwrap start
service nginx start
su - www-data -c "cd /my-blog/blog/ && git pull"
cd /my-blog/blog/
hexo g --watch | tee -a /my-blog/logs/publish.log

  1. publish.sh
1
2
3
4
5
#!/bin/bash
echo "Content-Type:text/html"
echo ""
echo "ok\r\n"
/my-blog/bash/pull-deploy.sh | tee -a /my-blog/logs/publish.log
  1. pull-deploy.sh
1
2
3
4
5
#! /usr/bin/env bash
echo "Prepare to update Blog Posts....."
cd /my-blog/blog/
git pull

优化更新记录 [2020-04-07]

新增 republish.sh

1
2
3
4
#!/usr/bin/env bash
echo "prepare republish......"
cd /my-blog/blog/
hexo clean && hexo g

修改 init.sh

1
2
3
4
5
#!/usr/bin/env bash
echo "Hello! log file in /my-blog/logs/publish.log"
service fcgiwrap start
service nginx start
su - www-data -c "cd /my-blog/blog/ && git pull && hexo g --watch | tee -a /my-blog/logs/publish.log"

使用 Dockerfile 构建 [2020-04-21 更新]

在容器里各种操作是在是太黑箱了,日后极难维护,这里我编写 Dockerfile 来构建镜像

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
FROM node:latest
MAINTAINER joylau 2587038142.liu@gmail.com
LABEL Descripttion="This image is JoyLau's Bolg"
ENV GIT_REPO="https://github.com/JoyLau/blog.git"
ENV BRANCH master
EXPOSE 80 8081
ADD sources.list /etc/apt/sources.list
RUN apt-get update &&\
apt-get install -y gosu nginx git fcgiwrap &&\
npm install hexo -g &&\
npm install -g cnpm --registry=https://registry.npm.taobao.org
COPY nginx.default.conf /etc/nginx/sites-available/default
RUN mkdir -p /my-blog/bash /my-blog/logs
COPY *.sh /my-blog/bash/
RUN chown -R www-data:www-data /my-blog &&\
chmod -R 777 /var/www &&\
chmod +x /my-blog/bash/*.sh
ENTRYPOINT ["/my-blog/bash/docker-entrypoint.sh"]
CMD ["/my-blog/bash/init.sh"]

docker-entrypoint.sh

1
2
3
4
5
6
7
8
9
#!/bin/bash
set -e
if [ "$1" = '/my-blog/bash/init.sh' -a "$(id -u)" = '0' ]; then
service nginx start
service fcgiwrap start
echo "☆☆☆☆☆ base service has started. ☆☆☆☆☆"
exec gosu www-data "$0" "$@"
fi
exec "$@"

init.sh

1
2
3
4
5
6
7
#! /bin/bash
cd /my-blog
echo "☆☆☆☆☆ your git repo is [$GIT_REPO] ; branch is [$BRANCH]. ☆☆☆☆☆"
git clone -b $BRANCH --progress $GIT_REPO blog
cd blog
cnpm install -d
hexo g --watch --debug | tee -a /my-blog/logs/genrate.log

nginx.default.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
server {
listen 80 default_server;
listen [::]:80 default_server;

index index.html index.htm index.nginx-debian.html;

server_name _;

root /my-blog/blog/public;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

}

server {
listen 8081 default_server;
listen [::]:8080 default_server;

root /my-blog/bash;

server_name _;

location ~ ^/.*\.sh {
gzip off;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

publish.sh

1
2
3
4
5
6
7
#!/bin/bash
echo "Content-Type:text/html"
echo ""
echo "<h1>ok</h1>"
echo "<h3>Prepare to update Blog Posts.....</h3>"
cd /my-blog/blog/
git pull

republish.sh

1
2
3
4
5
6
7
#!/bin/bash
echo "Content-Type:text/html"
echo ""
echo "<h1>ok</h1>"
echo "<h3>republish blog.....</h3>"
cd /my-blog/blog
hexo g --force

sources.list

1
2
3
4
5
6
7
8
9
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

启动

1
docker run -d --restart always --name blog -p 8001:80 -p 8002:8081 nas.joylau.cn:5007/joy/blog.joylau.cn:3.0

加入代理 [2020-04-28更新]

遇到初始化容器很慢的情况, 原因是 git clone 很慢
本次在 init.sh 脚本里加入了 git 代理设置, 有代理的条件的可以设置代理
快速启动容器

问题

brew update 遇到错误, 错误信息如下:

script
1
2
3
4
5
6
7
Updating Homebrew...
Warning: You are using macOS 10.15.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience, as you are running this pre-release version.

解决方式

  1. brew doctor

运行后发现源为科大的源, 于是切换回原来的官方的 brew 源

script
1
2
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

有其他问题,建议按照提示一一解决掉

  1. brew update

更新成功

  1. brew config

查看配置

0%