61 lines
1.8 KiB
Makefile
61 lines
1.8 KiB
Makefile
_list:
|
|
@just --list --unsorted
|
|
|
|
# Check project
|
|
check:
|
|
just --unstable --fmt --check
|
|
cargo fmt --check
|
|
taplo fmt --check `fd --extension=toml`
|
|
taplo lint `fd --extension=toml`
|
|
cargo check
|
|
cargo nextest run
|
|
nix flake show
|
|
|
|
# Format project
|
|
fmt:
|
|
just --unstable --fmt
|
|
cargo fmt
|
|
taplo fmt `fd --extension=toml`
|
|
|
|
# Run backend (locally)
|
|
run-backend:
|
|
RUST_LOG=backend=debug cargo run -p backend
|
|
|
|
# POST /create (locally)
|
|
create-gul-bus:
|
|
xh post 127.0.0.1:4000/create goal='pej på en gul bus'
|
|
|
|
# Connect to websocket (locally)
|
|
subscribe-ws:
|
|
websocat ws://127.0.0.1:4000/api/ws
|
|
|
|
# Trunk serve on 0.0.0.0
|
|
trunk-serve:
|
|
trunk serve --address=0.0.0.0 crates/frontend/index.html
|
|
|
|
# Build frontend (locally) and copy to remote.
|
|
deploy-frontend:
|
|
trunk build --release --dist=dist crates/frontend/index.html
|
|
ssh root@ajb.dk rm -r /var/www/achievements
|
|
rsync -avz dist/ root@ajb.dk:/var/www/achievements
|
|
|
|
# Build backend on latest master on remote, and restart service.
|
|
deploy-backend:
|
|
ssh plul@ajb.dk -- sh -c "'cd achievements && git pull'"
|
|
ssh plul@ajb.dk -- sh -c "'cd achievements && nix develop --command -- cargo build --release -p backend'"
|
|
ssh root@ajb.dk -- systemctl stop achievements-backend.service
|
|
ssh plul@ajb.dk -- sh -c "'cp achievements/target/release/backend /opt/achievements/backend'"
|
|
ssh root@ajb.dk -- systemctl start achievements-backend.service
|
|
just logs-prod
|
|
|
|
# Copy the nginx conf to the server and reload nginx
|
|
deploy-nginx-conf:
|
|
rsync -avz nginx.conf root@ajb.dk:/etc/nginx/sites-available/achievements.conf
|
|
ssh plul@ajb.dk cat /etc/nginx/sites-available/achievements.conf
|
|
ssh root@ajb.dk nginx -T
|
|
ssh root@ajb.dk systemctl reload nginx
|
|
|
|
# List logs with journalctl
|
|
logs-prod:
|
|
ssh plul@ajb.dk journalctl -u achievements-backend
|