55 lines
1.7 KiB
Markdown
55 lines
1.7 KiB
Markdown
# lapp
|
|
|
|
list app
|
|
|
|
install
|
|
1. clone repo
|
|
2. create subfolder "instance" to store database file
|
|
3. for an initial instance: run python3 initialze_data.py, with the python from the virtual-env
|
|
4. add the below config to your apache2 enabled site
|
|
|
|
## Secrets and configuration
|
|
|
|
LAPP does not store runtime secrets in the source code. Configure them with
|
|
environment variables in production:
|
|
|
|
```sh
|
|
export LAPP_SECRET_KEY="replace-with-a-long-random-secret"
|
|
export LAPP_APPLICATION_KEY="replace-with-another-long-random-secret"
|
|
export LAPP_DATABASE_URI="sqlite:///app.db"
|
|
```
|
|
|
|
`LAPP_SECRET_KEY` signs Flask sessions and auto-login cookies. Keep it stable:
|
|
changing it logs users out and invalidates existing auto-login cookies.
|
|
|
|
`LAPP_APPLICATION_KEY` is used by `/api/validate_key`.
|
|
|
|
`LAPP_DATABASE_URI` is optional. If it is not set, LAPP uses `sqlite:///app.db`.
|
|
|
|
For local development, if `LAPP_SECRET_KEY` or `LAPP_APPLICATION_KEY` is not set,
|
|
the app creates stable random secrets in:
|
|
|
|
```text
|
|
instance/secret_key
|
|
instance/application_key
|
|
```
|
|
|
|
The `instance/` directory is ignored by git, so these generated secrets should
|
|
not be committed.
|
|
|
|
## Initial data secrets
|
|
|
|
`initialize_data.py` creates initial users and groups only when the database has
|
|
no users yet. You can provide the initial passwords and group secrets with:
|
|
|
|
```sh
|
|
export LAPP_INITIAL_ADMIN_PASSWORD="replace-me"
|
|
export LAPP_INITIAL_ADMIN_GROUP="replace-me"
|
|
export LAPP_INITIAL_USER_PASSWORD="replace-me"
|
|
export LAPP_INITIAL_USER_GROUP="replace-me"
|
|
./venv/bin/python initialize_data.py
|
|
```
|
|
|
|
If these variables are not set, `initialize_data.py` generates random values and
|
|
prints them once when it creates the initial data.
|