Skip to content

Commit

Permalink
Update .env and set double quotes for bash example
Browse files Browse the repository at this point in the history
  • Loading branch information
pataruco committed Dec 18, 2023
1 parent 6e7fcbe commit 3b6c76c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TF_VAR_pg_user=commerce
TF_VAR_pg_password=commerce
TF_VAR_pg_database=commerce

export ORDER_SERVICE_INGRESS_IP=34.120.178.150
export PRODUCT_SERVICE_INGRESS_IP=34.117.96.11
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
TF_VAR_pg_user=
TF_VAR_pg_password=
TF_VAR_pg_database=

export ORDER_SERVICE_INGRESS_IP=
export PRODUCT_SERVICE_INGRESS_IP=
61 changes: 32 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# spring-boot-microservices POC

This is a sample project to set up a set of microservices in GKE. It is to be used as a benchmark to compare against
next-gen platform deployment options with rust.
This is a sample project to set up a set of microservices in GKE. It is to be used as a benchmark to compare against
next-gen platform deployment options with rust.

## High level architecture

Expand All @@ -25,43 +25,46 @@ and the latest version will be deployed to the cluster by helm.

## Spinning up or tearing down the setup

To spin up the set of services and all relevant infrastructure, invoke the `spin_up.sh` script.
You will need to have the env variables listed in `.env` present in your environment for this. Reach out to the repo contributors
to obtain this.
To spin up the set of services and all relevant infrastructure, invoke the `spin_up.sh` script.
You will need to have the env variables listed in `.env` present in your environment for this. Reach out to the repo contributors
to obtain this.

You'll need the following tools installed before runinng this:
* gcloud cli
* kubectl
* helm
* terraform

- gcloud cli
- kubectl
- helm
- terraform

To tear down the whole set up, just run the `tear_down.sh` script. This will remove everything except the service accounts
needed to spin it up back again and for CI jobs.

## Improvement points

This is just a basic setup. There are many things that could be improved if this was a real life application, but was not
implemented for this POC.
implemented for this POC.

Some of them are:
* Secret Encryption at rest
* Domain name(s) + HTTPS - the services are currently only accessible through the ingress IP addresses
* Authentication (both service to service and ingress)
* Better service versioning in CI
* GitOps
* Managed Kafka instance
* Observability tools (opentelemetry, Prometheus etc.)
* Tighten roles and permissions for service accounts
* Remote (encrypted) terraform backend
* Set up for local runs (e.g. docker-compose file)
* More granular CI (individual builds/deployments depending on what changed)
* Clean-up/better modularisation of terraform

- Secret Encryption at rest
- Domain name(s) + HTTPS - the services are currently only accessible through the ingress IP addresses
- Authentication (both service to service and ingress)
- Better service versioning in CI
- GitOps
- Managed Kafka instance
- Observability tools (opentelemetry, Prometheus etc.)
- Tighten roles and permissions for service accounts
- Remote (encrypted) terraform backend
- Set up for local runs (e.g. docker-compose file)
- More granular CI (individual builds/deployments depending on what changed)
- Clean-up/better modularisation of terraform

## Sample requests

Create an order
Create an order

```shell
curl --location --request POST 'http://${ORDER_SERVICE_INGRESS_IP}/api/order' \
curl --location --request POST "http://${ORDER_SERVICE_INGRESS_IP}/api/order" \
--header 'Content-Type: application/json' \
--data-raw '{
"orderLineItemsDtoList": [
Expand All @@ -75,21 +78,21 @@ curl --location --request POST 'http://${ORDER_SERVICE_INGRESS_IP}/api/order' \
}'
```

get all products in the catalog
get all products in the catalog

```shell
curl http://${PRODUCT_SERVICE_INGRESS_IP}/api/product
curl "http://${PRODUCT_SERVICE_INGRESS_IP}/api/product"
```

create a new product
create a new product

```shell
curl --location --request POST 'http://${PRODUCT_SERVICE_INGRESS_IP}/api/product' \
curl --location --request POST "http://${PRODUCT_SERVICE_INGRESS_IP}/api/product" \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "iPhone 14",
"description": "New iPhone 14",
"price": 1100,
"skuCode": "iphone_14"
}'
```
```

0 comments on commit 3b6c76c

Please sign in to comment.