Archived

goodfood

School project involving micro-services architecture, Azure deployment, CI/CD and many more

View on GitHubยท3 starsยท0 forksยทTypeScript

GoodFood 2.0

GoodFood 2.0 is a food ordering application for Good Food, a company specializing in food services in France, Belgium, and Luxembourg.

Origin / Context

Good Food was formed from the merger of four food companies. The company offers various food services, including conventional dining, takeout, and delivery with phone orders. Ordering is also available through a web or mobile application.

The GoodFood 2.0 project was initiated to update the existing ordering application, which had become outdated and was unable to handle more users. The objective is to create a modern, user-friendly, and modular new version that can handle a high volume of concurrent users, up to several thousand.

Microservices ports

| Service | Port | Language | Database | Status | Assignee | | ------------ | ----- | ----------- | ---------- | ------ | --------------- | | Gateway | 50000 | Go | โŒ | โœ… | @Anatole-Godard | | User (auth) | 50001 | Go | PostgreSQL | โœ… | @Anatole-Godard | | Basket | 50002 | NodeJS (ts) | Redis | โœ… | @Anatole-Godard | | Payment | 50003 | NodeJS (ts) | PostgreSQL | โœ… | @floriaaan | | Product | 50004 | NodeJS (ts) | PostgreSQL | โœ… | @PierreLbg | | Restaurant | 50005 | NodeJS (ts) | PostgreSQL | โœ… | @floriaaan | | Promotion | 50006 | NodeJS (ts) | PostgreSQL | โœ… | @PierreLbg | | Order | 50007 | NodeJS (ts) | PostgreSQL | โœ… | @floriaaan | | Delivery | 50008 | NodeJS (ts) | PostgreSQL | โœ… | @floriaaan | | Stock | 50009 | NodeJS (ts) | PostgreSQL | โœ… | @floriaaan | | Reporting | 50020 | C# (dotnet) | PostgreSQL | โœ… | @floriaaan | | Log | 50021 | Go | PostgreSQL | โœ… | @floriaaan | | Notification | 50022 | NodeJS (ts) | PostgreSQL | โœ… | @PierreLbg | | (...) | (...) | (...) | (...) | (...) |

File Hierarchy

The file hierarchy for this project is as follows:

.
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ tests.yml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ (...) # other files like .gitignore, etc.
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ mobile/
โ”‚   โ””โ”€โ”€ web/
โ”œโ”€โ”€ terraform/
โ”‚   โ””โ”€โ”€ env/
โ”‚       โ””โ”€โ”€ (...) # environments tfvars files
โ””โ”€โ”€ services/
    โ”œโ”€โ”€ gateway/
    โ”‚       โ”œโ”€โ”€ k8s/
    โ”‚       โ”‚   โ””โ”€โ”€ (...) # k8s files
    โ”‚       โ””โ”€โ”€ terraform/
    โ”‚           โ””โ”€โ”€ (...) # terraform files
    โ”œโ”€โ”€ user/
    โ”œโ”€โ”€ order/
    โ”œโ”€โ”€ delivery/
    โ”œโ”€โ”€ stock/
    โ”œโ”€โ”€ reporting/
    โ”œโ”€โ”€ (...) # other services
    โ””โ”€โ”€ proto/
        โ””โ”€โ”€ (...) # proto files

Installation & usage

Terraform

Create stuff in azure and put them in environnement:

  • Resource group resource_group_name = "The name"
  • Storage account storage_account_name = "The name"
  • Container in the storage account container_name = "The name"
cd terraform
terraform init --backend-config=env/dev-backend.tfvars
terraform apply -var-file="env/dev.tfvars" -auto-approve

Now you can deploy services:

cd services/product/terraform/
terraform init --backend-config=env/dev-backend.tfvars
terraform apply -var-file="env/dev.tfvars" -auto-approve
cd services/user/terraform/
terraform init --backend-config=env/dev-backend.tfvars
terraform apply -var-file="env/dev.tfvars" -auto-approve
cd services/gateway/terraform/
terraform init --backend-config=env/dev-backend.tfvars
terraform apply -var-file="env/dev.tfvars" -auto-approve

Docker

You can use Docker to run the microservices and the gateway.

To do so, you will need to have Docker installed on your system.

You can then run the following command to start the microservices and the gateway:

docker-compose -f services/docker-compose.yml up -d --build

Kubernetes

To create the kubernetes cluster you need to run the following command:

cd kubernetes
kind create cluster --config kind-config.yaml

You can use Kubernetes to run the microservices and the gateway. For that create the secret for the docker registry (take care of replacing the placeholders):

kubectl create secret docker-registry registry-credential --docker-server=https://hub.docker.com --docker-username=PierreLbg --docker-password=3o6gzWTiA#Vc%3 --docker-email=pierre.lebigre@outlook.fr

Then make the secret usable by the service account:

kubectl get secret registry-credential --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode

Then you can deploy the services:

cd kubernetes
kubectl apply -f https://raw.githubusercontent.com/floriaaan/goodfood/main/basket,https://raw.githubusercontent.com/floriaaan/goodfood/main/delivery,https://raw.githubusercontent.com/floriaaan/goodfood/main/gateway,https://raw.githubusercontent.com/floriaaan/goodfood/main/generic,https://raw.githubusercontent.com/floriaaan/goodfood/main/log,https://raw.githubusercontent.com/floriaaan/goodfood/main/notification,https://raw.githubusercontent.com/floriaaan/goodfood/main/order,https://raw.githubusercontent.com/floriaaan/goodfood/main/payment,https://raw.githubusercontent.com/floriaaan/goodfood/main/product,https://raw.githubusercontent.com/floriaaan/goodfood/main/promotion,https://raw.githubusercontent.com/floriaaan/goodfood/main/restaurant,https://raw.githubusercontent.com/floriaaan/goodfood/main/stock,https://raw.githubusercontent.com/floriaaan/goodfood/main/user

Then you can run your web application. Make sure to change the URL in the web application environment file to http://localhost:50000. If you need to redeploy your services after merge a new version of a services use

kubectl rollout restart deployment --namespace=default

Development

Each service has its own README.md file with installation and usage instructions.

Please refer to the README.md file of the service you want to install and use.

Contributing

You can contribute to this project by:

  • Reporting bugs
  • Suggesting new features
  • Submitting pull requests

Any help is welcome, and we will try to answer as soon as possible. Please read the CONTRIBUTING.md file for more information.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Authors