Skip to content

samituga/zero2prod

Repository files navigation

Conventions: .yaml

dependencies:

# linux
sudo apt update & sudo apt upgrade
sudo apt install postgresql postgresql-contrib
# macOS (brew)
brew install postgresql

pre-commit

#linux
pip install pre-commit
pre-commit install

#macOS (brew)
brew install pre-commit
pre-commit install

Format code using rust formatter

cargo fmt

Sort dependencies

cargo sort

Generate offline sql data (needs postgres to be running)
sqlx calls into our database at compile-time to ensure that all queries can be successfully executed considering the schemas of our tables.
We use this command locally to save the results so that we don't need a live connection on the CI pipelines.
We will need the env variable SQLX_OFFLINE=true to use the offline data

cargo sqlx prepare --workspace -- --all-targets

Run pre commit validations to all files (runs automatically before each commit but only for changed files)

pre-commit run --all-files

run init db script

./scripts/init_db.sh
SKIP_DOCKER=true ./scripts/init_db.sh # If we want to skip docker initialization

Build docker image

docker build --tag zero2pod --file Dockerfile .

Use bunyan to format logs

cargo install bunyan

# Example
TEST_LOG=true cargo t test_name | bunyan

INFRA, after applying the terraform config, it's necessary to manually update the codestar connection to GitHub under Developer Tools > Connections

TODO GitHub workflows Docker caching doesn't appear to be working Every job keeps downloading and compiling the rust dependencies, check if rust cache is working Consider running everything in a single job

TODO Infra Just by adding a new dependency the cache does not work as expected, it downloads and compiles all dependencies For some reason CodeDeploy needs a taskdef.json with the taskdefinition configurations, this possibly creates problems as there is a need to duplicate the code from the EcsStack, but that taskdef.json isn't even used, in the end it uses the taskdef specified in the appspec.yaml TaskDefinition: "<TASK_DEF_ARN>", but without a valid taskdef.json it doesn't work

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published