This is an opinionated handbook on how I migrated all my Rails apps off the cloud and into VPS.
This is how I manage real production loads for my Rails apps. It assumes:
- Rails 7+
- Ruby 3+
- PostgreSQL
- Ubuntu Server 24.04
- Capistrano, Puma, Nginx
This is an opinionated handbook on how I migrated all my Rails apps off the cloud and into VPS.
This is how I manage real production loads for my Rails apps. It assumes:
The content of this article is my last tech sharing with my team at https://pixta.vn/.
| source :rubygems | |
| gem "puma" | |
| gem "sinatra" |
| HTMLElement.prototype.slideToggle = function(duration) { | |
| if (window.getComputedStyle(this).display === 'none') { | |
| _slideDown(this); | |
| } else { | |
| _slideUp(this); | |
| } | |
| }; | |
| HTMLElement.prototype.slideUp = function(duration) { | |
| _slideUp(this) |
| package main | |
| import ( | |
| "golang.org/x/tour/tree" | |
| "fmt" | |
| ) | |
| // Walk walks the tree t sending all values | |
| // from the tree to the channel ch. | |
| func Walk(t *tree.Tree, ch chan int) { |
| FROM ruby:2.6.6-alpine3.12 | |
| LABEL maintainer="hungle" | |
| # Minimal requirements to run a Rails app | |
| RUN apk add --no-cache --update build-base \ | |
| linux-headers \ | |
| git \ | |
| postgresql-dev \ | |
| nodejs \ | |
| yarn \ |
| # https://hakibenita.com/fast-load-data-python-postgresql | |
| from typing import Iterator, Dict, Any, Optional | |
| from urllib.parse import urlencode | |
| import datetime | |
| #------------------------ Profile | |
| import time |
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)