useradd -m -s /bin/bash oskar
passwd oskar
su oskar
usermod -aG sudo oskar
su oskar
cd ~
sudo apt update
sudo apt install nginx build-essential libssl-dev libffi-dev python3-dev python3-venv mariadb-server sqitch npm
git clone https://github.com/kamkalian/reparaturcafe3.git
cd reparaturcafe3
sudo cp nginx_conf/reparaturcafe.conf /etc/nginx/sites-available/reparaturcafe.conf
sudo cp nginx_conf/proxy_forward.conf /etc/nginx/snippets/proxy_forward.conf
Modify /etc/nginx/repataturcafe.conf
for your domain and ssh keys.
sudo ln -s /etc/nginx/sites-available/reparaturcafe.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
if config file contains errors check with:
sudo nginx -t
sudo mysql_secure_installation
Open mariadb terminal for the next steps:
sudo mariadb
create database reparaturcafe;
create database sqitch;
create user 'oskar'@localhost identified by 'password';
grant all privileges on reparaturcafe.* to 'oskar'@localhost;
grant all privileges on sqitch.* to 'oskar'@localhost;
flush privileges;
exit;
Execute the folowing command as root:
sqitch deploy db:mysql:reparaturcafe
python create_user.py
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
sudo .venv/bin/certbot --certonly --nginx
Write the correct path of ssl cert files to nginx conf.
Specify the following variables: DB_MYSQL_HOST=localhost DB_MYSQL_PORT=3306 DB_MYSQL_DATABASE=reparaturcafe DB_MYSQL_USER=oskar DB_MYSQL_PASSWORD= NEXT_PUBLIC_API_URL= SECRET_KEY= ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=1445
npm install
sudo npm install -g pm2
npm run dev
.venv/bin/uvicorn --reload --port 8000 --app-dir "/home/oskar/reparaturcafe3/" api.main:app
npm install
pm2 start npm -- start
pm2 start ".venv/bin/uvicorn --reload --port 8000 --app-dir '/home/oskar/reparaturcafe3/' api.main:app" --name fastapi
pm2 save
Create migration files (for deploy, revert, verify)
sqitch add tasks -n 'Creates tasks table.'
Deploy change:
sqitch deploy db:mysql:reparaturcafe
Rebase
sqitch rebase db:mysql:reparaturcafe --onto users