README

Visit

email: admin@example.com password: admin

Setup Walkthrough

Backend

install psql

sudo apt-get update
sudo apt-get install postgresql

create db

create database dbname;
/c dbname;
CREATE ROLE user WITH LOGIN PASSWORD 'password';

store db dsn in env

/etc/environment

sudo chmod 644 /etc/environment
PORT=
DB_URL=postgres://user:password@localhost/dbname
JWT_SECRET=

install migrate tool

curl -L https://github.com/golang-migrate/migrate/releases/download/v4.16.2/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate /usr/local/bin

copy migrations from local to server

scp -i ~/path/to/key/key.pem -r ./be/migrations user@ec2-ip.compute-1.amazonaws.com:~

run migrations

migrate -path ./migrations -database $DB_URL up

copy built binary from local to server

scp -i ~/path/to/key/key.pem ./be/bin/api user@ec2-ip.compute-1.amazonaws.com:~

copy service file from local to server

scp -i ~/path/to/key/key.pem ./be/api.service user@ec2-ip.compute-1.amazonaws.com:~

run server as service

sudo mv api.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start api
sudo systemctl enable api

check status

sudo systemctl status api
sudo journalctl -u api -f

setup nginx

sudo apt-get install nginx
scp -i ~/path/to/key/key.pem ./nginx.conf user@ec2-ip.compute-1.amazonaws.com:/etc/nginx/sites-available/default
sudo systemctl restart nginx

Frontend

copy built frontend from local to server

scp -i ~/path/to/key/key.pem -r ./fe/dist user@ec2-ip.compute-1.amazonaws.com:/var/www/html