Eric Guo's blog.cloud-mes.com

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

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

My Monthly Subscription Review List

Permalink

No one like subscription, but we must pay something we really need every month and here is my list in RMB:

  1. (21) iCloud 200GB
  2. (15) Apple Music
  3. (23) Dragonruby Pro (annual 42 USD)
  4. (33) bandwagon host (month 33 USD)
  5. (6) Adblock Pro (annual 70 RMB)
  6. (6) MarginNote 3 OCR (annual 68 RMB)
  7. (28) Rubymine (annual 53 USD)
  8. (27) Medium Member (annual 50 USD)
  9. (6) blog domain (annual 10 USD)
  10. (1.5) 香哈菜谱 (annual 18 RMB)
  11. (10) AWS hosting
  12. (16.8) Meituan biking
  13. (50) Slack (month 8 USD)
  14. (38) Google Workspace Business Starter (month 6 USD)

So totally 282 RMB per month have to pay.