Skip to content

Instantly share code, notes, and snippets.

View fzrhrs's full-sized avatar

fzrhrs

View GitHub Profile

sudo visudo deploy ALL=(ALL) NOPASSWD:ALL

@fzrhrs
fzrhrs / systemctl
Last active December 1, 2024 07:17
sudo systemctl status sidekiq
sudo systemctl status sidekiq.service
sudo systemctl status redis
sudo systemctl status website_puma_staging.service (staging / production)
sudo systemctl status nginx
Clear from console, all:
Sidekiq.redis(&:flushdb)

sudo su

cd /etc/sudoers.d/

visudo -f deploy-user-puma-services

Add deploy ALL=(ALL) NOPASSWD: /bin/systemctl restart puma_website.service

@fzrhrs
fzrhrs / systemd for service and socket.md
Created August 27, 2024 09:47
WIP - Setup service and socket

Assume the name of the application is "website":

For socket: sudo vi /etc/systemd/system/website_puma_production.socket

[Unit]
Description=Puma Socket for website (production)

[Socket]
@fzrhrs
fzrhrs / Part 3 of 3: Rails Deployment Ubuntu 24.04 (2024).md
Last active November 10, 2024 12:47
Part 3 of 3: Rails Deployment Ubuntu 2404 (2024)

Now, the final part of the initial deployment for Rails with RVM, Postgres, Ubuntu, NGINX, Capistrano, Puma 6 & Systemd.

Go to /etc/nginx/sites-available

Create a conf file, I usually name it after my app. For this tutorial, let's call it "website":

upstream puma_website {
  server unix:///home/deploy/website/shared/sockets/puma.sock;
}
@fzrhrs
fzrhrs / Part 2 of 3: Rails Deployment Ubuntu 24.04 (2024).md
Last active August 28, 2024 05:27
Part 2 of 3: Rails Deployment Ubuntu 24.04 (2024).md

Summary:

  1. Add Capistrano and other relevant gems to Gemfile.
  # Deployment
  gem 'capistrano'
  gem 'capistrano-rvm'
  gem 'capistrano-rails'
  gem 'capistrano-bundler'
@fzrhrs
fzrhrs / Part 1 of 3: Rails Deployment Ubuntu 24.04 (2024).md
Last active April 4, 2025 05:36
Part 1 of 3: Rails Deployment Ubuntu 24.04 (2024)

Step 1 - Initial Server Setup

Assuming you already ssh-ed into the server as root.

Create a new user

We need to set up a new user account with reduced privileges for day-to-day use.

sudo adduser deploy
@fzrhrs
fzrhrs / bash.md
Created January 24, 2018 11:31
Cheatsheet

grep something from text file: grep "phrase-here" production.log; tail -f production.log