We are very pleased to announce version 0.8.0 of Iglu Server.
Iglu server is a http api implementation of an Iglu schema repository. It is extensively used by snowplow pipelines, for storing and versioning the schemas of events and entities. Our docs site has a guide to run and configure the server.
Reject invalid schemas
Previous versions of Iglu Server were extremely permissive in accepting new schemas to store in the database. They would even accept completely invalid schemas, which we found was very unhelpful for clients expecting to work only with valid schemas.
Here is an example of a request that POSTs a schema with an invalid โtypeโ field:
curl -XPOST localhost:8080/api/schemas \
-H "apikey: 00000000-0000-0000-0000-000000000000" \
-d '{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Invalid schema",
"self": {
"vendor": "com.example",
"name": "invalid_schema",
"format": "jsonschema",
"version": "1-0-0"
},
"type": 12345
}'
Previous versions of Iglu Server would respond with a successful 201 response code, but Iglu Server 0.8.0 will correctly respond with a 400 response code to say the request is bad.
Graceful shutdown
We recently announced and described graceful shutdown for the Snowplow collector with settings to ensure that requests are not lost during an autoscaling event. Here we have implemented the same thing again for Iglu Server, so you can be sure your Iglu clients always receive โOKโ responses, even when a server is starting to shut down.
Iglu Server 0.8.0 makes the following actions when it receives a trappable termination signal (e.g. a SIGINT or SIGTERM).
- Trap the signal and initially wait for a configurable amount of time. We call this the pre-termination period. During this period, the server continues to accept connections, and respond to requests.
- Shutdown the http server. When the pre-termination period is over, then the server immediately closes the underlying tcp connection pool, so any in-flight request at this moment receives a 503 response code.
- Close connections to the postgres database.
You may notice that sequence is subtly different to the termination sequence described for the Snowplow collector, which is because the servers are built upon different http implementations.
The default values for the pre-termination period is 1 second. With a certain amount of trial and error, you can make sure that the pre-termination period is long enough such that your load balancer is no longer routing requests to the Iglu server by the time the tcp connection pool is closed. The details depend on which load balaner you are using, but a sensible value in production might be a couple of minutes.
Upgrading to 0.8.0
If you are already using version 0.7.0 then you can simply start using the new docker image without making any changes:
docker pull snowplow/iglu-server:0.8.0
Optionally, if you want to fine-tune graceful shutdown, then you can add an extra key to your configuration hocon file:
"preTerminationPeriod": "5 minutes"
Our docs site has instructions on setting up an Iglu Server and a full list of all configuration options