From 18f8236d9c1f1030dae147beda15ee5c93e26d44 Mon Sep 17 00:00:00 2001 From: Nicola Iacovelli Date: Fri, 7 Oct 2022 09:19:14 +0200 Subject: [PATCH 1/2] Added README.md --- README.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..597dedc --- /dev/null +++ b/README.md @@ -0,0 +1,87 @@ +# Food-track-be + +## Description +This app is a simple food tracking app. It allows you to track your food intake and calories. + +To use this app, first you have to install [grocery-be](https://github.com/nico-iaco/grocery-be) which provide food availability +and all the food data. + +## Features + +- [x] Add meals +- [x] Add food consumed +- [x] Calculate meal calories and price + + +## Requirements + +- [PostgreSQL](https://www.postgresql.org/) +- [grocery-be](https://github.com/nico-iaco/grocery-be) +- [food-details-integrator-be](https://github.com/nico-iaco/food-detail-integrator-be) (optional) + +## Installation + +### Cluster installation + +To install this app in a cluster, first create grocery namespace, then modify the kustomization.yaml file in /k8s/overlays/qa +changing the property to match your configuration and run the following command: + +```bash +kubectl apply -k k8s/overlays/qa +``` + +### Local installation + +You can run this app locally with docker. To do so, run the following command: + +```bash +docker run -p 8080:8080 ghcr.io/nico-iaco/food-track-be:latest -e {ALL_ENV_VARIABLES} +``` + +## Environment variables + +| Name | Description | Default value | +|----------------------|----------------------------------------------|---------------| +| PORT | Port on which the app will listen | 8080 | +| GIN_MODE | Release type of app | | +| DB_HOST | Database host | | +| DB_PORT | Database port | | +| DB_NAME | Database name | | +| DB_USER | Database user | | +| DB_PASSWORD | Database password | | +| GROCERY_BASE_URL | Base url for grocery-be app | | +| FOOD_DETAIL_BASE_URL | Base url for food-details-base-integrator-be | | + +## Database + +To create the database, run the following command with the database user: + +```sql +CREATE DATABASE food_track; +``` + +```sql +create table meal ( + id uuid primary key, + name varchar(255) not null, + description varchar(255), + meal_type varchar(255) not null, + date date not null +); +``` + +```sql +create table food_consumption ( + id uuid primary key, + meal_id uuid not null, + food_id uuid not null, + transaction_id uuid not null, + food_name varchar(255) not null, + quantity_used float not null, + quantity_used_std float not null, + unit varchar(255) not null, + kcal float not null, + cost float not null, + foreign key (meal_id) references meal(id) +); +``` From 9111797dc8086dbad22a2bf32d3d53b9ae1d50f7 Mon Sep 17 00:00:00 2001 From: Nicola Iacovelli Date: Fri, 7 Oct 2022 09:21:38 +0200 Subject: [PATCH 2/2] fix docker-publish.yml to avoid unuseful builds --- .github/workflows/docker-publish.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 83fd8af..f380c80 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -12,6 +12,13 @@ on: tags: [ 'v*.*.*' ] paths-ignore: - 'k8s/**' + - 'docs/**' + - 'README.md' + - 'LICENSE' + - 'CHANGELOG.md' + - 'CODE_OF_CONDUCT.md' + - 'CONTRIBUTING.md' + - 'SECURITY.md' env: # Use docker.io for Docker Hub if empty