Skip to content

Latest commit

 

History

History
112 lines (93 loc) · 2.15 KB

SERVER.md

File metadata and controls

112 lines (93 loc) · 2.15 KB

Set up a server from scratch

Base

  1. Update the apt package index
sudo apt update
  1. Update packages
sudo apt upgrade
  1. Install main packages
sudo apt install tmux make nginx git htop

Install Docker link →

  1. Add Docker's official GPG key
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
  1. Add the repository to Apt sources
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
  1. Install the latest version of Docker Engine, containerd, and Docker Compose
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Set up server

  1. Configure NGINX

Change lines in /etc/nginx/nginx.conf:

types_hash_max_size 20480;
client_max_body_size 30m;
  1. Restart NGINX
sudo systemctl restart nginx

Set up encryption link →

  1. Install Snap
sudo apt install snapd
  1. Ensure that your version of snapd is up to date
sudo snap install core
sudo snap refresh core
  1. Install Let's Encrypt
sudo snap install --classic certbot
  1. Prepare the Certbot command
sudo ln -s /snap/bin/certbot /usr/bin/certbot

Set up GitHub

  1. Create RSA SSH key
ssh-keygen
  1. Copy public key to https://github.com/settings/keys
cat ~/.ssh/id_rsa.pub
  1. ~/.ssh/config:
Host github.com
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null

Set up project

  1. Clone a project
git clone [email protected]:USER/REPO.git

(your GitHub user and repository name)

(exactly this format of the link)

  1. Set up NGINX config & run certbot
certbot --nginx
  1. Run project
docker compose up --build -d