Skip to main content

Configure additional Snowplow Micro settings

This page describes additional configuration options for Snowplow Micro.

Enabling HTTPS

While in most cases HTTP is sufficient, you may want to enable HTTPS in Micro (for an example of when that’s useful, see Locally resolving an existing domain name to Micro).

You will need an SSL/TLS certificate in PKCS 12 format (.p12). Pass your certificate file and its password to the container (using a bind mount and an environment variable). Don’t forget to expose the HTTPS port (by default, 9543):

bash
docker run -p 9090:9090 -p 9543:9543 \
--mount type=bind,source=$(pwd)/my-certificate.p12,destination=/config/ssl-certificate.p12 \
-e MICRO_SSL_CERT_PASSWORD=... \
snowplow/snowplow-micro:4.0.0
note

For the certificate, the path inside the container must be exactly /config/ssl-certificate.p12.

You should see a message like this in the logs:

[INFO] com.snowplowanalytics.snowplow.micro.Main$ - HTTPS REST interface bound to /0.0.0.0:9543

As usual, you can change the ports to your liking (see Running Micro).

Adding custom Iglu resolver configuration

If you’d like to tweak the Iglu registries Micro uses, the priority between them, the cache sizes, etc, you can provide your own Iglu resolver configuration (iglu.json).

tip

If you are just looking to add custom schemas or connect to your private Iglu registry, check out Adding custom schemas for simpler ways to achieve that.

Pass your configuration file to the container (using a bind mount) and instruct Micro to use it:

bash
docker run -p 9090:9090 \
--mount type=bind,source=$(pwd)/iglu.json,destination=/config/iglu.json \
snowplow/snowplow-micro:4.0.0 \
--iglu /config/iglu.json

That’s it. You can use the the API to check if Micro is able to reach your schemas (replace com.example and my-schema as appropriate).

bash
curl localhost:9090/micro/iglu/com.example/my-schema/jsonschema/1-0-0

Adding custom collector configuration

If you’d like to tweak the collector configuration inside Micro, the simplest approach is to override individual settings. For example, to change the cookie name:

bash
docker run -p 9090:9090 \
snowplow/snowplow-micro:4.0.0 \
-Dcollector.cookie.name=sp

For more extensive changes, you can also bring your own configuration file (micro.conf).

Example
hclmicro.conf
loading...

Pass your configuration file to the container (using a bind mount) and instruct Micro to use it:

bash
docker run -p 9090:9090 \
--mount type=bind,source=$(pwd)/micro.conf,destination=/config/micro.conf \
snowplow/snowplow-micro:4.0.0 \
--collector-config /config/micro.conf

Persisting events across restarts

By default, Micro only stores events in memory. Since version 4.0.0, you can connect it to a PostgreSQL database to persist events across restarts.

To enable this, first create a storage configuration file:

hclstorage.conf
host = "localhost"
port = 5432
database = "micro_test"
user = "test_user"

// How long to keep the events for (minimum: 5m)
ttl = "7d"

// How often to clean up expired events (minimum: 1m)
cleanupInterval = "1h"

Next, place the database password into an environment variable named MICRO_POSTGRESQL_PASSWORD.

Now you can run Micro and pass the configuration, as well as the password:

bash
docker run -p 9090:9090 \
--mount type=bind,source=$(pwd)/storage.conf,destination=/config/storage.conf \
-e MICRO_POSTGRESQL_PASSWORD \
snowplow/snowplow-micro:4.0.0 \
--storage /config/storage.conf