Repository containing the infrastructure & code for the backend used by Liesbury's Receptenlijst. Main goal was to test out NestJS & Google Cloud Run.
lb-recipes-backend-infr
: contains the Terraform code to provision the resources needed for this application on Google Cloud. Infrastructure consists of:- Artifact Registry for storing the Docker images of the backend NestJS application
- A Cloud Run instance of the latest version
- A FireStore database to act as main database for the application
- A Google Cloud Bucket to store images in that are used on the site
lb-recipes-backend-src
: contains a NestJS application. Follows the basic NestJS setup & first steps documentation, making use of:- Basic CRUD API routes
- Validation
- Authentication for admin using a password &
passport
which yields a JWT token to access protected routes
Copy the .env.example
file to .env
and fill in the necessary values.
Use the secrets/
folder to store any additional secrets that are needed, like service account credential JSONs.
Each push to the main
branch will:
- Trigger a version bump and place a version tag
- Build the Docker image in a Github action
- Push the image to the Artifact Registry
Afterwards, check out the latest commit on the main
branch to see the latest version tag and deploy it using terraform:
./tf-apply.sh
- Use
./docker-build.sh
to version bump and build the Docker image - Validate the image by running it locally using
./docker-run.sh
- Push the image to the Artifact Registry using
./docker-push.sh
- Deploy the latest version using
./tf-apply.sh