Skip to main content

Backend Fresh Install

Running Ubuntu 24.04 image.

Update packages

sudo apt-get update && sudo apt-get upgrade
sudo apt update && sudo apt upgrade

Install Docker

Reference Docker Docs

Set up Docker's apt 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 "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Install Latest

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

Verify docker installed

sudo docker run hello-world

Output:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

Generate github deploy key

ssh-keygen -t ed25519 -C "deploy-github-jodpro.qa.frontend"
eval "$(ssh-agent -s)"
chmod 400 ~/.ssh/deploy-github-jodpro.qa.frontend

Add Github Deploy Keys

Create private key

ssh-keygen -t ed25519 -C "appname.env.role"

Copy public key

cat ~/.ssh/appname.env.role.pub

Paste into Github repo Settings > Deploy Keys

Add github.com host to ~/.ssh/config

Update ssh config to use the private key (.pem file)

nano config

Add github.com as a host using the .pem key

Host github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/appname.env.role

Set permission on the private key

chmod 400 ~/.ssh/deploy-github-jodpro-api-qa

Clone the repo

git clone github@github.com:org-name/repo-name.git

Install mysql so we can connect to the db

sudo apt install mysql-client-core-8.0

Third Parties

Onewaysms

Requires us to whitelist where our requests come from.

the nat-gateway IP address needs to be whitelisted since any backend instances will be in a private subnet

  • no public IP address
  • Outbound traffic is through NAT Gateway
  • Onewaysms needs to know the IP address of the NAT Gateway to be whitelisted