Adapt Readme
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Armin Friedl 2020-11-08 20:29:04 +01:00
parent 1782a97bcb
commit 11d228326c

View file

@ -17,7 +17,7 @@ The simplest way to get started is to run snip from the regularily [published
docker containers](https://hub.docker.com/repository/docker/arminfriedl/snip).
```shell
docker run -p5000 arminfriedl/snip:latest
docker run -p5000 -e"SNIP_FLASK_SECRET=secretkey" arminfriedl/snip:latest
```
Then navigate your browser to http://localhost:5000. Alternatively, you can also
@ -25,7 +25,22 @@ query the REST API. For an example see the [querysheet.http](querysheet.http) in
this repository. If you want to run it manually you can also install snip and
its dependencies yourself.
### Install Dependencies
Per default the container is configured with the following settings
```
SNIP_DATABASE="sqlite"
SNIP_DATABASE_URI="sqlite:////data/snip.db"
SNIP_FLASK_HOST="0.0.0.0"
# SNIP_FLASK_PORT=5000 (default)
```
You can mount an external folder under `/data` to persist all operational data
of snip across restarts of the container.
### Install and Run manually
While docker is convenient you may want to build and run snip yourself. E.g. for
development or because you need special settings.
#### Install Dependencies
To install the dependencies for snip, you need
[pipenv](https://pipenv.pypa.io/en/latest/) and [npm](https://www.npmjs.com/)
installed on your system. Then run:
@ -35,7 +50,17 @@ pipenv install --dev
npm install --dev
```
### Build Snip
#### Configure
Snip provides a couple of configuration options. For details see
[config.py::SnipConfig](snip/config.py). An example configuration for local
development is provided in [.snipenv.local](.snipenv.local). Adapt the
configuration to your needs.
You can also specify another stage in [.snipenv](.snipenv) by setting the
variable `SNIP_STAGE=[stage]`. The configuration will then be read from
`.snipenv.[stage]`.
#### Build the Snip Frontend
The snip backend itself needs no separate build step. However, the frontend
needs to be assembled by webpack.
@ -48,14 +73,12 @@ npm run watch
npm run publish
```
### Run Snip
#### Run Snip
From the repository root run:
```shell
export FLASK_ENV=production # or development
export FLASK_APP=snip
pipenv run flask run
export SNIP_STAGE=local # or any other stage
pipenv run python -m snip
```
Flask will tell you where you can reach snip, per default http://localhost:5000.