Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

Install Open Project V16 in a Rocky Linux 9

Permalink

I already install an open project instance one and half year ago, but it’s retired to sync with the production server OS version, which is Rocky Linux 8.10. After Ruby 3.4 released, I found the nokogiri v1.18 version and grpc v1.71 version both need a new GLIBC_2.29 version which is unavailable in Rocky Linux 8 series.

So I decide install a new Open Project instance server for the new production.

Disable SELinux

vi /etc/selinux/config
grubby --update-kernel ALL --args selinux=0

Install htop and atop

sudo dnf update
sudo dnf install epel-release
sudo dnf install htop
sudo dnf install atop

Install nginx

sudo dnf install nginx

Install node.js v22

Using nodesource distribution

curl -fsSL https://rpm.nodesource.com/setup_22.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo yum install -y nodejs
yum groupinstall 'Development Tools'

Install yarn

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn

Install postgresql 16 client

Following DO manual

dnf module list postgresql
sudo dnf module enable postgresql:16
sudo dnf install postgresql-devel glibc-all-langpacks
sudo dnf install postgresql-contrib # pg_trgm btree_gist require by open project
sudo dnf install mysql-devel # if need to link to mysql server

Setup open_project user account

adduser open_project
cd /etc/sudoers.d/
echo "open_project ALL=(ALL) NOPASSWD:ALL" > 30-open_project-user
sudo su - open_project
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys # and paste your public key
chmod 600 .ssh/authorized_keys

Install rbenv and ruby-build

whoami # should run as a open_project
git clone https://git.thape.com.cn/rails/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
~/.rbenv/bin/rbenv init # also edit ~/.bash_profile
# As an rbenv plugin
mkdir -p "$(rbenv root)"/plugins
git clone https://git.thape.com.cn/rails/ruby-build.git "$(rbenv root)"/plugins/ruby-build
git clone https://git.thape.com.cn/rails/rbenv-china-mirror.git "$(rbenv root)"/plugins/rbenv-china-mirror

Install Ruby 3.3.8

Ruby 3.3.8 need Rust to build JIT.

dnf config-manager --enable crb
dnf install libyaml-devel
yum install -y rust # version 1.79.0
rbenv install -l
rbenv install 3.3.8
rbenv global 3.3.8
rbenv shell 3.3.8
echo "gem: --no-document" > ~/.gemrc
gem update --system

Prepare the capistrano deploy folder

whoami # should run as a open_project
cd /var/www
sudo mkdir open_project
sudo chown open_project:open_project open_project/

Using mirror when deploy

Run in the release rails root folder

bundle config mirror.https://rubygems.org https://gems.ruby-china.com

Setting the open project settings

