mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
Make the Makefile work, document prod running without Docker
- Fix up bashisms such as use of source - Run venv insertion via poetry - Use uvicorn for prod backend runs - Git ignore frontend/dist
This commit is contained in:
parent
d621e4e580
commit
1bd7857bd0
4 changed files with 72 additions and 29 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,6 +9,8 @@ mealie/temp/*
|
|||
mealie/temp/api.html
|
||||
.temp/
|
||||
|
||||
# ignore frontend build artefacts
|
||||
frontend/dist
|
||||
|
||||
app_data/backups/*
|
||||
app_data/debug/*
|
||||
|
|
32
Makefile
Normal file
32
Makefile
Normal file
|
@ -0,0 +1,32 @@
|
|||
all: build backend
|
||||
setup: setup-backend setup-frontend
|
||||
build: setup build-frontend
|
||||
backend: uvicorn
|
||||
frontend: vue
|
||||
|
||||
setup-backend:
|
||||
poetry install
|
||||
|
||||
setup-frontend:
|
||||
cd frontend && npm install
|
||||
|
||||
build-frontend:
|
||||
cd frontend && npm run build
|
||||
|
||||
uvicorn:
|
||||
poetry run uvicorn mealie.app:app --host 0.0.0.0 --port 9000
|
||||
|
||||
mealie.app:
|
||||
poetry run python mealie/app.py
|
||||
|
||||
vue:
|
||||
cd frontend && npm run serve
|
||||
|
||||
mdocs:
|
||||
cd docs && poetry run mkdocs serve
|
||||
|
||||
docker-dev:
|
||||
docker-compose -f docker-compose.dev.yml -p dev-mealie up --build
|
||||
|
||||
docker-prod:
|
||||
docker-compose -p mealie up --build -d
|
|
@ -17,15 +17,48 @@ Prerequisites
|
|||
- Poetry
|
||||
- Nodejs
|
||||
- npm
|
||||
- Caddy
|
||||
|
||||
Once the prerequisites are installed you can cd into the project base directory and run `make setup` to install the python and node dependencies. Once that is complete you can run `make backend` and `make vue` to start the backend and frontend servers.
|
||||
Once the prerequisites are installed you can cd into the project base directory and run `make build` to install the python and node dependencies and build the frontend webroot.You will need to configure Caddy to serve the webroot and proxy the api & mdocs. Something along these lines would be a good starting point for `/etc/caddy/Caddyfile`:
|
||||
```
|
||||
{
|
||||
auto_https off
|
||||
admin off
|
||||
}
|
||||
|
||||
## Make File Reference
|
||||
:80 {
|
||||
@proxied path /api/* /docs /openapi.json
|
||||
|
||||
root * /path/to/mealie.git/frontend/dist
|
||||
encode gzip
|
||||
uri strip_suffix /
|
||||
|
||||
handle @proxied {
|
||||
reverse_proxy http://127.0.0.1:9000
|
||||
}
|
||||
|
||||
handle {
|
||||
try_files {path}.html {path} /
|
||||
file_server
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Makefile Reference
|
||||
|
||||
### Prod environment
|
||||
`make build` installs dependencies and builds the frontend ready for prod use
|
||||
|
||||
`make backend` Starts the backend server on port `9000` via uvicorn
|
||||
|
||||
|
||||
### Dev environment
|
||||
`make setup` installs python and node dependencies
|
||||
|
||||
`make backend` Starts the backend server on port `9000`
|
||||
`make frontend` Starts the frontend server on port `8080` via npm serve
|
||||
|
||||
`make vue` Starts the frontend server on port `8080`
|
||||
`make mealie.app` Starts the backend server on port `9000` directly from `mealie/app.py`
|
||||
|
||||
`make mdocs` Starts the documentation server on port `8000`
|
||||
|
||||
|
@ -46,4 +79,4 @@ Once the prerequisites are installed you can cd into the project base directory
|
|||
|
||||
**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.
|
||||
|
||||
Run into another issue? [Ask for help on discord](https://discord.gg/R6QDyJgbD2)
|
||||
Run into another issue? [Ask for help on discord](https://discord.gg/R6QDyJgbD2)
|
||||
|
|
24
makefile
24
makefile
|
@ -1,24 +0,0 @@
|
|||
setup:
|
||||
poetry install && \
|
||||
cd frontend && \
|
||||
npm install && \
|
||||
cd ..
|
||||
|
||||
backend:
|
||||
source ./.venv/bin/activate && python mealie/app.py
|
||||
|
||||
vue:
|
||||
cd frontend && npm run serve
|
||||
|
||||
mdocs:
|
||||
source ./.venv/bin/activate && \
|
||||
cd docs && \
|
||||
mkdocs serve
|
||||
|
||||
docker-dev:
|
||||
docker-compose -f docker-compose.dev.yml -p dev-mealie up --build
|
||||
|
||||
docker-prod:
|
||||
docker-compose -p mealie up --build -d
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue