Skip to content

Server configuration

Follow the list below to configure server

Install tailscale connector

Follow admin panel instruction to add server to tailnet sudo tailscale set --ssh

Install dependencies

We also recommend to install a necessary software:

sudo apt install -y git wget tmux htop mc nano build-essential
curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash
sudo apt install task

Install docker on server

Add docker repository

# Add Docker's official GPG key:
sudo apt-get update
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

# 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 "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install docker

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Add user to docker group

sudo usermod -aG docker $USER

Create an app user without a root permission

  • adduser appuser
  • sudo usermod -aG docker appuser
  • re-login to the server with appuser

Generate deploy key

Now, we need to create SSH key for deploy code from the remote repository (if you use GitHub, Bitbucket, GitLub, etc.).

ssh-keygen -t rsa

Show the public key:

cat ~/.ssh/id_rsa.pub

Then go to the project's settings of your project on source code hosting (if you use Bitbucket than go to "Access keys" section, if GitHub than search "Deployment keys" section) and add the key there.

Clone the project

Clone the source code:

git clone <git_remote_url>

📌 Use your own correct Git remote directory URL.

Then you need to create the .env file with proper settings. You can use the prod.env as a template to create it

cp ./docs/.env.example .env

Open the .env file in your editor and change the settings as you need:

⚠️ Generate strong secret key and passwords. It is very important.

Change the necessary settings. Please check the ALLOWED_HOSTS settings that should contain the correct domain name. Also, you need to change the SITE_URL value that is using with configuring Caddy. It should be the value of the site domain.

Now you can run the containers:

task prod.deploy

Consider setup of CD CD with GitHub Actions to automate the deployment process.