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 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 make gcc curl openssl-devel zlib-devel libffi-devel readline-devel sqlite-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.1.2
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

Comments