Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rameerez/73ca5b1e53528fae3c2074bd4894556f to your computer and use it in GitHub Desktop.
Save rameerez/73ca5b1e53528fae3c2074bd4894556f to your computer and use it in GitHub Desktop.
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
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
sudo apt-get install -y fail2ban
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
/usr/bin/env curl -fsSL https://get.docker.com | sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo systemctl enable docker
sudo apt install -y nginx certbot python3-certbot-nginx
mkdir -p /letsencrypt &&
touch /letsencrypt/acme.json &&
chmod 600 /letsencrypt/acme.json
docker network create --driver bridge private
sudo apt get install -y bat btop lsd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment