Skip to content

recipeyak/recipeyak

Repository files navigation

Recipe Yak CircleCI

Application to automate the selection of meals and creation of shopping lists.

Why?

To have a centralized location where multiple people can organize a meal plan.

Prior Art / Alternatives

name created open source?
Meal Master 1986 ❌
Recipe Box 1991-11-01 ❌
MasterCook 1992 ❌
Home Cookin 1992 ❌
Cookpad 1998-03-01 ❌
Cook'n 1999-05-27 ❌
LargoRecipes 2001-04 βœ…
Krecipes 2003-05-01 βœ…
Big Oven 2004-02-04 ❌
Mac Gourmet 2004-06-05 ❌
Gourmet 2004-06-14 βœ…
REML 2005-03-02 ❌
Connoisseur 2008-08-06 ❌
Plan to Eat 2008-09-06 ❌
Yum Mac 2008 ❌
Chicken Ping 2009-06-22 ❌
Eat Your Books 2009-08-01 ❌
MealBoard 2009-09-24 ❌
Open Eats 2010-05-25 βœ…
Pepperplate 2010-06-08 ❌
Paprika 2010-08-16 ❌
Foodie 2011 ❌
Copy Me That 2011-03-19 ❌
Anylist 2012-04-04 ❌
Whisk 2013 ❌
Mealime 2013-01-20 ❌
My Recipe Box 2013-04-20 ❌
SideChef 2014-10-11 ❌
Recipe Keeper 2015-06-24 ❌
Forks Meal Planner 2016-01-05 ❌
CookBook 2016-08-28 ❌
Cinc 2016-03-31 ❌
Grocy 2017-04-15 βœ…
Grocery 2017-05-09 ❌
Cooklist 2017-05-26 ❌
Prepear 2017-11-09 ❌
Saffron 2017-12-04 ❌
Tandoor 2018-01-31 βœ…
Recipe Sage 2018-02-18 βœ…
KookBook 2018-04-24 βœ…
Recursive Recipes 2018-05-07 βœ…
NextCloud Cookbook 2019-03-10 βœ…
RecipeRadar 2019-05-18 βœ…
Crouton 2019-10-14 ❌
AnyMeal 2020-05-07 βœ…
EnRecipes 2020-12-02 ❌
Mealie 2020-12-24 βœ…
Coopes 2021-03-11 ❌
Mela 2021-03-15 ❌
Recipe Sage 2018-03-30 βœ…
Reciped 2021-05-19 ❌
Famnom 2021-08-27 βœ…
CooklangApp 2021-11-18 ❌
Homechart 2021-11-22 ❌
Meal DJ 2021-12-29 ❌
Recipe Box 2022-03-07 ❌
CookTime 2022-04-10 ❌
Simple Weekly Meal Planner 2022-05-04 ❌
Lollipop 2022-06-29 ❌
Umami 2022-07-12 ❌
Potluck 2022-11-01 ❌

Dev

Note: postgres is required. Either run it via docker-compose -f **docker-compose-dev.yml -d or via the homebrew cask mac app. Yarn and Poetry (0.12) are required for frontend and backend installation.

# create a .env with `DEBUG=1`. Note: you may need to update database URIs and related vars.
cp .env-example .env
echo "DEBUG=1" >> .env

cd frontend
yarn install
s/dev
s/test
s/lint
cd -

cd backend
brew install postgres # necessary for binary pyscopg2
poetry config virtualenvs.in-project true
poetry install
# start postgres (DBngin.app is nice on Mac)
s/dev
s/test
s/lint

# use `yarn` and `poetry` to add and upgrade dependencies
yarn add $FOO
poetry add $BAR

view postgres queries

  1. update the postgresql.conf to include have:
log_statement = 'all'
log_directory = 'pg_log'
log_filename = 'postgresql.log'
logging_collector = on
log_min_error_statement = error
log_rotation_size = 10MB
  1. tail the log file
tail -f "/Users/$USER/Library/Application Support/com.tinyapp.DBngin/Engines/postgresql/ED55F0A6-5CC7-49A4-B8D5-A5E819F1F1CB/pg_log/postgresql.log"

connect to prod postgres from local

  1. setup ssh proxy
ssh -N -L 1111:127.0.0.1:5432 recipeyak
  1. update .env
DATABASE_URL=postgres://postgres@localhost:1111/recipeyak

Prod

Deploy a new release

  1. Copy .env-example to .env and add in the proper configuration variables

  2. Install Ansible

  3. Setup Ansible Inventory

    ---
    all:
      hosts:
        recipeyak:
          ansible_host: 255.255.255.255
          ansible_user: root
  4. Run the playbook

    ansible-playbook ./infrastructure/playbooks/deploy.yml

Maintenance mode

Enabling maintenance mode returns a 503 status code with a webpage explaining the site is down for maintenance.

ansible-playbook ./infrastructure/playbooks/maintenance_mode.yml

Configuration

Environment variables are used for configuration. Unless otherwise stated, a value is required.

  • DJANGO_SECRET_KEY β€” long, randomized string required for django
    • ex: 284urfljkdflsdf
  • DATABASE_URL β€” URL for Django's database
    • ex: postgres://postgres@postgres:5432/postgres
  • EMAIL_HOST β€” SMTP hostname for sending email from Django
    • ex:smtp.mailgun.org
  • EMAIL_HOST_USER β€” SMTP email for logging into server
    • ex: server@example.com
  • EMAIL_HOST_PASSWORD β€”Β SMTP password for authenticating
    • ex: SomeUnguessablePassword
  • SENTRY_DSN β€” Sentry secret configuration for backend.
    • ex: https://<key>:<secret>@sentry.io/<project>
  • FRONTEND_SENTRY_DSN β€” Sentry configuration for frontend.
    • ex: https://<key>@sentry.io/<project>
  • AWS_ACCESS_KEY_ID β€” AWS access key for backups and image upload.
    • ex: someAWSKey
  • AWS_SECRET_ACCESS_KEY β€” AWS secret key for backups and image upload.
    • ex: someSecretKey
  • STORAGE_BUCKET_NAME β€” Bucket for image upload.
    • ex: recipeyak-production
  • STORAGE_HOSTNAME β€” Hostname to use to access image bucket. An s3 hostname or cloudfront distribution hostname.
    • ex: 594f11c618d1.cloudfront.net

AWS configuration

  1. Create an S3 bucket and configure a CORS policy that allows the website to upload resources.

    [
      {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["PUT", "POST"],
        "AllowedOrigins": ["http://localhost:*", "https://recipeyak.com"],
        "ExposeHeaders": []
      }
    ]
  2. Create an IAM policy to give your AWS ID access to get_object and put_object for your bucket.

  3. Configure imgix to pull from the bucket.