/etc/environment
OPENPROJECT_EDITION=bim
OPENPROJECT_APP__TITLE=天华项目全生命周期管理
OPENPROJECT_APP__SHORT__TITLE=PLM
OPENPROJECT_HOST__NAME=plm-staging.thape.com.cn
OPENPROJECT_EMAIL__DELIVERY__METHOD="smtp"
OPENPROJECT_SMTP__ADDRESS="smtp.thape.com.cn"
OPENPROJECT_SMTP__PORT="25"
OPENPROJECT_SMTP__DOMAIN="thape.com.cn"
OPENPROJECT_SMTP__AUTHENTICATION="login"
OPENPROJECT_SMTP__USER__NAME="plm"
OPENPROJECT_SMTP__PASSWORD=""
OPENPROJECT_SMTP__ENABLE__STARTTLS__AUTO="true"
OPENPROJECT_SMTP__OPENSSL__VERIFY__MODE="none"
OPENPROJECT_ENTERPRISE__TRIAL__CREATION__HOST="https://www.google-analytics.com"
GRUF_OP_SERVER="172.17.1.1:10009"
WX_TEMPLATE_ID=""
WX_WORK_PACKAGE_DETAIL="https://plm.thape.com.cn/work_packages/:id"
MP_QRCODE_ABS_PATH="/var/www/open_project/shared/public/static/mp_qrcode.jpg"
LOGO_ABS_PATH="/var/www/open_project/shared/public/static/logo_plm.png"
CSP_FRAME_SRC="https://ith-workspace.thape.com.cn"
CSP_CONNECT_SRC="https://analytics.thape.com.cn"
WECHAT_AUTH_JWT_SECERT=""
WECHAT_AUTH_ITH_URL="/ith/wechat/ppm/login"
/etc/systemd/system/puma_plm.service
[Unit]
Description=Puma HTTP Server for open_project (staging)
After=syslog.target network.target
[Service]
Type=simple
WatchdogSec=10
User=open_project
EnvironmentFile=/etc/environment
WorkingDirectory=/var/www/open_project/current
ExecStart=/home/open_project/.rbenv/bin/rbenv exec bundle exec puma -e production
ExecReload=/bin/kill -SIGUSR1 $MAINPID
# if we crash, restart
RestartSec=10
Restart=on-failure
StandardOutput=append:/var/www/open_project/shared/log/puma.log
StandardError=append:/var/www/open_project/shared/log/puma.log
SyslogIdentifier=puma_plm
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
bundle exec rake openproject:plugins:register_frontend
bundle exec rake i18n:js:export
bundle exec rake db:seed
sudo journalctl -u puma_plm # check system log and fix errors
sudo systemctl start puma_plm

Upload custom fonts

/var/www/open_project/shared/public
gzip -9r op_public_files.zip fonts/ static/ WW_verify_*.txt

Change IP

Rocky 8 network change:

vi /etc/sysconfig/network-scripts/ifcfg-ens192

Rocky 9 network change:

vi /etc/NetworkManager/system-connections/ens192.nmconnection
nmcli connection reload /etc/NetworkManager/system-connections/ens192.nmconnection
nmcli connection up /etc/NetworkManager/system-connections/ens192.nmconnection

Migrate DB From Redis 7.4 to 7.2 and Skip the RDB Version 12 Error

Permalink

After I copy redis dump.rdb from redis 7.4 to my Macbook homebrew redis 7.2 I got Can’t handle RDB format version 12 error:

# /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
20066:C 17 Apr 2025 10:39:34.935 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
20066:C 17 Apr 2025 10:39:34.935 * Redis version=7.2.7, bits=64, commit=00000000, modified=0, pid=20066, just started
20066:C 17 Apr 2025 10:39:34.935 * Configuration loaded
20066:M 17 Apr 2025 10:39:34.935 * Increased maximum number of open files to 10032 (it was originally set to 256).
20066:M 17 Apr 2025 10:39:34.935 * monotonic clock: POSIX clock_gettime
Redis 7.2.7 (00000000/0) 64 bit
Running in standalone mode
Port: 6379
PID: 20066
https://redis.io
20066:M 17 Apr 2025 10:39:34.936 # WARNING: The TCP backlog setting of 511 cannot be enforced because kern.ipc.somaxconn is set to the lower value of 128.
20066:M 17 Apr 2025 10:39:34.936 * Server initialized
20066:M 17 Apr 2025 10:39:34.936 # Can't handle RDB format version 12
20066:M 17 Apr 2025 10:39:34.936 # Fatal error loading the DB, check server logs. Exiting.

Two option available, upgrade redis version via redis.io

Using high version

brew tap redis/redis
brew install --cask redis

The solution is ugly as redis will give you rc version of redis and it depend on the LLVM@18, which takes 1.7GB…

Stay redis 7.2

redis-cli shutdown
brew uninstall redis
brew untap redis/redis
# make sure your DB no need!
rm /opt/homebrew/var/db/redis/dump.rdb
rm /opt/homebrew/etc/redis-sentinel.conf
rm /opt/homebrew/etc/redis.conf
rm /opt/homebrew/etc/redis.conf.default
brew install redis
brew services start redis

Using redis-dump to dump and restore DB.

