Eric Guo's blog.cloud-mes.com

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

Fix core.fsyncObjectFiles Is Deprecated; Use core.fsync Instead in Gitlab

Permalink

After upgrade to higher version of Gitlab, when I push the repository to Gitlab, it gives warning like:

The warning when you push
remote: warning: core.fsyncObjectFiles is deprecated; use core.fsync instead
remote: Resolving deltas: 100% (2654/2654), completed with 614 local objects.
remote: warning: core.fsyncObjectFiles is deprecated; use core.fsync instead
remote: warning: core.fsyncObjectFiles is deprecated; use core.fsync instead

More recent commit fix it, but maybe due to I upgrade from 14.6 source code installation, so the setting is not apply.

Running below command to fix it.

sudo su - git
git config -l
git config --global --unset core.fsyncObjectFiles
git config --global --add core.fsync objects,derived-metadata,reference
git config --global --add core.fsyncMethod fsync

Compare with before setting and after FYI:

Before
core.autocrlf=input
gc.auto=0
repack.writebitmaps=true
receive.advertisepushoptions=true
receive.fsckobjects=true
After
core.autocrlf=input
core.fsync=objects,derived-metadata,reference
core.fsyncmethod=fsync
gc.auto=0
repack.writebitmaps=true
receive.advertisepushoptions=true
receive.fsckobjects=true

Deploy Homeland Forum Rails App on Rocky Linux 8

Permalink

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 v18

Using nodesource distribution

curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
dnf install -y nodejs
yum install gcc-c++ make
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
yum install yarn

Install postgresql

Following DO manual

dnf module list postgresql
sudo dnf module enable postgresql:13
sudo dnf install postgresql-server
sudo dnf install postgresql-devel
sudo postgresql-setup --initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -i -u postgres
psql

Install postgresql-client

sudo dnf module enable postgresql:13/client
sudo dnf module install postgresql:13/client

Install homeland other depends

yum install redis
yum install memcached
yum install ImageMagick
yum install ghostscript

Setup thape_forum user account

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

Install rbenv & ruby

sudo dnf -y install git git-lfs make gcc curl openssl-devel zlib-devel libffi-devel readline-devel sqlite-devel
sudo yum --enablerepo=powertools install libyaml-devel libffi-devel
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv -v
rbenv install -l
rbenv install 3.2.3
ruby --version
echo "gem: --no-document" > ~/.gemrc
gem update --system

Prepare the capistrano deploy folder

cd /var
sudo mkdir -p www/thape_forum
cd www
sudo chown -R thape_forum:thape_forum thape_forum/
bundle exec cap production puma:config

Create postgresql db user and import DB

sudo su - postgres
createuser thape_forum
psql
ALTER ROLE thape_forum LOGIN;
CREATE DATABASE thape_forum_prod WITH ENCODING='UTF8' OWNER=thape_forum;
logout
psql -d thape_forum_prod -f thape_forum_db.sql

Install nginx-mod-http-image-filter

sudo dnf makecache --refresh
sudo dnf -y install nginx-mod-http-image-filter

Original post

Install Ruby 3.2

Ruby 3.2 need Rust to build JIT.

yum --enablerepo=powertools install libyaml-devel
yum install -y rust

Using the NFS Drive in Ubuntu 20.04

Permalink

Run as root
apt-get install nfs-common
mkdir -p /mnt/codebase_backup
chown root:root codebase_backup/
mount -t nfs 172.17.0.1:/ifs/NFS-Directory/codebase_backup-NFS /mnt/codebase_backup
echo '172.17.0.1:/ifs/NFS-Directory/codebase_backup-NFS /mnt/codebase_backup nfs defaults 0 0' >> /etc/fstab

Clean Xcode Disk Usage

Permalink

xcode-select -p # default /Library/Developer/CommandLineTools
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
xcrun simctl delete unavailable
sudo xcode-select --switch /Library/Developer/CommandLineTools

Eric-Guo's Macbook Shortcut Cheetsheet

Permalink

CMD keys

Shortcut Description
cmd+ctl+Q Lock screen

FN keys

Shortcut Description
fn+A Navigate Dock
fn+C Control Center
fn+E Emoji & Symbols
fn+F Enter/Exit Full Screen
fn+H Desktop
fn+M Navigate Main Menu
fn+N Notifications
fn+Q Quick Note

original

shortcut in Finder

Shortcut Description
cmd+opt+P Show/Hide Path bar

Quick Clean Server Disk Usage Command in Safe Way

Permalink

SystemD journal clean

journalctl --disk-usage
sudo journalctl --vacuum-size=2000M # Delete log files until the disk space taken falls below the specified size:

Or see further command

Apt cache clean

sudo apt-get clean

Yum cache clean

sudo yum clean all

Yarn cache clean

yarn cache clean --force

Docker cache clean

docker system df
docker system prune -a

original from stackoverflow