|
| 1 | +[](https://github.com/qwc-services/qwc-qgs-cache-preseed/actions) |
| 2 | +[](https://hub.docker.com/r/sourcepole/qwc-qgs-cache-preseed) |
| 3 | + |
| 4 | +QWC QGS Cache Pre-Seed |
| 5 | +====================== |
| 6 | + |
| 7 | +Docker image for pre-seeding the QGIS Server QGS project cache. |
| 8 | + |
| 9 | +This image will periodically query the capabilities for all QGS projects below |
| 10 | +the projects directory to ensure that the projects are cached in the QGIS Server |
| 11 | +project cache, helping to avoid slow server responses which occur when a project |
| 12 | +is not in cache. |
| 13 | + |
| 14 | +Setup |
| 15 | +----- |
| 16 | + |
| 17 | +Add the `qwc-qgs-cache-preseed` container configuration to your QWC `docker-compose.yml`: |
| 18 | +```yml |
| 19 | + qwc-qgis-server: |
| 20 | + image: docker.io/sourcepole/qwc-qgis-server:<tag> |
| 21 | + environment: |
| 22 | + FCGI_MIN_PROCESSES: 10 |
| 23 | + FCGI_MAX_PROCESSES: 10 |
| 24 | + ... |
| 25 | + volumes: |
| 26 | + - ./volumes/qgs-resources:/data:ro |
| 27 | + ... |
| 28 | + |
| 29 | + qwc-qgs-cache-preseed: |
| 30 | + image: docker.io/sourcepole/qwc-qgs-cache-preseed:<tag> |
| 31 | + environment: |
| 32 | + EXECUTE_ON_STARTUP: 1 |
| 33 | + CRON_SCHEDULE: "0 3 * * *" |
| 34 | + QGS_EXT: ".qgs" |
| 35 | + FCGI_INSTANCES: 10 |
| 36 | + volumes: |
| 37 | + - ./volumes/qgs-resources:/data:ro |
| 38 | +``` |
| 39 | +
|
| 40 | +Configuration |
| 41 | +------------- |
| 42 | +
|
| 43 | +Make sure to mount the `qgs-resources` dir (or whichever directory is mounted to `/data` for `qwc-qgis-server`) to `/data`. |
| 44 | + |
| 45 | +The following environment variables can be set: |
| 46 | + |
| 47 | +| Name | Default | Description | |
| 48 | +|----------------------|-------------|----------------------------------------------------------------------------------| |
| 49 | +| `CRON_SCHEDULE` | `0 3 * * *` | Interval at which the pre-seeding script is run. Default: every day at 03:00. | |
| 50 | +| `EXECUTE_ON_STARTUP` | `0` | Whether to run the script when the container starts. | |
| 51 | +| `QGS_EXT` | `.qgs` | The QGS project extension to look for (`.qgs` or `.qgz`). | |
| 52 | +| `FCGI_INSTANCES` | `10` | The number of FCGI instances (i.e. the number if simultaneous requests to send). | |
| 53 | +| `SLEEP_INTERVAL` | `1` | The sleep interval in seconds between sending requests. | |
| 54 | + |
| 55 | +*Note*: You should set `FCGI_MIN_PROCESSES` equals to `FCGI_MAX_PROCESSES` in the `qwc-qgis-server` container configuration |
| 56 | +and `FCGI_INSTANCES` to the same number in the `qwc-qgs-cache-preseed` container configuration. |
0 commit comments