Skip to content

Instantly share code, notes, and snippets.

View rameerez's full-sized avatar
creating

Javi rameerez

creating
View GitHub Profile
@rameerez
rameerez / telegram-mtproxy.md
Last active April 21, 2026 16:14
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 / kamal-production-server-setup.sh
Last active March 22, 2026 05:01
Set up a Ubuntu server to deploy Kamal 2.x Docker containers to, hardened security and production ready
#!/bin/bash
# Production Docker Host Hardening Script v2
# For Ubuntu Server 24.04 LTS (Noble)
# Suitable for both Kamal deployment and builder hosts
set -euo pipefail
IFS=$'\n\t'
# --- Constants ---
@rameerez
rameerez / rails-production-setup.sh
Last active March 10, 2026 09:44
Rails Production Server Setup - Set up a new Ubuntu Server 24.04 LTS to run a Rails 7 app, using Capistrano for deployment
#!/bin/bash
# This script takes a clean Ubuntu Server 24.04 LTS AMI and installs and configures
# everything needed to deploy a Rails 7 app to it. The resulting state is a secure,
# production-ready instance.
set -euo pipefail
# --- AESTHETICS ---
@rameerez
rameerez / postgres-production-setup.sh
Last active March 10, 2026 09:44
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'
@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 / exit_the_cloud.md
Last active February 10, 2026 11:37
☁️ 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 / umami-setup.sh
Last active January 24, 2026 14:58
Set up a production Umami instance on a previously Docker-configured Ubuntu Server machine
#!/bin/bash
# Production-Ready Umami Setup Script
# This script sets up Umami 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 / 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 / telegram_mtproxy_stats_1yr.txt
Created April 20, 2025 23:53
Telegram MTProxy stats after 1 year running
pid 5126
start_time 1745121601
current_time 1745192772
uptime 71171
tot_idle_time 71108.817
average_idle_percent 99.913
recent_idle_percent 99.218
active_network_events 0
time_after_epoll 0.000023
epoll_calls 2168530
@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