diff --git a/.github/workflows/pytest.yml b/.github/workflows/test-all.yml
similarity index 61%
rename from .github/workflows/pytest.yml
rename to .github/workflows/test-all.yml
index dc6f341fc6d9..9cfe00cb668c 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/test-all.yml
@@ -8,12 +8,23 @@ on:
branches:
- master
- dev
+ types: [synchronize, opened, reopened, ready_for_review]
jobs:
tests:
env:
PRODUCTION: false
runs-on: ubuntu-latest
+ services:
+ postgres:
+ image: postgres
+ env:
+ POSTGRES_USER: mealie
+ POSTGRES_PASSWORD: mealie
+ POSTGRES_DB: mealie
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
+ ports:
+ - 5432:5432
steps:
#----------------------------------------------
# check-out repo and set-up python
@@ -32,9 +43,9 @@ jobs:
with:
virtualenvs-create: true
virtualenvs-in-project: true
- # #----------------------------------------------
- # # load cached venv if cache exists #! This Breaks Stuff
- # #----------------------------------------------
+ #----------------------------------------------
+ # load cached venv if cache exists
+ #----------------------------------------------
# - name: Load cached venv
# id: cached-poetry-dependencies
# uses: actions/cache@v2
@@ -45,11 +56,22 @@ jobs:
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
- run: poetry install
+ run: |
+ poetry install
+ poetry add "psycopg2-binary==2.8.6"
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
#----------------------------------------------
# run test suite
#----------------------------------------------
- - name: Run tests
+ - name: Run Test Suite
run: |
- poetry run pytest
+ make test-all
+ #----------------------------------------------
+ # run test suite
+ #----------------------------------------------
+ - name: Run Test Suite Postgres
+ env:
+ DB_ENGINE: postgres
+ POSTGRES_SERVER: localhost
+ run: |
+ make test-all
diff --git a/.vscode/settings.json b/.vscode/settings.json
index aabf6d50d8b8..21ff09b98881 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -8,11 +8,21 @@
"python.testing.pytestEnabled": true,
"python.testing.autoTestDiscoverOnSaveEnabled": false,
"python.testing.pytestArgs": ["tests"],
- "cSpell.enableFiletypes": ["!javascript", "!python"],
+ "cSpell.enableFiletypes": [
+ "!javascript",
+ "!python",
+ "!yaml"
+ ],
"i18n-ally.localesPaths": "frontend/src/locales/messages",
"i18n-ally.sourceLanguage": "en-US",
"i18n-ally.enabledFrameworks": ["vue"],
"i18n-ally.keystyle": "nested",
- "cSpell.words": ["performant"],
+ "cSpell.words": [
+ "compression",
+ "hkotel",
+ "performant",
+ "postgres",
+ "webp"
+ ],
"search.mode": "reuseEditor"
}
diff --git a/Dockerfile b/Dockerfile
index 1964aff4f9ff..b14aa86fa187 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,14 +16,11 @@ ENV POETRY_VERSION 1.1.6
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc g++ \
curl \
- python3-dev \
- build-essential \
- libssl-dev \
- libffi-dev \
gnupg gnupg2 gnupg1 \
apt-transport-https \
debian-archive-keyring \
debian-keyring \
+ libpq-dev \
libwebp-dev \
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - \
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee -a /etc/apt/sources.list.d/caddy-stable.list \
@@ -35,12 +32,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION"
+RUN pip install --no-cache-dir "psycopg2-binary==2.8.6"
-#! Future
-# pip install --no-cache-dir "psycopg2-binary==2.8.6"
-
+# project dependencies
WORKDIR /app
-COPY pyproject.toml /app/
+COPY pyproject.toml poetry.lock /app/
+RUN poetry config virtualenvs.create false
+RUN poetry install --no-dev --no-interaction --no-ansi
+
COPY ./mealie /app/mealie
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev
@@ -48,7 +47,6 @@ RUN poetry config virtualenvs.create false \
#! Future
# COPY ./alembic /app
# COPY alembic.ini /app
-
COPY ./Caddyfile /app
COPY ./dev/data/templates /app/data/templates
@@ -59,4 +57,4 @@ VOLUME [ "/app/data/" ]
EXPOSE 80
-CMD /app/mealie/run.sh
\ No newline at end of file
+CMD /app/mealie/run.sh
diff --git a/README.md b/README.md
index 3866eb43bf48..72a9a3176ff6 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,11 @@
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![Docker Pulls][docker-pull]][docker-pull]
+[](https://www.codefactor.io/repository/github/hay-kot/mealie)
+[](https://github.com/hay-kot/mealie/actions/workflows/dockerbuild.release.yml)
+[](https://github.com/hay-kot/mealie/actions/workflows/pytest.yml)
+[](https://github.com/hay-kot/mealie/actions/workflows/dockerbuild.dev.yml)
+[](https://github.com/hay-kot/mealie/actions/workflows/pytest.yml)
diff --git a/dev/scripts/scrape_recipe.py b/dev/scripts/scrape_recipe.py
deleted file mode 100755
index ce5f119ef890..000000000000
--- a/dev/scripts/scrape_recipe.py
+++ /dev/null
@@ -1,27 +0,0 @@
-"""
-Helper script to download raw recipe data from a URL and dump it to disk.
-The resulting files can be used as test input data.
-"""
-
-import sys, json, pprint
-import requests
-import extruct
-from scrape_schema_recipe import scrape_url
-from w3lib.html import get_base_url
-
-for url in sys.argv[1:]:
- try:
- data = scrape_url(url)[0]
- slug = list(filter(None, url.split("/")))[-1]
- filename = f"{slug}.json"
- with open(filename, "w") as f:
- json.dump(data, f, indent=4, default=str)
- print(f"Saved {filename}")
- except Exception as e:
- print(f"Error for {url}: {e}")
- print("Trying extruct instead")
- pp = pprint.PrettyPrinter(indent=2)
- r = requests.get(url)
- base_url = get_base_url(r.text, r.url)
- data = extruct.extract(r.text, base_url=base_url)
- pp.pprint(data)
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 850435e362b7..4e2ebdfd32c8 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -28,7 +28,6 @@ services:
ports:
- 9921:9000
environment:
- db_type: sqlite
TZ: America/Anchorage # Specify Correct Timezone for Date/Time to line up correctly.
volumes:
- ./dev/data:/app/dev/data
diff --git a/docker-compose.yml b/docker-compose.yml
index 457f81576d44..07593c5670d3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,4 +9,16 @@ services:
ports:
- 9090:80
environment:
- db_type: sqlite
+ DB_ENGINE: postgres # Optional: 'sqlite', 'postgres'
+ POSTGRES_USER: mealie
+ POSTGRES_PASSWORD: mealie
+ POSTGRES_SERVER: postgres
+ POSTGRES_PORT: 5432
+ POSTGRES_DB: mealie
+ postgres:
+ container_name: postgres
+ image: postgres
+ restart: always
+ environment:
+ POSTGRES_PASSWORD: mealie
+ POSTGRES_USER: mealie
diff --git a/docs/docs/changelog/v0.5.0.md b/docs/docs/changelog/v0.5.0.md
index 3eaa6e88d33a..22a899ea8a85 100644
--- a/docs/docs/changelog/v0.5.0.md
+++ b/docs/docs/changelog/v0.5.0.md
@@ -11,14 +11,22 @@
#### Database
Database version has been bumped from v0.4.x -> v0.5.0. You will need to export and import your data.
-
## Bug Fixes
- Fixed #332 - Language settings are saved for one browser
- Fixes #281 - Slow Handling of Large Sets of Recipes
+- Fixed #356 - Shopping lists generate duplicate items
+- Fixed #271 - Slow handling of larger data sets
## Features and Improvements
-- 'Dinner this week' shows a warning when no meal is planned yet
-- 'Dinner today' shows a warning when no meal is planned yet
+
+### Highlights
+- Beta Support for Postgres! 🎉 See the getting started page for details
+- Recipe Steps now support sections, assets, and additional settings.
+- New Toolbox Page!
+ - Bulk assign categories and tags by keyword search
+ - Title case all Categories or Tags with 1 click
+ - Create/Rename/Delete Operations for Tags/Categories
+ - Remove Unused Categories or Tags with 1 click
### Performance
- Images are now served up by the Caddy increase performance and offloading some loads from the API server
@@ -26,11 +34,10 @@
- All images are now converted to .webp for better compression
### General
-- New Toolbox Page!
- - Bulk assign categories and tags by keyword search
- - Title case all Categories or Tags with 1 click
- - Create/Rename/Delete Operations for Tags/Categories
- - Remove Unused Categories or Tags with 1 click
+- Updated recipe editor styles and moved notes to below the steps.
+- Redesigned search bar
+- 'Dinner this week' shows a warning when no meal is planned yet
+- 'Dinner today' shows a warning when no meal is planned yet
- More localization
- Start date for Week is now selectable
- Languages are now managed through Crowdin
@@ -41,8 +48,8 @@
- Improved search layout on mobile
- Profile image now shown on all sidebars
-
### Behind the Scenes
+- Black and Flake8 now run as CI/CD checks
- New debian based docker image
- Unified Sidebar Components
- Refactor UI components to fit Vue best practices (WIP)
diff --git a/docs/docs/contributors/developers-guide/code-contributions.md b/docs/docs/contributors/developers-guide/code-contributions.md
index eaf9ae4e87af..4e17067a05f2 100644
--- a/docs/docs/contributors/developers-guide/code-contributions.md
+++ b/docs/docs/contributors/developers-guide/code-contributions.md
@@ -9,11 +9,12 @@ We use github to host code, to track issues and feature requests, as well as acc
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
1. Fork the repo and create your branch from `dev`.
-2. Read the page in in [dev/dev-notes.md](https://github.com/hay-kot/mealie/blob/master/dev/dev-notes.md) to get an idea on where the project is at.
+2. Checkout the Discord, the PRs page, or the Projects page to get an idea of what's already being worked on.
3. If you're interested on working on major changes please get in touch on discord and coordinate with other developers. No sense in doubling up on work if someones already on it.
-4. If you've changed APIs, update the documentation.
-5. Issue that pull request!
-6. If you make changes to the dev branch reflect those changes in the dev/dev-notes.md to keep track of changes. Don't forget to add your name/handle/identifier!
+4. Once you've got an idea of what changes you want to make, create a draft PR as soon as you can to let us know what you're working on and how we can help!
+5. If you've changed APIs, update the documentation.
+6. Issue that pull request!
+7. If you make changes to the dev branch reflect those changes in the active changelog to keep track of changes. Don't forget to add your name/handle/identifier!
## Any contributions you make will be under the MIT Software License
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
diff --git a/docs/docs/contributors/developers-guide/general-guidelines.md b/docs/docs/contributors/developers-guide/general-guidelines.md
index c8743852d928..4a707283aa24 100644
--- a/docs/docs/contributors/developers-guide/general-guidelines.md
+++ b/docs/docs/contributors/developers-guide/general-guidelines.md
@@ -1,3 +1,5 @@
# Guidelines
-TODO
\ No newline at end of file
+## Python
+
+## Vue
\ No newline at end of file
diff --git a/docs/docs/contributors/developers-guide/starting-dev-server.md b/docs/docs/contributors/developers-guide/starting-dev-server.md
index f168229ca5ba..42583e50b110 100644
--- a/docs/docs/contributors/developers-guide/starting-dev-server.md
+++ b/docs/docs/contributors/developers-guide/starting-dev-server.md
@@ -8,7 +8,7 @@ Prerequisites
- Docker
- docker-compose
-You can easily start the development stack by running `make docker-dev` in the root of the project directory. This will run and build the docker-compose.dev.yml file.
+You can easily start the development stack by running `make docker-dev` in the root of the project directory. This will run and build the docker-compose.dev.yml file.
## Without Docker
Prerequisites
@@ -33,17 +33,8 @@ Once the prerequisites are installed you can cd into the project base directory
`make docker-prod` Builds docker-compose.yml to test for production
+## Before you Commit!
-## Trouble Shooting
-
-!!! Error "Symptom: Vue Development Server Wont Start"
- **Error:** `TypeError: Cannot read property 'upgrade' of undefined`
-
- **Solution:** You may be missing the `/frontend/.env.development.` The contents should be `VUE_APP_API_BASE_URL=http://127.0.0.1:9921`. This is a reference to proxy the the API requests from Vue to 127.0.0.1 at port 9921 where FastAPI should be running.
-
-!!! Error "Symptom: FastAPI Development Server Wont Start"
- **Error:** `RuntimeError: Directory '/app/dist' does not exist`
-
- **Solution:** Create an empty /mealie/dist directory. This directory is served as static content by FastAPI. It is provided during the build process and may be missing in development.
+Before you commit any changes on the backend/python side you'll want to run `make format` to format all the code with black. `make lint` to check with flake8, and `make test` to run pytests. You can also use `make test-all` to run both `lint` and `test`.
Run into another issue? [Ask for help on discord](https://discord.gg/QuStdQGSGK)
\ No newline at end of file
diff --git a/docs/docs/getting-started/api-usage.md b/docs/docs/getting-started/api-usage.md
deleted file mode 100644
index f44a308317e5..000000000000
--- a/docs/docs/getting-started/api-usage.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Usage
-
-## Getting a Token
-Bla Bla
-
-## Key Components
-### Recipe Extras
-Recipes extras are a key feature of the Mealie API. They allow you to create custom json key/value pairs within a recipe to reference from 3rd part applications. You can use these keys to contain information to trigger automation or custom messages to relay to your desired device.
-
-For example you could add `{"message": "Remember to thaw the chicken"}` to a recipe and use the webhooks built into mealie to send that message payload to a destination to be processed.
-
-
-
-Have Ideas? Submit a PR!
diff --git a/docs/docs/getting-started/install.md b/docs/docs/getting-started/install.md
index c89b7349f08b..cdcc72462a99 100644
--- a/docs/docs/getting-started/install.md
+++ b/docs/docs/getting-started/install.md
@@ -1,5 +1,5 @@
# Installation
-To deploy docker on your local network it is highly recommended to use docker to deploy the image straight from dockerhub. Using the docker-compose below you should be able to get a stack up and running easily by changing a few default values and deploying. Currently only SQLite is supported. Postrgres support is planned, however for most loads you may find SQLite performant enough.
+To deploy mealie on your local network it is highly recommended to use docker to deploy the image straight from dockerhub. Using the docker-compose below you should be able to get a stack up and running easily by changing a few default values and deploying. You can deploy with either SQLite (default) or Postgres. SQLite is sufficient for most use cases. Additionally, with mealies automated backup and restore functionality, you can easily move between SQLite and Postgres as you wish.
[Get Docker](https://docs.docker.com/get-docker/)
@@ -10,22 +10,12 @@ To deploy docker on your local network it is highly recommended to use docker to
- linux/arm/v7
- linux/arm64
-!!! tip "Fatal Python error: init_interp_main: can't initialize time"
- Some users experience an problem with running the linux/arm/v7 container on Raspberry Pi 4. This is not a problem with the Mealie container, but with a bug in the hosts Docker installation.
-
- Update the host RP4 using [instructions](linuxserver/docker-papermerge#4 (comment)), summarized here:
-
- ```shell
- wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb
- sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb
- ```
## Quick Start - Docker CLI
Deployment with the Docker CLI can be done with `docker run` and specify the database type, in this case `sqlite`, setting the exposed port `9925`, mounting the current directory, and pull the latest image. After the image is up an running you can navigate to http://your.ip.addres:9925 and you'll should see mealie up and running!
```shell
docker run \
- -e DB_TYPE='sqlite' \
-p 9925:80 \
-v `pwd`:'/app/data/' \
hkotel/mealie:latest
@@ -50,27 +40,68 @@ services:
ports:
- 9925:80
environment:
- DB_TYPE: sqlite
TZ: America/Anchorage
volumes:
- ./mealie/data/:/app/data
```
+## Docker Compose with Postgres *(BETA)*
+Postgres support was introduced in v0.5.0. At this point it should be used with caution and frequent backups.
+
+```yaml
+version: "3.1"
+services:
+ mealie:
+ container_name: mealie
+ image: hkotel/mealie:latest
+ restart: always
+ ports:
+ - 9090:80
+ environment:
+ DB_ENGINE: postgres # Optional: 'sqlite', 'postgres'
+ POSTGRES_USER: mealie
+ POSTGRES_PASSWORD: mealie
+ POSTGRES_SERVER: postgres
+ POSTGRES_PORT: 5432
+ POSTGRES_DB: mealie
+ postgres:
+ container_name: postgres
+ image: postgres
+ restart: always
+ environment:
+ POSTGRES_PASSWORD: mealie
+ POSTGRES_USER: mealie
+```
+
## Env Variables
-| Variables | Default | Description |
-| ---------------- | ------------------ | ----------------------------------------------------------------------------------- |
-| DB_TYPE | sqlite | The database type to be used. Current Options 'sqlite' |
-| DEFAULT_GROUP | Home | The default group for users |
-| DEFAULT_EMAIL | changeme@email.com | The default username for the superuser |
-| DEFAULT_PASSWORD | MyPassword | The default password for the superuser |
-| TOKEN_TIME | 2 | The time in hours that a login/auth token is valid |
-| API_PORT | 9000 | The port exposed by backend API. **do not change this if you're running in docker** |
-| API_DOCS | True | Turns on/off access to the API documentation locally. |
-| TZ | UTC | Must be set to get correct date/time on the server |
+| Variables | Default | Description |
+| ----------------- | ------------------ | ----------------------------------------------------------------------------------- |
+| DEFAULT_GROUP | Home | The default group for users |
+| DEFAULT_EMAIL | changeme@email.com | The default username for the superuser |
+| DB_ENGINE | sqlite | Optional: 'sqlite', 'postgres' |
+| POSTGRES_USER | mealie | Postgres database user |
+| POSTGRES_PASSWORD | mealie | Postgres database password |
+| POSTGRES_SERVER | postgres | Postgres database server address |
+| POSTGRES_PORT | 5432 | Postgres database port |
+| POSTGRES_DB | mealie | Postgres database name |
+| TOKEN_TIME | 2 | The time in hours that a login/auth token is valid |
+| API_PORT | 9000 | The port exposed by backend API. **do not change this if you're running in docker** |
+| API_DOCS | True | Turns on/off access to the API documentation locally. |
+| TZ | UTC | Must be set to get correct date/time on the server |
+!!! tip "Fatal Python error: init_interp_main: can't initialize time"
+ Some users experience an problem with running the linux/arm/v7 container on Raspberry Pi 4. This is not a problem with the Mealie container, but with a bug in the hosts Docker installation.
+
+ Update the host RP4 using [instructions](linuxserver/docker-papermerge#4 (comment)), summarized here:
+
+ ```shell
+ wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb
+ sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb
+ ```
+
## Advanced
@@ -82,17 +113,22 @@ The Docker image provided by Mealie contains both the API and the html bundle in
```
{
- auto_https off
+ auto_https off
admin off
}
:80 {
@proxied path /api/* /docs /openapi.json
-
+
root * /app/dist
encode gzip
uri strip_suffix /
+ handle_path /api/recipes/image/* {
+ root * /app/data/img/
+ file_server
+ }
+
handle @proxied {
reverse_proxy http://127.0.0.1:9000
}
diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html
index 62decc3f868f..85eacd4bb41d 100644
--- a/docs/docs/overrides/api.html
+++ b/docs/docs/overrides/api.html
@@ -14,7 +14,7 @@