Skip to content

agrism/zero2prod

Repository files navigation

Set up PG

 ./scripts/init_db.sh  
 # or
 SKIP_DOCKER=true ./scripts/init_db.sh 

Commands

cargo test
cargo tarpaulin --ignore-tests
cargo check
cargo clippy
cargo audit
cargo fmt
cargo run

routes

curl -v http://127.0.0.1:8000/health_check

CI

docker build --tag zero2prod --file Dockerfile .

digital ocean apps

brew install doctl
doctl auth init
doctl apps create --spec spec.yaml
doctl apps list
# update if necessary
doctl apps update uuid-of-apps-taken-from-previous-command-output --spec=spec.yaml
run migration
copy database connection string from do admin

digital ocean admin preview

DATABASE_URL=postgresql://newsletter:<PASSWORD>@<HOST>:<PORT>/newsletter?sslmode=require sqlx migrate run 
curl --request POST \
--data 'name=le%20guin&email=ursula_le_guin%40gmail.com' \
https://{subdomain}.ondigitalocean.app/subscriptions \
--verbose