Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions workshop/content/docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,105 +211,6 @@ Some notes:

Next, you can override the default configuration and add your own data using [Docker volumes](https://docs.Docker.com/storage/volumes).

## Customizing configuration

In the upcoming exercises we are going to update the configuration file multiple times.
For ease of development we are overriding the pygeoapi configuration which resides by default at `/pygeoapi/local.config.yml`
within the container by a local file which you can edit in your favourite text editor.

!!! question "Override the pygeoapi config file"

Download pygeoapi's default Docker configuration from [default.config.yml](https://raw.githubusercontent.com/geopython/pygeoapi/master/docker/default.config.yml) to the current folder (or navigate to the folder where you downloaded the file), for example with:

=== "Linux/Mac"

<div class="termy">
```bash
curl -O https://raw.githubusercontent.com/geopython/pygeoapi/master/docker/default.config.yml
```
</div>

=== "Windows (PowerShell)"

<div class="termy">
```bash
curl https://raw.githubusercontent.com/geopython/pygeoapi/master/docker/default.config.yml
```
</div>

Open the file in your favourite text editor and change the title and description of the API:

``` {.yml linenums="59"}
metadata:
identification:
title: My first pygeoapi run
description: pygeoapi provides an API to geospatial data
```

Now run the container with the overridden config file:

=== "Linux/Mac"

<div class="termy">
```bash
docker run -p 5000:80 \
-v $(pwd)/default.config.yml:/pygeoapi/local.config.yml \
geopython/pygeoapi:latest
```
</div>

=== "Windows (PowerShell)"

<div class="termy">
```bash
docker run -p 5000:80 -v ${pwd}/default.config.yml:/pygeoapi/local.config.yml geopython/pygeoapi:latest
```
</div>

At this point, navigate to `http://localhost:5000` to verify the new title and description.

!!! note

On Windows, the file downloaded may be renamed to `default.config.yml.txt`. Ensure to rename the file to `default.config.yml`.


By using a Docker volume mount (`-v` option), Docker attaches or 'mounts' a
directory or single file from your host/local system into the Docker Container.

In the above snippet, `$(pwd)` indicates the working folder from which you start the Docker container.

## Adding data and setting the configuration file

In addition to adapting the configuration you will usually add your own data as files or
remote data services like PostGIS or WFS.

You can also mount a local directory such as `data/` to `/pygeoapi/mydata` within the Container.
Within the data directory you can store vector data, raster files or sets of image of vector tiles.

Below is an example where the configuration is explictly set to `pygeoapi-config.yml` via an environment variable (`-e`) and uses a Docker mount to mount the local `data` folder as `/pygeoapi/mydata`:

=== "Linux/Mac"

<div class="termy">
```bash
docker run -p 5000:80 \
-v $(pwd)/data:/pygeoapi/mydata \
-v $(pwd)/default.config.yml:/pygeoapi/pygeoapi-config.yml \
-e PYGEOAPI_CONFIG=/pygeoapi/pygeoapi-config.yml \
geopython/pygeoapi:latest
```
</div>

=== "Windows (PowerShell)"

<div class="termy">
```bash
docker run -p 5000:80 -v ${pwd}/data:/pygeoapi/mydata -v ${pwd}/default.config.yml:/pygeoapi/pygeoapi-config.yml -e PYGEOAPI_CONFIG=/pygeoapi/pygeoapi-config.yml geopython/pygeoapi:latest
```
</div>

In the next sections we will review additional examples of mounts to the data folder. More Docker deployment examples can be found in the [pygeoapi GitHub repository](https://github.com/geopython/pygeoapi/tree/master/docker/examples).

## Using Docker for Python Clients

In some exercises we access `pygeoapi` remote endpoints using [OWSLib](https://owslib.readthedocs.io),
Expand Down