Learning project from the book by Luca Palmieri
some general notes as I go along
lld is a faster linker than Rust's default
lld can be configured per build target by special sections in the Cargo config
Install and use like
cargo install cargo-watch
cargo watch -x check -x test -x run
Install and use like
cargo install cargo-tarpaulin
cargo tarpaulin --ignore-tests
Some standard GitHub Actions config files as linked in book
Put all three files in .github/workflows
and then magic!
UPDATE:
Ref links from book:
actix-web endpoint handlers will automatically return 400 if they fail to deserialize the request parameters
Install and use like
cargo install cargo-expand
cargo expand
All arguments in the signature of a route handler must implement the
FromRequest
trait.
Often implemented in rust by piggybacking on the Drop
trait.
cargo +nightly command
List apps with doctl apps list
.
The first column is the App ID.
Create a new app with doctl apps create --spec spec.yaml
.
The spec YAML file declaritively specifies app resources.
For this app we have a service and a database.
Update apps with doctl apps update APP_ID --spec=spec.yaml
.
Migrate the database with DATABASE_URL=<app-db-connection-string> sqlx migrate run
.
You can find the connection string in "Connection Details" at "https://cloud.digitalocean.com/apps/APP_ID/settings/DB_NAME"
Update the offline sqlx schema file via:
cargo sqlx prepare -- --lib
- triage these TODOs
- get code coverage to show on github
- perform compatibility testing with newest sqlx-cli version
- do better than "SKIP_DOCKER" flag in
scripts/init_db.sh
- refactor
routes/mod.rs
toroutes.rs
- look into clippy warning in the routes mod saying the re-exports aren't used
- get familiar with the GitHub Actions specs
- fix "Node.js 12 actions are deprecated" warnings
- get GitHub Actions tests to succeed w/o committing:
- Cargo.lock - hash of this file used in cache
- .env file
- the problem is sqlx macros need the DATABASE_URL environment variable and grab it from
.env
- see the docs for setting environment variables
- see this custom actions example for getting values from GitHub secrets
- the problem is sqlx macros need the DATABASE_URL environment variable and grab it from
- configuration.yaml - needed to load configurations
- the hash of this file is used to cache dependencies
- move to use Environment Files instead of
save-state
in GitHub actions - see this post 0
- look into higher-ranked trait bound (HRTB)
- make docker image tiny
- see rust-musl-builder - pg #150 in book
- see how to strip symbols
- documentation!
- how do extension traits work around rust's orphan rule?
- refactor database access into some kind of DAL
- break subscriptions.rs into its own module
- create some functionality to easily execute postgres workflows inside transactions
- create a macro (ooh) for using chain_fmt_error for Debug implementations (lofty?)
- set argon params manually to recommended rather than use default see pg 404 (hopefully I can find it)