sudo-i-u postgres
psql -U postgres -h localhost
postgres@shaikh:~$ psql
postgres=# create database local_test;
CREATE DATABASE
postgres=# grant all privileges on database local_test to postgres;
GRANT
postgres=# ALTER USER postgres WITH PASSWORD 'postgres';
ALTER ROLE
postgres=# exit()
Generate ssh profile to pull the project from github
cd ~/.ssh/
ssh-keygen -t ed25519 -C"amin@test.com"
Copy the public key and put inside your github setting SSH keys with a valid name
cat id_ed25519.pub
Create a folder for git projects and clone the repo
cd ~/
mkdir projects
cd projects/
git clone git@github.com:shaikhalamin/backend-project.git
Create a virtual environment and activate the venv
python3.10 -m venv venv
source venv/bin/activate
Now CD into the project directory and install the requirements along with Gunicorn server
cd backend-project/
pip install-r requirements.txt
pip install gunicorn
sudo ufw status
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
# For posgres from another serversudo ufw allow 5432/tcp
sudo ufw enable
sudo ufw status
If everything goes well install certbot for SSL certificated
sudo snap install--classic certbot
sudo ln-s /snap/bin/certbot /usr/bin/certbot
[N:B]
# Setup domain name and point to the correct IP and check from DNS checker then run the below commandsudo certbot --nginx