# cat /etc/openwrt_version
08.28.2022
# cat /etc/openwrt_release
DISTRIB_ID='512'
DISTRIB_RELEASE='22.03.0-rc6'
DISTRIB_REVISION='08.28.2022'
DISTRIB_TARGET='x86/64'
DISTRIB_ARCH='x86_64'
DISTRIB_DESCRIPTION="dk-router 08.28.2022 by Kiddin'"
DISTRIB_TAINTS='busybox override'
# opkg list-installed |grep nfs
kmod-fs-nfs - 5.15.58-1
kmod-fs-nfs-common - 5.15.58-1
kmod-fs-nfs-common-rpcsec - 5.15.58-1
kmod-fs-nfs-v4 - 5.15.58-1
kmod-fs-nfsd - 5.15.58-1
luci-app-nfs - git-22.240.61616-a97e7f2
nfs-kernel-server - 2.5.4-4
nfs-kernel-server-utils - 2.5.4-4
nfs-utils - 2.5.4-4
nfs-utils-libs - 2.5.4-4

由于我的两块 3TB 和一块 4TB 硬盘都接在软路由上,软路由跑着 OpenWrt 系统。2022年搭建了 home-server, 使用 pve 虚拟了 debian11 运行。要在 debian11 使用 nfs 挂载 OpenWrt 上挂载出来的几块硬盘。前几天发现在 debian11 上无法查看 /mnt/ 目录下的文件,后面才意识到是 nfs server 端挂了。

我的 OpenWrt 环境如上,安装的 nfs 版本以及各个依赖情况也如上,ssh 进入 OpenWrt,执行 /etc/init.d/nfsd restart 然后 debian11 这边就能重新查看文件了。

OpenWrt 上 nfs 的配置如下

# cat /etc/config/nfs

config share
        option enabled '1'
        option path '/mnt/four'
        option clients '10.10.10.0/24'
        option options 'rw,all_squash,insecure,sync,no_subtree_check'

config share
        option enabled '1'
        option path '/mnt/ThreeTB'
        option clients '10.10.10.0/24'
        option options 'rw,all_squash,insecure,sync,no_subtree_check'

config share
        option enabled '1'
        option path '/mnt/FiveOO'
        option clients '10.10.10.0/24'
        option options 'rw,all_squash,insecure,sync,no_subtree_check'

config share
        option enabled '1'
        option path '/mnt/ThreeTB2'
        option clients '10.10.10.0/24'
        option options 'rw,all_squash,insecure,sync,no_subtree_check'

2024-05-26 08:49:15 update:由于暂时没有了公网IP,这个地址变成了 memos.940304.xyz

前阵子利用 memos 搭建了一个私服,利用起来就感觉还挺不错的,很方便易用。个人记录一些备忘,分享一些日常都行,一个很大的槽点就是目前暂不支持已登录用户的相互评论功能。

目前我把它当作个人微博使用,我的主页是 https://emby.940304.xyz:15230/u/1 。也开放了用户注册,欢迎各位朋友注册使用,地址是 https://emby.940304.xyz:15230/

纽约时间比加州时间早三个小时, New York is 3 hours ahead of California,

但加州时间并没有变慢。 but it does not make California slow.

有人 22 岁就毕业了, Someone graduated at the age of 22,

但等了五年才找到好的工作! but waited 5 years before securing a good job!

有人 25 岁就当上 CEO , Someone became a CEO at 25,

却在 50 岁去世。 and died at 50.

也有人迟到 50 岁才当上 CEO , While another became a CEO at 50,

然后活到 90 岁。 and lived to 90 years.

有人依然单身, Someone is still single,

同时也有人已婚。 while someone else got married.

奥巴马 55 岁就退休, Obama retires at 55,

川普 70 岁才开始当总统。 but Trump starts at 70.

世上每个人本来就有自己的发展时区。 Absolutely everyone in this world works based on their Time Zone.

身边有些人看似走在你前面, People around you might seem to go ahead of you,

也有人看似走在你后面。 some might seem to be behind you.

但其实每个人在自己的时区有自己的步程。 But everyone is running their own RACE, in their own TIME.

不用嫉妒或嘲笑他们。 Don’t envy them or mock them.

他们都在自己的时区里,你也是! They are in their TIME ZONE, and you are in yours!

生命就是等待正确的行动时机。 Life is about waiting for the right moment to act.

所以,放轻松。 So, RELAX.

你没有落后。 You’re not LATE.

你没有领先。 You’re not EARLY.

在命运为你安排的属于自己的时区里,一切都准时。 You are very much ON TIME, and in your TIME ZONE Destiny set up for you.

在馒头,我被 ban 了两个账号了,甚是可惜。最近又拿到邀请,成功入站,决心认真一点对待。40天未登录就ban账号的规则说实话还是有点严格,但是没办法,得遵循他们的规则

馒头考核-已达标

打算写代码自动模拟登录的,但是稍许有些麻烦。网上搜了一下也有现成的模拟登录的项目,但看上去部署太复杂,就没有兴趣阅读下去了。

