A virtual recipe book, written in Go and Vue.js
The easiest way to setup rezept is by using docker-compose.
- Create a
docker-compose.yml
file:
version: '3'
services:
frontend:
image: 'rezept/rezept-frontend:${VERSION}'
environment:
- API_URL=/api
- BASE_URL=/
- PAGE_TITLE=${PAGE_TITLE}
backend:
image: 'rezept/rezept-backend:${VERSION}'
environment:
- PATH_PREFIX=/
- API_PREFIX=/
- BIND_ADDRESS=0.0.0.0:8080
- DB_PATH=/data/rezept.sqlite
- IMAGE_PATH=/data/images
- IMAGE_URL=/api/images
- SIGNUP_ALLOWED=${SIGNUP_ALLOWED}
volumes:
- "./data:/data"
reverse-proxy:
image: 'rezept/rezept-reverse-proxy:${VERSION}'
ports:
- "${LISTEN}:80"
depends_on:
- frontend
- backend
- Create a
.env
file (you can change the parameters to your likening):
PAGE_TITLE=rezept
LISTEN=8080
VERSION=latest
SIGNUP_ALLOWED=true
- Run with
docker-compose up
- the application should be available on port 8080. When opened, you will be prompted to create an admin account.
The backend docker container is available as rezept/rezept-backend
. You should specify the following environment variables:
BIND_ADDRESS
: On which address to bind the HTTP server,host:port
formatDB_PATH
: Where the database should be stored - ideally in a docker volumeIMAGE_PATH
: Where images should be stored - ideally in a docker volumeIMAGE_URL
: Prefix which should be prepended to image urls - it should correspond to where the /images resource will be availableSIGNUP_ALLOWED
: Specifies whether new users are allowed to sign up (true or false)
The frontend docker container is available as rezept-frontend
. You should specify the following environment variables:
API_URL
: Base url of the API (rezept-backend), defaults to/api
.BASE_URL
: Must be/
for now. If you want to serve the frontend under a different base path/$PREFIX
, you have to adapt the Dockerfile and changeRUN npm run build
toRUN npx parcel build --no-source-maps --no-autoinstall --public-url '/$PREFIX' src/index.html
and then adapt this parameter. Defaults to/
.PAGE_TITLE
: Name of this application, defaults torezept
.
Clone this repository and then build the backend and frontend separately:
cd backend
go mod download -x
go install -v ./...
- Create a
config.json
file:
{
"PathPrefix": "/",
"APIPrefix": "/",
"Address": "On which address to bind the HTTP server, host:port format",
"DBPath": "Path to where the sqlite databse should be stored",
"ImagePath": "Path to directory where images should be stored",
"ImageURL": "Prefix which should be prepended to image urls - it should correspond to where the /images resource will be available",
"SignupAllowed": true or false
}
- Run
rezept [path-to-config.json]
cd frontend
npm install
- Modify
.env
file:
PAGE_TITLE="Name of this application"
BASE_URL="/"
API_URL="Path to where the API is reachable"
npm run build
- Assets are available in the
dist
folder - deploy them on a web server of your preference.
(If you want to serve the frontend on a path different than /
: Modify BASE_URL
and run npx parcel build --no-source-maps --no-autoinstall --public-url '/$BASE_URL' src/index.html
instead of npm run build
)