redis-dump -u 127.0.0.1:6379 -d 0 > db_db0.json
cat db_db0.json | redis-load -d 0

Make Tabnine Continue Work After Official Stop Support the Sublime Text

Permalink

Today I found my TabNine stop working and after 2 hours, I found it officially stop support Sublime Text

But if you having the API key here is how to make it continue work in local mode. Goto ‘/Users/[username]/Library/Application Support/Sublime Text/Packages’ and change ‘dl_binaries.sh’ as below.

Change targets to your platform if required.

#!/bin/sh
set -e
# This script downloads the binaries for the most recent version of TabNine.
version="4.4.25"
targets='aarch64-apple-darwin'
rm -rf ./binaries
echo "$targets" | while read target
do
mkdir -p binaries/$version/$target
path=$version/$target
echo "downloading $path"
curl -sS https://update.tabnine.com/bundles/$path/TabNine.zip > binaries/$path/TabNine.zip
unzip -o binaries/$path/TabNine.zip -d binaries/$path
rm binaries/$path/TabNine.zip
chmod +x binaries/$path/*
done
binariesver=$(grep -Eo '!binaries/.*' .gitignore | cut -c10-)
sed "s+$binariesver+/$version+g" .gitignore >.gitignore.tmp && mv .gitignore.tmp .gitignore

Run it to download, The 4.4.25 is the most stable version and 4.256.0 is the last known version works with sublime text 4 build 4196.

You need also block update.tabnine.com in hosts file to block TabNine auto upgrade, although codota says you can type TabNine::disable_auto_update.

Known model list and support language

  • Universal Small - ce94127b
  • Universal Medium - b8373e4b
  • cpp_specialized_model - b6e9f0da
  • python - 4caf976f
  • ruby_specialized_model - 29b87067
  • go - 598b1f5b
  • java - af421852
  • rust_specialized_model - 46f17fa1

C#, JS, CSS, HTML and PHP belongs to Universal model

A Rails Developer Installation Log on MacBook M4 Pro

Permalink

I got my fouth MacBook Pro today. It’s the second Apple Silicon CPU Mac. I bought in PDD and 48G 1T slightly high-end model.

Mac App Store install list

  • AdBlock Pro (11.2.3)
  • Affinity Designer (2.6.2)
  • Affinity Photo (2.6.2)
  • Affinity Publisher (2.6.2)
  • Aware (1.2.0)
  • Diagrams (2.2.0)
  • Elmedia Video Player (8.1)
  • iA Writer (5.6.16)
  • iMovie (10.3.1)
  • Jump Desktop (9.0.99)
  • Keynote (14.4)
  • LiquidText (2.10.36)
  • Logoist 5 (5.1.2)
  • MockFlow (2.7.9)
  • Numbers (14.4)
  • OwlOCR (4.9.2)
  • Pages (14.4)
  • Paper (95)
  • PasteNow (2.22)
  • Pixelmator Pro (3.6.17)
  • SimpleMind Pro (2.6.1)
  • SQLPro Studio (2025.9)
  • Tampermonkey (5.3.6218)
  • Texifier (1.9.31)
  • Things (3.21.6)
  • WeChat (3.8.10)
  • WeCom (4.1.33)
  • Xcode (16.3)

brew install cask list

  • aldente
  • hype
  • chromedriver
  • imageoptim
  • rapidapi
  • keybase
  • rar
  • zoom
  • cursor
  • rubymine
  • dash
  • google-chrome
  • sublime-merge
  • discord
  • google-cloud-sdk
  • obs
  • sublime-text

brew install console list

  • bash
  • fzf
  • gdu
  • gh
  • git
  • git-filter-repo
  • git-trim
  • go
  • highlight
  • imagemagick
  • jq
  • libpq
  • memcached
  • mysql-client
  • node
  • percona-server
  • poetry
  • postgresql
  • pytorch
  • redis
  • ruby
  • ruff
  • rust
  • smartmontools
  • tmux
  • vips
  • wget
  • yamllint
  • yarn
  • zoxide

bash-it setup

bash-it enable plugin zoxide proxy base
bash-it enable alias general
bash-it enable completion bash-it brew bundler capistrano cargo aliases export gcloud gem go npm rake ssh system yarn
zoxide init

Some not sign exe file

xattr -dr com.apple.quarantine /opt/homebrew/bin/rar
# put .rarreg.key to ~
xattr -dr com.apple.quarantine /opt/homebrew/Caskroom/chromedriver/135.0.7049.42/chromedriver-mac-arm64/chromedriver

.profile

export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/lib/ruby/gems/3.4.0/bin:$PATH:/opt/homebrew/opt/postgresql@17/bin:$HOME/.local/bin:$HOME/.cargo/bin"
export HISTSIZE=80000
export ADBLOCK=true
export HOMEBREW_GITHUB_API_TOKEN=
export HOMEBREW_EDITOR="subl"
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_AUTO_UPDATE_SECS=1800
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export EDITOR="vim"
export BUNDLER_EDITOR="subl"
export GEM_EDITOR="subl"
export BASH_IT_HTTP_PROXY=http://127.0.0.1:6152/
export BASH_IT_HTTPS_PROXY=http://127.0.0.1:6152/
export GITHUB_APP_ID=
export GITHUB_APP_SECRET=
export NO_ORACLE_ENHANCED=1
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export MANPATH=/usr/share/man:/opt/homebrew/share/ubuntu_man
export NODE_COMPILE_CACHE=/Users/guochunzhong/.cache/nodejs-compile-cache
export DEVISE_JWT_SECRET_KEY=
export WEFOCUSIN_WECHAT_APPID=
export WEFOCUSIN_WECHAT_SECRET=
export WEFOCUSIN_WECHAT_TOKEN=
export WEFOCUSIN_WECHAT_AES_KEY=
export OPENPROJECT_CORE=/Users/guochunzhong/git/sso/openproject
export DEEPSEEK_ACCESS_TOKEN=sk-
export SWARM_AGENT_DEFAULT_MODEL=deepseek-chat

Please notice ubuntu_man is used by Dash

.bash_profile

#!/usr/bin/env bash
source /Users/guochunzhong/.profile
alias bde='bundle exec'
alias bdc='bundle check'
alias bdpd='bundle exec cap production deploy'
alias glg="git log --graph --pretty=format:'%Cred%h%Crest -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
alias minio-server='minio server /usr/local/var/minio'
alias convert_screen_cast='ffmpeg -i Screencast.mov -vcodec h264 -acodec mp3 Screencast.mp4'
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return ;;
esac
# Path to the bash it configuration
export BASH_IT="/Users/guochunzhong/.bash_it"
# Lock and Load a custom theme file.
# Leave empty to disable theming.
# location "$BASH_IT"/themes/
export BASH_IT_THEME='inretio'
# Some themes can show whether `sudo` has a current token or not.
# Set `$THEME_CHECK_SUDO` to `true` to check every prompt:
#THEME_CHECK_SUDO='true'
# (Advanced): Change this to the name of your remote repo if you
# cloned bash-it with a remote other than origin such as `bash-it`.
# export BASH_IT_REMOTE='bash-it'
# (Advanced): Change this to the name of the main development branch if
# you renamed it or if it was changed for some reason
# export BASH_IT_DEVELOPMENT_BRANCH='master'
# Your place for hosting Git repos. I use this for private repos.
export GIT_HOSTING='git@git.domain.com'
# Don't check mail when opening terminal.
unset MAILCHECK
# Change this to your console based IRC client of choice.
export IRC_CLIENT='irssi'
# Set this to the command you use for todo.txt-cli
export TODO="t"
# Set this to the location of your work or project folders
#BASH_IT_PROJECT_PATHS="${HOME}/Projects:/Volumes/work/src"
# Set this to false to turn off version control status checking within the prompt for all themes
export SCM_CHECK=true
# Set to actual location of gitstatus directory if installed
#export SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus"
# per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must
#export GITSTATUS_NUM_THREADS=8
# Set Xterm/screen/Tmux title with only a short hostname.
# Uncomment this (or set SHORT_HOSTNAME to something else),
# Will otherwise fall back on $HOSTNAME.
#export SHORT_HOSTNAME=$(hostname -s)
# Set Xterm/screen/Tmux title with only a short username.
# Uncomment this (or set SHORT_USER to something else),
# Will otherwise fall back on $USER.
#export SHORT_USER=${USER:0:8}
# If your theme use command duration, uncomment this to
# enable display of last command duration.
#export BASH_IT_COMMAND_DURATION=true
# You can choose the minimum time in seconds before
# command duration is displayed.
#export COMMAND_DURATION_MIN_SECONDS=3
# Set Xterm/screen/Tmux title with shortened command and directory.
# Uncomment this to set.
#export SHORT_TERM_LINE=true
# Set vcprompt executable path for scm advance info in prompt (demula theme)
# https://github.com/djl/vcprompt
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
# (Advanced): Uncomment this to make Bash-it reload itself automatically
# after enabling or disabling aliases, plugins, and completions.
# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
# Uncomment this to make Bash-it create alias reload.
# export BASH_IT_RELOAD_LEGACY=1
# Load Bash It
source "$BASH_IT"/bash_it.sh
eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(zoxide init bash)"
export START_DIR="/Users/guochunzhong/git"
if [[ $PWD == $HOME ]]; then
cd $START_DIR
fi

Install macpm

brew install pipx
pipx install macpm

An AI Roadmap in 2025 for a Midsize non-IT Company Chinese

Permalink

中等规模的非 IT 企业在 2025 年的 AI 应用路线图

人工智能(AI)在过去两年呈爆发式发展,特别是 2024 年 12 月 26 日 DeepSeek V3 模型的发布,标志着中国正式进入 AI 智能时代。对于非 IT 主业的传统企业而言,制定清晰的 AI 战略路线图已成为数字化转型的关键。

目前的 AI 现状与方向选择

DeepSeek V3 为何能成为里程碑

在 DS V3 实现大规模商用前,国内企业面临两大困境:其一,国际主流模型受地缘政策限制难以合规使用;其二,可用模型的调用成本居高不下(单次请求约 0.8 元),严重制约规模化应用。DS V3 通过技术突破将成本降低 40 倍(单次成本约 0.02 元),使企业级应用真正具备经济可行性。

自部署 vs 调用 API

目前看来自部署的唯一优势就是隐私安全,其他完全不能和直接调用厂商 API 比较,调用 DS 的 API,2 月份花费不到 1 元,即使考虑需求在未来增长百倍,一年也不过 1200 元的费用,而一块 4090 的显卡目前价格在 2 万左右,等于可以用几十年。

更重要的是调用 DS API 的模型是 670b 的 V3 或者 R1,从模型参数看,也比单块 4090 跑的 14b 要大 47 倍,而且这个差距不可弥补,使用 AI 最重要的是 AI 的智能,14b 的模型基本等于小学生的智能,而 V3 绝对可以达到大学本科的水平。

自部署的 14b 在实际测试中,对于合同分析的问题,比如“收款条件第一笔是否为预付款,回答是或者否”,令人难以置信的是,硅基流动的线上版本的DeepSeek-R1-Distill-Qwen-14B的思考链效果也远远好于本地部署的Ollama 的 DeepSeek-R1:14b,理论上这两个模型应该是完全一样,实在令人不解。

同时我还在微信群中看到有某单位领导部署 70b 模型后与公网差距巨大的截图,可见即使是完全相同的模型,在部署的时候的一些 knowhow 可能仍然是不公开的。

DeekSeek 在 2025 年 3 月开源第 6 天的X 推文中指出,DS 在部署中可以达到 545% 的理论每天利润率,与此同时,伯克利尤洋却可以算出每月亏损 4 亿的奇怪数字,所以自部署模型无论从经济或者技术角度,可能都不是目前的最佳选择,这至少是目前看到的形式。

RAG vs 模型微调

另外一个存在选择的方向是使用 RAG 搜索嵌入,或者对模型进行微调,这个在网上讨论也是非常多的,目前来看,RAG 的灵活性和实时性要好得多,可以优先尝试,其实这两个方向不存在矛盾,在以后积累了一定的问答数据集后,同样可以对模型进行微调。

但第一优先的仍然应该是 RAG,RAG 的方式方法其实也非常多,在穷尽这些方法前我认为没有必要去看模型微调,尤其是 RAG 很直观,永远能从 Prompt Log 中看到引用了那些知识内容,理论上只要提供的准确的文本信息,模型能力到位,是完全可以得到准确答案的。这种确定性和实时性非常重要。

相比之下模型微调只有在经过很长时间的一段时间的模型调整后才能查看结果,而且若对这次模型调整的新的例子的推理结果不满意的话,又要将准确的例子作为训练素材进行重新微调,一次微调耗时 1~2 天(硅基流动调用频率),显然无法和 RAG 对比实时性。

当然在积累足够量的标注数据(≥1 万条)后,我们仍然可对基础模型进行领域适配。但需注意单次微调周期约 48 小时,且需要持续迭代优化。

另外我们仍然需要考虑模型的优化速度,可能这些微调都没必要做,因为可能当我们的项目做了 3,4 个月后,更优秀的模型早就出了,可能都不用做微调。

直接使用厂商 API vs 通过 AI 中间平台调用

由于 AI 调用的返回极其缓慢,导致直接调用厂商 API 性能收益约等于 0,可能通过 AI 中间平台调用会损失 1 秒,但是相比呼叫 AI 模型厂商动则需要等待 20 多秒的情况,可以忽略不计。

使用 dify 应用开发平台,可以免费获得 prompt 调试环境,API 调用历史分析等功能,同时还可以将 AI 模型调整的工作从较为瓶颈的程序员下放到运营和产品经理身上,甚至最终用户身上,更加便于 AI 的使用者理解 AI 目前的局限性,所以肯定是使用类似 dify 这样的应用开发平台合适。直接调用厂商 API 都没有这些功能。

未来的方向与展望

现在 AI 的瓶颈已经从模型端转移到应用端,对中等规模的非 IT 主业企业来说,最重要的是找到自己公司流程上各个可以运用 AI 智能,降低人力的应用点,逐个补强,至少是用 AI 平替这些点,这样才能在未来 AI 含量越来越高的市场环境中获得成本和反应速度优势,当然是在保持人类智能质量的前提下。

目前我们已经在用的是 7777 IT 服务问答助手,PLM 问答助手,在研发的有 BIM 空间名称识别,合同分析测试,相信还有很多微小的可以用 AI 替代人工的点存在,所以 AI 应用在 2025 年大有可为。

Install Sassc in Sequoia and Brew Ruby 3.4.1

Permalink

My new Sequoia 15.3 seems not loading C++ standard library headers and lead several native gem failed to compile:

┌─[±][master U:1 ✗][ 5:13PM][product_hunt]
└─▪ bundle update
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Fetching sassc 2.4.0
Installing sassc 2.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /opt/homebrew/lib/ruby/gems/3.4.0/gems/sassc-2.4.0/ext
/opt/homebrew/opt/ruby/bin/ruby extconf.rb
creating Makefile
current directory: /opt/homebrew/lib/ruby/gems/3.4.0/gems/sassc-2.4.0/ext
make DESTDIR\= sitearchdir\=./.gem.20250128-60884-opsqne sitelibdir\=./.gem.20250128-60884-opsqne clean
current directory: /opt/homebrew/lib/ruby/gems/3.4.0/gems/sassc-2.4.0/ext
make DESTDIR\= sitearchdir\=./.gem.20250128-60884-opsqne sitelibdir\=./.gem.20250128-60884-opsqne
compiling ./libsass/src/ast.cpp
In file included from ./libsass/src/ast.cpp:3:
In file included from ./libsass/src/sass.hpp:55:
In file included from ./libsass/src/memory.hpp:8:
./libsass/src/memory/allocator.hpp:8:10: fatal error: 'vector' file not found
8 | #include <vector>
| ^~~~~~~~
1 error generated.
make: *** [ast.o] Error 1
make failed, exit code 2
Gem files will remain installed in /opt/homebrew/lib/ruby/gems/3.4.0/gems/sassc-2.4.0 for inspection.
Results logged to /opt/homebrew/lib/ruby/gems/3.4.0/extensions/arm64-darwin-24/3.4.0/sassc-2.4.0/gem_make.out
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:126:in 'Gem::Ext::Builder.run'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:52:in 'block in Gem::Ext::Builder.make'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:44:in 'Array#each'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:44:in 'Gem::Ext::Builder.make'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/ext_conf_builder.rb:44:in 'Gem::Ext::ExtConfBuilder.build'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:195:in 'Gem::Ext::Builder#build_extension'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:229:in 'block in Gem::Ext::Builder#build_extensions'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:226:in 'Array#each'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/ext/builder.rb:226:in 'Gem::Ext::Builder#build_extensions'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/rubygems/installer.rb:844:in 'Gem::Installer#build_extensions'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/rubygems_gem_installer.rb:111:in 'Bundler::RubyGemsGemInstaller#build_extensions'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/rubygems_gem_installer.rb:30:in 'Bundler::RubyGemsGemInstaller#install'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/source/rubygems.rb:205:in 'Bundler::Source::Rubygems#install'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/installer/gem_installer.rb:55:in 'Bundler::GemInstaller#install'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/installer/gem_installer.rb:17:in 'Bundler::GemInstaller#install_from_spec'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/installer/parallel_installer.rb:133:in 'Bundler::ParallelInstaller#do_install'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/installer/parallel_installer.rb:124:in 'block in Bundler::ParallelInstaller#worker_pool'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/worker.rb:62:in 'Bundler::Worker#apply_func'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/worker.rb:57:in 'block in Bundler::Worker#process_queue'
<internal:kernel>:168:in 'Kernel#loop'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/worker.rb:54:in 'Bundler::Worker#process_queue'
/opt/homebrew/lib/ruby/site_ruby/3.4.0/bundler/worker.rb:90:in 'block (2 levels) in Bundler::Worker#create_threads'
An error occurred while installing sassc (2.4.0), and Bundler cannot continue.
In Gemfile:
sassc-rails was resolved to 2.1.2, which depends on
sassc

Below is the correct solution:

xcrun --show-sdk-path
CPLUS_INCLUDE_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 bundle install
CPLUS_INCLUDE_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 gem install rmmseg-cpp-new

Record the Post Body in Nginx Access Log

Permalink

Sometime, it is easier to debug the Rails program if nginx can record the user’s post body and here is how to.

server {
log_format postdata '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'request_body:"$request_body"';
location @puma_rails_production {
client_body_buffer_size 16k;
client_max_body_size 4G;
access_log /var/www/oauth2id/shared/log/nginx.access.log postdata;
proxy_set_header X-Request-Body $request_body;
}
}

Warning: It’s not compatible with .NET apps, detail not yet check so recommand only enable during debug.

Import and Export PostgreSQL DB in Gzip Way

Permalink

Export PostgreSQL DB in gzip format

pg_dump open_project_prod -O -x | gzip > open_project_prod_db.sql.gz

Import directly in gzip format

psql -d postgres
DROP DATABASE openproject_development;
CREATE DATABASE openproject_development WITH ENCODING='UTF8';
ALTER DATABASE openproject_development SET TIMEZONE='Asia/Shanghai';
\q
# gunzip < open_project_prod_db.sql.gz | psql -d open_project_ppp --username=op_ppp -W --host=172.17.1.66
gunzip < open_project_prod_db.sql.gz | psql -d openproject_development