Installing Apicurio Registry using Docker
This chapter explains how to install and run Apicurio Registry using Docker with the following storage options:
You can install more than one instance of Apicurio Registry depending on your environment. The number of instances depends on your storage option, for example, your Kafka, Infinispan, or database cluster configuration, and on the number and type of artifacts stored in Apicurio Registry. |
-
For details on building from source, see https://github.com/Apicurio/apicurio-registry.
Installing Apicurio Registry with in-memory storage
This section explains how to install and run Apicurio Registry with simple in-memory storage from a container image.
The in-memory storage option is suitable for development only. All data is lost when the container image is restarted. |
-
You must have Docker installed and the Docker daemon running.
-
Ensure that you can connect to the container repository: https://hub.docker.com/r/apicurio/apicurio-registry-mem.
-
Get the Apicurio Registry container image:
$ docker pull apicurio/apicurio-registry-mem
-
Run the container image:
$ docker run -it -p 8080:8080 apicurio/apicurio-registry-mem:latest
-
Send a test request using the Apicurio Registry REST API. For example, enter the following
curl
command to create a simple Avro schema artifact for a share price application in the registry:$ curl -X POST -H "Content-type: application/json; artifactType=AVRO" -H "X-Registry-ArtifactId: share-price" --data '{"type":"record","name":"price","namespace":"com.example","fields":[{"name":"symbol","type":"string"},{"name":"price","type":"string"}]}' http://localhost:8080/api/artifacts
-
Verify that the response includes the expected JSON body to confirm that the Avro schema artifact was created in the registry. For example:
{"createdOn":1578310374517,"modifiedOn":1578310374517,"id":"share-price","version":1,"type":"AVRO","globalId":8}
-
For more REST API sample requests, see the Apicurio Registry REST API documentation.
-
For a demonstration based on Kafka Streams storage, see https://github.com/Apicurio/apicurio-registry-demo.
Installing Apicurio Registry with JPA storage
This section explains how to install and run Apicurio Registry with Java Persistence API storage from a container image. This storage option is suitable for production environments.
-
You must have Docker installed and the Docker daemon running.
-
Ensure that you can connect to the container repository: https://hub.docker.com/r/apicurio/apicurio-registry-jpa.
-
You must already have a PostgreSQL database server installed and running. For example:
$ postgres -D /usr/local/pgsql/data
For more details, see https://www.postgresql.org/docs/12/server-start.html
-
Get the Apicurio Registry container image:
$ docker pull apicurio/apicurio-registry-jpa
-
Run the container image and specify the database connection URL and credentials for the PostgreSQL server as environment variables:
$ docker run -it -p 8080:8080 \ -e "QUARKUS_DATASOURCE_URL=jdbc:postgresql://postgres/apicurio-registry" \ -e "QUARKUS_DATASOURCE_USERNAME=apicurio-registry" \ -e "QUARKUS_DATASOURCE_PASSWORD=password" \ apicurio/apicurio-registry-jpa:latest
-
Send a test request using the Apicurio Registry REST API. For example, enter the following
curl
command to create a simple Avro schema artifact for a share price application in the registry:$ curl -X POST -H "Content-type: application/json; artifactType=AVRO" -H "X-Registry-ArtifactId: share-price" --data '{"type":"record","name":"price","namespace":"com.example","fields":[{"name":"symbol","type":"string"},{"name":"price","type":"string"}]}' http://localhost:8080/api/artifacts
-
Verify that the response includes the expected JSON body to confirm that the Avro schema artifact was created in the registry. For example:
{"createdOn":1578310374517,"modifiedOn":1578310374517,"id":"share-price","version":1,"type":"AVRO","globalId":8}
-
For more REST API sample requests, see the Apicurio Registry REST API documentation.
-
For more details on PostgreSQL, see the PostgreSQL documentation.
-
For a demonstration based on Kafka Streams storage, see https://github.com/Apicurio/apicurio-registry-demo.
Installing Apicurio Registry with embedded Infinispan storage
This section explains how to install and run Apicurio Registry with embedded Infinispan storage from a container image. This storage option is based on Infinispan community Java libraries embedded in the Quarkus-based Apicurio Registry server. You do not need to install a separate Infinispan server using this storage option.
The default embedded Infinispan storage is suitable for development only. If you do not configure an Infinispan cluster, all data is lost when the container image is restarted. For more details on Infinispan, see the Infinispan documentation. |
-
You must have Docker installed and the Docker daemon running.
-
Ensure that you can connect to the container repository: https://hub.docker.com/r/apicurio/apicurio-registry-mem.
-
Get the Apicurio Registry container image:
$ docker pull apicurio/apicurio-registry-infinispan:latest
-
Run the container image:
$ docker run -it -p 8080:8080 apicurio/apicurio-registry-infinispan:latest
-
Send a test request using the Apicurio Registry REST API. For example, enter the following
curl
command to create a simple Avro schema artifact for a share price application in the registry:$ curl -X POST -H "Content-type: application/json; artifactType=AVRO" -H "X-Registry-ArtifactId: share-price" --data '{"type":"record","name":"price","namespace":"com.example","fields":[{"name":"symbol","type":"string"},{"name":"price","type":"string"}]}' http://localhost:8080/api/artifacts
-
Verify that the response includes the expected JSON body to confirm that the Avro schema artifact was created in the registry. For example:
{"createdOn":1578310374517,"modifiedOn":1578310374517,"id":"share-price","version":1,"type":"AVRO","globalId":8}
-
For more REST API sample requests, see the Apicurio Registry REST API documentation.
-
For more details on Infinispan, see https://infinispan.org/.
-
For a demonstration based on Kafka Streams storage, see https://github.com/Apicurio/apicurio-registry-demo.
Installing Apicurio Registry with Apache Kafka storage
This topic explains how to install and run Apicurio Registry with Kafka storage from a container image. This storage option is suitable for production environments.
The following Kafka-based systems are supported:
-
Apache Kafka 2.2.x
-
Apache Kafka 2.3
-
You must have Docker installed and the Docker daemon running.
-
Ensure that you can connect to the container repository: https://hub.docker.com/r/apicurio/apicurio-registry-kafka.
-
Ensure that
KAFKA_HOME
is set to the location of your Kafka-based system. -
You must already have your Kafka broker running. For example:
$KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties & $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties &
For more details, see https://kafka.apache.org/quickstart.
-
Get the Apicurio Registry container image:
$ docker pull apicurio/apicurio-registry-kafka
-
Run the container image and specify the following environment variable for your Kafka system:
-
KAFKA_BOOTSTRAP_SERVERS
- The address(es) of your Kafka broker(s).For example:
$ docker run -it -p 8080:8080 -e "KAFKA_BOOTSTRAP_SERVERS=kafka:9092" apicurio/apicurio-registry-kafka:latest
-
-
Send a test request using the Apicurio Registry REST API. For example, enter the following
curl
command to create a simple Avro schema artifact for a share price application in the registry:$ curl -X POST -H "Content-type: application/json; artifactType=AVRO" -H "X-Registry-ArtifactId: share-price" --data '{"type":"record","name":"price","namespace":"com.example","fields":[{"name":"symbol","type":"string"},{"name":"price","type":"string"}]}' http://localhost:8080/api/artifacts
-
Verify that the response includes the expected JSON body to confirm that the Avro schema artifact was created in the registry. For example:
{"createdOn":1578310374517,"modifiedOn":1578310374517,"id":"share-price","version":1,"type":"AVRO","globalId":8}
-
For more REST API sample requests, see the Apicurio Registry REST API documentation.
-
For a demonstration based on Kafka Streams storage, see https://github.com/Apicurio/apicurio-registry-demo.
-
For more details on Apache Kafka, see https://kafka.apache.org/documentation/.
Installing Apicurio Registry with Apache Kafka Streams storage
This topic explains how to install and run Apicurio Registry with Kafka Streams storage from a container image. This storage option is suitable for production environments.
-
You must have Docker installed and the Docker daemon running.
-
Ensure that you can connect to the container repository: https://hub.docker.com/r/apicurio/apicurio-registry-streams.
-
Ensure that
KAFKA_HOME
is set to the location of your Kafka-based system. -
You must already have a Kafka broker running. For example:
$KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties & $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties &
-
You must have created the following topics for Kafka Streams storage:
$KAFKA_HOME/bin/kafka-topics.sh --zookeeper localhost --create --topic storage-topic --partitions 1 --replication-factor 1 --config cleanup.policy=compact $KAFKA_HOME/bin/kafka-topics.sh --zookeeper localhost --create --topic global-id-topic --partitions 1 --replication-factor 1 --config cleanup.policy=compact
For more details, see https://kafka.apache.org/quickstart.
-
Get the Apicurio Registry container image:
$ docker pull apicurio/apicurio-registry-kafka-streams
-
Run the container image and specify the following environment variables for your Kafka system:
-
KAFKA_BOOTSTRAP_SERVERS
- The address(es) of your Kafka broker(s). -
APPLICATION_ID
- The name of your Kafka Streams application.For example:
$ docker run -it -p 8080:8080 -e "KAFKA_BOOTSTRAP_SERVERS=kafka:9092" -e "APPLICATION_ID=my-kafka-streams-app" apicurio/apicurio-registry-kafka-streams:latest
-
-
Send a test request using the Apicurio Registry REST API. For example, enter the following
curl
command to create a simple Avro schema artifact for a share price application in the registry:$ curl -X POST -H "Content-type: application/json; artifactType=AVRO" -H "X-Registry-ArtifactId: share-price" --data '{"type":"record","name":"price","namespace":"com.example","fields":[{"name":"symbol","type":"string"},{"name":"price","type":"string"}]}' http://localhost:8080/api/artifacts
-
Verify that the response includes the expected JSON body to confirm that the Avro schema artifact was created in the registry. For example:
{"createdOn":1578310374517,"modifiedOn":1578310374517,"id":"prices-value","version":1,"type":"AVRO","globalId":8}
-
For more REST API sample requests, see the Apicurio Registry REST API documentation.
-
For a demonstration based on Kafka Streams storage, see https://github.com/Apicurio/apicurio-registry-demo.
-
For more details on Kafka Streams, see the Apache Kafka Streams documentation.