There is a Dockerfile for quick deployment. This section explains how to get the STAC service up and running with Docker. If you do not have Docker installed, take a look at this tutorial on how to install it in your system.
Besides Docker, you will need an instance of a PostgreSQL DBMS with a database prepared using Brazil Data Cube Catalog Module.
- On the command line use the
docker build
command to create the docker image for the service:: - docker build --no-cache -t bdc-stac:0.9.0-0 .
The above command will create a Docker image named bdc-stac
and tag 0.9.0-0`, as one can see with the ``docker images
command:
docker images REPOSITORY TAG IMAGE ID CREATED SIZE bdc-stac 0.8.1-0 44651ac917e4 16 hours ago 333MB
If you have the PostgreSQL server running in a Docker container and you want to have it accessible to the STAC service, you can create a Docker network and attach your PostgreSQL container to it.
Note
If you have a valid address for the PostgreSQL DBMS you can skip this section.
To create a new network, you ca use the docker network
command:
docker network create bdc_net
The above command will create a network named bdc_net
. Now, it is possible to attach your database container in this network:
docker network connect bdc_net bdc_pg
In the previous command, we are supposing that your database container is named bdc_pg
.
The docker run
command can be used to launch a container from the image bdc-stac:0.9.0-0
. The command below shows an example on how to accomplish the launch of a container:
docker run --detach \ --name bdc-stac \ --publish 127.0.0.1:8080:5000 \ --network=bdc_net \ --env SQLALCHEMY_DATABASE_URI="postgresql://postgres:postgres@localhost:5432/bdc_catalog" \ --env BDC_STAC_BASE_URL="http://localhost:8080" \ --env BDC_STAC_FILE_ROOT="http://localhost:8081" \ bdc-stac:0.8.1-0
Let's take a look at each parameter in the above command:
--detach
: tells Docker that the container will run in background (daemon).--name bdc-stac
: names the container.--publish 127.0.0.1:8080:5000
: by default the STAC service will be running on port5000
of the container. You can bind a host port, such as8080
to the container port5000
.--network=bdc_net
: if the container should connect to the database server through a docker network, this parameter will automatically attach the container to thebdc_net
. You can omit this parameter if the database server address can be resolved directly from a host address.--env SQLALCHEMY_DATABASE_URI="postgresql://postgres:postgres@localhost:5432/bdc_catalog"
: set the database URI.[1].--env BDC_STAC_BASE_URL="http://localhost:8080"
: Base URI of the service.--env BDC_STAC_FILE_ROOT="http://localhost:8081"
: File root for the imageassets
.bdc-stac:0.9.0-0
: the name of the base Docker image used to create the container.
If you have launched the container, you can check if the service has initialized:
docker logs bdc-stac * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
Finally, to test if it is listening, use the curl
command:
$ curl localhost:8080
The output should be a JSON document similar to:
{
"description": "Brazil Data Cube Catalog",
"id": "bdc",
"stac_version": "0.9.0",
"links": [
{
"href": "http://localhost:5000/",
"rel": "self",
"type": "application/json",
"title": "Link to this document"
},
{
"href": "http://localhost:5000/docs",
"rel": "service-doc",
"type": "text/html",
"title": "API documentation in HTML"
},
{
"href": "http://localhost:5000/conformance",
"rel": "conformance",
"type": "application/json",
"title": "OGC API conformance classes implemented by the server"
},
{
"href": "http://localhost:5000/collections",
"rel": "data",
"type": "application/json",
"title": "Information about image collections"
},
{
"href": "http://localhost:5000/search",
"rel": "search",
"type": "application/json",
"title": "STAC-Search endpoint"
},
{
"href": "http://localhost:5000/collections/CB4_64_16D_STK-1",
"rel": "child",
"type": "application/json",
"title": "Cbers-4 WFI 16 days"
},
{
"href": "http://localhost:5000/collections/CB4_64-1",
"rel": "child",
"type": "application/json",
"title": "Cbers-4 WFI Irregular"
},
{
"href": "http://localhost:5000/collections/CB4-MUX-L4-SR-CMPAC-1",
"rel": "child",
"type": "application/json",
"title": "CBERS-4 MUX surface reflectance product (Level-5)"
},
{
"href": "http://localhost:5000/collections/RF_ANL-1",
"rel": "child",
"type": "application/json",
"title": "Risco de Fogo - Anual"
}
]
}
Footnotes
[1] | See the Brazil Data Cube Catalog Module. |