发现可以利用 cron 和 curl 直接模拟登录,借用 chrome dev tool 的 copy request as curl(bash) 功能,可以把整个请求包含 cookie 复制下来,方便通过 curl 调用。

copy as curl

写一个 bash 脚本,cron 执行访问馒头的 userdetail 页面。

脚本位置 /home/dk/temp/mteam.sh, cron 内容, 意思是每周五的上午11点执行一次,并把日志输出到 /home/dk/temp/mteam-login-logs 目录下的 log 文件里,文件名举例: 2023-02-21_14-27-26.log

cron 内容

0 11 * * 5 bash /home/dk/temp/mteam.sh >/home/dk/temp/mteam-login-logs/$(date +%Y-%m-%d_%H-%M-%S).log

mteam.sh 脚本本身内容(已打码)

#!/bin/bash

set -e

curl 'https://kp.m-team.cc/userdetails.php?id=xxxxxx' \
  -H 'authority: kp.m-team.cc' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
  -H 'accept-language: zh,zh-CN;q=0.9,en-US;q=0.8,en;q=0.7' \
  -H 'cache-control: no-cache' \
  -H 'cookie: tp=xxxxxx; cf_clearance=xxxxxx' \
  -H 'dnt: 1' \
  -H 'pragma: no-cache' \
  -H 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'sec-fetch-dest: document' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: none' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
  --compressed

查看生成的 log 文件,请求之后返回了一个完整的 html 静态页面

20230222140724

关于 Mattermost 服务端的安装搭建在此不做赘述,如果有朋友需要经验可以留言评论。我使用的是官方的 Dockerfile 构建并运行的。主程序 Dockerfile 位于 app/Dockerfile,mm 官方 GitHub 仓库地址: https://github.com/mattermost/mattermost-server

FROM alpine:3.10

# Some ENV variables
ENV PATH="/mattermost/bin:${PATH}"
ENV MM_INSTALL_TYPE=docker

# Build argument to set Mattermost edition
ARG edition=enterprise
ARG PUID=1002
ARG PGID=1003
ARG MM_BINARY=
#ARG MM_VERSION=5.37.9
ARG MM_VERSION=7.8.0

# Install some needed packages
RUN apk add --no-cache \
        ca-certificates \
        curl \
        jq \
        libc6-compat \
        libffi-dev \
        libcap \
        linux-headers \
        mailcap \
        netcat-openbsd \
        xmlsec-dev \
        tzdata \
        && rm -rf /tmp/*

# Get Mattermost
RUN mkdir -p /mattermost/data /mattermost/plugins /mattermost/client/plugins \
        && if [ ! -z "$MM_BINARY" ]; then curl $MM_BINARY | tar -xvz ; \
                elif [ "$edition" = "team" ] ; then curl https://releases.mattermost.com/$MM_VERSION/mattermost-team-$MM_VERSION-linux-amd64.tar.gz?src=docker-app | tar -xvz ; \
                else curl https://releases.mattermost.com/$MM_VERSION/mattermost-$MM_VERSION-linux-amd64.tar.gz?src=docker-app | tar -xvz ; fi \
        && cp /mattermost/config/config.json /config.json.save \
        && rm -rf /mattermost/config/config.json \
        && addgroup -g ${PGID} mattermost \
        && adduser -D -u ${PUID} -G mattermost -h /mattermost -D mattermost \
        && chown -R mattermost:mattermost /mattermost /config.json.save /mattermost/plugins /mattermost/client/plugins \
        && setcap cap_net_bind_service=+ep /mattermost/bin/mattermost

USER mattermost

#Healthcheck to make sure container is ready
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1

# Configure entrypoint and command
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /mattermost
CMD ["mattermost"]

# Expose port 8000 of the container
EXPOSE 8000

# Declare volumes for mount point directories
VOLUME ["/mattermost/data", "/mattermost/logs", "/mattermost/config", "/mattermost/plugins", "/mattermost/client/plugins"]

修改 MM_VERSION 为 7.8.0 之后发现卡在了 # Get Mattermost 的步骤,原因是与官方的服务器网络不通畅,下载速度特别慢,还容易丢失连接。

curl https://releases.mattermost.com/$MM_VERSION/mattermost-$MM_VERSION-linux-amd64.tar.gz?src=docker-app | tar -xvz

将此压缩包下载到本地, https://releases.mattermost.com/7.8.0/mattermost-7.8.0-linux-amd64.tar.gz?src=docker-app

然后上传到我的 Seafile,生成分享链接后通过 curl 获取文件直链,参考文章 获取 seafile 分享的文件直链 ,再更改 Dockerfile,就可以很快的 docker-compose build 了。

当时用 curl/wget -O mattermost-7.8.0-linux-amd64.tar.gz 都没有成功,拿到文件直链轻松解决。 https://emby.940304.xyz:23399/seafhttp/files/ac915dbb-14b7-4815-80c9-2d989f1830a2/mattermost-7.8.0-linux-amd64.tar.gz.tar

更新 mattermost 版本

mattermost 7.8.0