Skip to content

Instantly share code, notes, and snippets.

View rameerez's full-sized avatar
creating

Javi rameerez

creating
View GitHub Profile
@rameerez
rameerez / remove-site.sh
Last active December 26, 2023 03:40
Remove site from Apache conf
#!/bin/bash
# Ensure the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo -e "${RED}ERROR: This script must be run as root.${NC}"
exit 1
fi
# Define aesthetics
RED='\033[0;31m'
@rameerez
rameerez / exit_the_cloud.md
Last active August 25, 2026 16:49
☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

☁️ How I got off the cloud and migrated everything from AWS to a VPS in Hetzner

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
@rameerez
rameerez / aws-amazon-linux-al2023-ec2-instance-setup-for-rails-docker-kamal-deployment.sh
Last active January 14, 2024 20:27
Configure an AWS EC2 instance running Amazon Linux 2023 to deploy Rails apps using Kamal (Docker)
#!/bin/bash
# This scrips takes a clean AWS Amazon Linux 2023 AMI and installs and configures
# everything needed to deploy a Rails app to it using Kamal.
# The resulting state is a clean instance ready to accept Kamal (Dockerized) apps.
# --- AESTHETICS ---
# Define the color code for green for echo messages
@rameerez
rameerez / aws-ubuntu-server-ec2-instance-setup-for-rails-docker-kamal-deployment.sh
Last active December 31, 2024 16:41
Docker - Configure a clean Ubuntu Server instance to deploy Rails apps using Kamal
#!/bin/bash
sudo adduser --disabled-password docker
sudo chmod 755 /home/docker
sudo usermod -aG docker ${USER}
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install -y ufw
@rameerez
rameerez / download_controlnet.py
Created February 15, 2024 02:39
Download all CrontrolNet models to Automatic1111
# Meant to be ran inside a `download.ipynb` notebook inside
# the `/workspace/stable-diffusion-webui/extensions/sd-webui-controlnet/models/` folder
# of an Automatic1111 installation
# !pip install requests
import requests
import os
# List of file names to download
@rameerez
rameerez / telegram-mtproxy.md
Last active August 18, 2026 11:58
Telegram Proxy How-To: complete and up-to-date MTProxy tutorial

How to set up a Telegram Proxy (MTProxy)

This tutorial will teach you how to set up a Telegram MTProxy on an Ubuntu 22.04 sever using AWS Lightsail, although you can use any other Linux distribution and cloud provider.

Using a Telegram proxy is a safe, easy and effective way of overcoming Telegram bans. It's useful, for example, to keep using Telegram under tyrannical regimes, or to circumvent judges' decisions to block Telegram.

Telegram proxies are a built-in feature in all Telegram apps (both mobile and desktop). It allows Telegram users to connect to a proxy in just one or two clicks / taps.

Telegram proxies are safe: Telegram sends messages using their own MTProto secure protocol, and the proxy can only see encrypted traffic – there's no way for a proxy to decrypt the traffic and read the messages. The proxy does not even know which Telegram users are using the proxy, all the proxy sees is just a list of IPs.

@rameerez
rameerez / docker-host-production-setup-ubuntu-server.sh
Last active February 15, 2026 19:36
This script sets up a secure, production-ready Docker host on Ubuntu Server 22.04 LTS
#!/bin/bash
# Production Docker Host Setup Script
# This script sets up a secure, production-ready Docker host on Ubuntu Server 22.04 LTS
# It includes security hardening, performance optimizations, and best practices
# CAUTION: This script makes significant system changes. Use at your own risk.
set -euo pipefail
# --- AESTHETICS ---
@rameerez
rameerez / umami-setup.sh
Last active July 23, 2026 17:33
Production Umami self-hosted analytics setup (v2) — app layer only: Umami + Postgres (docker compose) + nginx + Let's Encrypt. Run https://setup.railsfast.com first to harden the host and install Docker.
#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
# Umami Self-Hosted Analytics — App-Layer Setup Script v2.0.0
# For Ubuntu Server 24.04 LTS (Noble) and 26.04 LTS (Resolute)
#
# COMPANION to the RailsFast host hardening script (https://setup.railsfast.com).
# Run that FIRST — it hardens the host (SSH, ufw, fail2ban, sysctl, journald,
# unattended-upgrades, swap) and installs Docker CE + the compose plugin from
# Docker's official apt repository. This script deliberately does NONE of that;
@rameerez
rameerez / listmonk-setup.sh
Last active June 13, 2025 05:32
Set up a production Listmonk instance on a previously Docker-configured Ubuntu Server machine
#!/bin/bash
# Production-Ready Listmonk Setup Script
# This script sets up Listmonk with Docker Compose, Nginx reverse proxy, and automatic SSL
set -euo pipefail
# Function to generate a secure random password
generate_password() {
openssl rand -base64 32 | tr -d /=+ | cut -c -32
@rameerez
rameerez / postgres-production-setup.sh
Last active June 12, 2026 00:06
PostgreSQL Production Server Setup - Set up a new Ubuntu Server 24.04 LTS machine to run a production Postgres server
#!/bin/bash
# This script takes a clean Ubuntu Server 24.04 LTS image and installs and configures
# everything needed to deploy a production-ready PostgreSQL server.
set -euo pipefail
# --- AESTHETICS ---
GREEN='\033[0;32m'