Recipe Yak
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
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
Prod
Deploy a new release
-
Copy
.env-example
to.env
and add in the proper configuration variables -
Setup Ansible Inventory
--- all: hosts: recipeyak: ansible_host: 255.255.255.255 ansible_user: root
-
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
- ex:
DATABASE_URL
— URL for Django's database- ex:
postgres://postgres@postgres:5432/postgres
- ex:
EMAIL_HOST
— SMTP hostname for sending email from Django- ex:
smtp.mailgun.org
- ex:
EMAIL_HOST_USER
— SMTP email for logging into serverEMAIL_HOST_PASSWORD
— SMTP password for authenticating- ex:
SomeUnguessablePassword
- ex:
SENTRY_DSN
— Sentry secret configuration for backend.- ex:
https://<key>:<secret>@sentry.io/<project>
- ex:
FRONTEND_SENTRY_DSN
— Sentry configuration for frontend.- ex:
https://<key>@sentry.io/<project>
- ex:
AWS_ACCESS_KEY_ID
— AWS access key for backups and image upload.- ex:
someAWSKey
- ex:
AWS_SECRET_ACCESS_KEY
— AWS secret key for backups and image upload.- ex:
someSecretKey
- ex:
STORAGE_BUCKET_NAME
— Bucket for image upload.- ex:
recipeyak-production
- ex:
STORAGE_HOSTNAME
— Hostname to use to access image bucket. An s3 hostname or cloudfront distribution hostname.- ex:
594f11c618d1.cloudfront.net
- ex:
AWS configuration
-
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": [] } ]
-
Create an IAM policy to give your AWS ID access to
get_object
andput_object
for your bucket. -
Configure imgix to pull from the bucket.