- Nest JS: Microservices & Hybrid Microservices Backend + TypeScript.
- Docker: Microservices containerization software.
- Kubernetes: Microservices container orchestration.
- Google Cloud Platform: Containers production environment.
- JSON Web tokens: Secured authentication security.
- NATS server: Simple technology transport protocol that connects all microservices.
- PostgreSQL: Relational database for Orders MS.
- MongoDB: NoSQL database for users allocation.
- SQLite: Local database for products MS.
- Stripe: Payments gateway platform.
- Clone repository
- Create a
.env
file using.env.example
as template. - Execute the submodule rebuild command
git submodule update --init --recursive
. - Execute
docker compose up --build -d
command.
-
Create a new repository on GitHub
-
Clone the repository to the local machine
-
Add the submodule, where
repository_url
is the repository URL anddirectory_name
is the name of the folder where you want the submodule to be saved (it should not already exist in the project):git submodule add <repository_url> <directory_name>
-
Add the changes to the repository (git add, git commit, git push). Example:
git add . git commit -m "Add submodule" git push
-
Initialize and update Submodules: When someone clones the repository for the first time, they must run the following command to initialize and update the submodules:
git submodule update --init --recursive
-
To update the submodule references:
git submodule update --remote
If you are working in the repository that has submodules, first update and push the changes in the submodule, and then in the main repository.
If done in reverse, the submodule references in the main repository will be lost, and conflicts will need to be resolved.
NATS
- 4222 is for clients.
- 8222 is an HTTP management port for information reporting.
- 6222 is a routing port for clustering.
Manual nats execution (from the downloaded image)
docker run -d --name nats-main -p 4222:4222 -p 6222:6222 -p 8222:8222 nats
- Clone repository
- Create an
.env
from the.env.template
reference. - Execute the command:
docker compose up --build -d
- Clone repository
- Create an
.env
from the.env.template
reference. - Execute the command (building stage):
docker compose -f docker-compose.prod.yml build
- Orchestrate the production container:
docker compose -f docker-compose.prod.yml up
- Name it with the full Google Artifact Registry repository url appending the docker image name.
docker build -f ./DockerfileProd -t xx-xxx-docker.pkg.dev/project-id/product-image-registry/docker-image-name .
- Push using this command:
docker image push xx-xxx-docker.pkg.dev/project-id/product-image-registry/docker-image-name