Skip to content

Instantly share code, notes, and snippets.

View fzrhrs's full-sized avatar

fzrhrs

View GitHub Profile
@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 August 28, 2024 07:13
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 August 28, 2024 05:26
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

@fzrhrs
fzrhrs / django.md
Last active November 9, 2016 03:28
Setup django on Mac

Python 2.7 django pip install django

to use mysql pip install MySQL-Python or maybe pip install mysqlclient

database example: