This docker image runs as a normal docker container, but can also run as a function in OpenFaaS. This is not recommended at this time, as the PDF creation can take to long, and it might time-out.
Running on https://kvittering.abakus.no
This is one docker image that serves both the python api, and the next/react frontend, this is done by building the webapp as a static site, and serving it as static files through flask.
# Install all packages
$ yarn
# Start server
$ yarn dev
Requires Poetry
# Make a virtual environment
$ python -m venv venv
$ source venv/bin/activate
# Install packages
$ poetry install
# Export the frontend
$ yarn build
# Start the server
$ python server/server.py
The webapp will be available on
localhost:5000
One of the packages (
pdf2image
) will requirepoppler
to work correctly with tmp files. Most linux distros come with this. For MacOSbrew install poppler
Variable | Function |
---|---|
MAIL_ADDRESS |
Set the mail address for generated receipts |
SERVICE_ACCOUNT_STR |
Base64 encoded service account. This means the whole .json downloaded from google |
ENVIRONMENT |
Set to "production" for sentry errors |
SENTRY_DSN |
Ingest errors to sentry |
To create a
Base64Encoded
str usecat <yourfile>.json | base64
It's nice to quickly generate PDFs
when developing, without having to start up everything. To do this you can run:
$ python server/generate-example.py signature.png output.pdf image0.png image1.png ...
Where signature.png
and imageN.png
are paths to image files (the latter images are optional)
Run cypress tests
# In one shell
$ yarn dev
# In another shell
$ yarn cypress
New versions are automatically built and deployed when pushing to the master
branch.