Giter Site home page Giter Site logo

meal-planner's Introduction

Meal Planner

Meal planning microservice.

Features:

  • Rest API (FastAPI)

  • Cron scripts to:

    • Update menu in Notion everyday
    • Add tasks to Todoist if some meal needs unfreezing the day before
    • Dabatase backup to AWS
  • Notion integration.

  • Todoist integration.

Deploy

Deployment is done via docker.

Note: these are the commands to create a release manually on your computer. You don't have to do this. The docker images are compiled with github actions, in the publish workflow.

# Build and push it to dockerhub
docker buildx build -t sralloza/meal-planner:$VERSION --platform=linux/arm/v7,linux/amd64,linux/arm64 --push .

# Build without pushing it to dockerhub
docker buildx build -t sralloza/meal-planner:$VERSION --platform=linux/arm/v7,linux/amd64,linux/arm64 --load .

Environment

You need to supply the following environment variables (required ones are marked with ๐Ÿšฉ). Settings are grouped in categories.

Server

  • ๐Ÿšฉ API_TOKEN (str): token of the API. In order to use the API, users will have to provide this token in their requests via the X-TOKEN header.
  • ENABLE_PROMETHEUS (bool): if True, the API will enable the prometheus endpoint /metrics. Defaults to False.
  • PRODUCTION (bool): if True the server will run on production environment. Defaults to False.
  • DISABLE_CRON_INTEGRATION (bool) if True, the server will not launch cron jobs. It is useful to launch replicas, enabling cron integration in only one of them. It is also useful to deploy on Kubernetes, as the cron jobs can be implemented via CronJob.

AWS

  • ๐Ÿšฉ AWS_ACCESS_KEY_ID (str): AWS access key id.
  • ๐Ÿšฉ AWS_SECRET_ACCESS_KEY (str): AWS secret access key.
  • ๐Ÿšฉ S3_BUCKET_NAME (str): name of the S3 bucket to save the backups.
  • S3_FILE_NAME (str): filename to save the backups in the AWS S3 Bucket. Defaults to meals.json.

Notion

  • NOTION_ADD_DAY_AFTER_TOMORROW (bool): if True, the meals of the day after tomorrow will also be added to Notion. Defaults to True.
  • ๐Ÿšฉ NOTION_BLOCK_ID (uuid): id of the notion block where the meals will be showed.
  • ๐Ÿšฉ NOTION_KEY (str): notion key to use the notion API.

Todoist

  • ๐Ÿšฉ TODOIST_PROJECT_ID (int): todoist project id where the tasks will be added.
  • ๐Ÿšฉ TODOIST_TOKEN (str): todoist token to use the todoist API.

Database

  • ๐Ÿšฉ MYSQL_DATABASE (str): database name.
  • ๐Ÿšฉ MYSQL_HOST (str): mysql host.
  • ๐Ÿšฉ MYSQL_PASSWORD (str): mysql password.
  • ๐Ÿšฉ MYSQL_PORT (str): mysql port.
  • ๐Ÿšฉ MYSQL_USER (str): mysql user.
  • WAIT_FOR_IT_ADDRESS (str): if is set, it will wait for the database to be ready for max 120 seconds. Must be set to $MYSQL_HOST:$MYSQL_PORT. This switch should not be used in Kubernetes deployments, as initContainers are designed to cover this exact use case.

Other

  • LOCALE_WEEKDAY_NAMES (list(str)): weekday names, starting with Monday and ending with Sunday. Must contain 7 elements (one for each week day).
  • NULL_STR (str): string to represent an empty lunch1 or dinner. Defaults to N/A.
  • VARIABLE_STR (str): string to represent a variable meal. Defaults to Variable. It's used in the /shift endpoint, where all meals which are equal to VARIABLE_STR will be treated as empty meals.

Future

AWS and notion settings are currently needed. If you want to use this app without one of them (or both) add an issue and I'll make it optional and configurable.

meal-planner's People

Contributors

sralloza avatar

Watchers

 avatar  avatar

meal-planner's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.