Environment Setup

Environment Setup


This guide will show you how to create a script to export all environment variables used for the remainder of our tutorials. Once created, this script can be used as a starting point for your production deployment process.

Background

Environment variables are inherited from any process started by that environment. It is a good idea to create a script to set environment variables as part of a programs initiation. In this case, environment variables are a good place to store configuration values required to connect to an Eventador deployment. Each language has its own syntax for accessing environment variables. We will cover this in our language specific tutorials.

Environment Variables

You can set an environment variable in bash using command export VARNAME="SOME VALUE". To check current value of an environment variable use echo $VARNAME

Basic setup

Below is the minimum setup required to connect to your Eventador deployment.

Environment Variable Description
EVENTADOR_PLAINTEXT_ENDPOINT Single (or list) of plain text endpoints from your deployment’s connections tab
EVENTADOR_KAFKA_TOPIC Kafka topic

First, you will need your plain text endpoint from the UI. To get your endpoint, navigate to the console tab and click your Apache Kafka deployment.

Now switch to the connection tab to find your deployments endpoints.

  • Copy value in EVENTADOR_PLAINTEXT_ENDPOINT box. You can set this from the command line prior to running your application but we recommend you create a shell script so you have a repeatable process which can accompany your application code. We have created a template bootstrap_tutorials_environment.sh script here.
  • Make sure you have set EVENTADOR_KAFKA_TOPIC to the topic you wish to use. We will use demo topic as shown in the getting started guide.

Advanced setup

Additional setup required for more advanced features such as encrypted connections and easier monitoring/debugging.

Environment Variable Description
EVENTADOR_KAFKA_CA_CERT Generate & copy from your deployment’s security tab
EVENTADOR_KAFKA_CLIENT_CERT Generate & copy from your deployment’s security tab
EVENTADOR_KAFKA_CLIENT_KEY Generate & copy from your deployment’s security tab
EVENTADOR_SSL_ENDPOINT Single (or list) of SSL endpoints from your deployment’s connections tab
EVENTADOR_KAFKA_USE_SSL Boolean to toggle use of SSL
EVENTADOR_KAFKA_CONSUMER_GROUP Identify a consumer group for splitting messages between multiple consumers
EVENTADOR_KAFKA_CLIENT_ID Identify a client with user generated unique ID, helpful for debugging clients
EVENTADOR_ZOOKEEPER_ENSEMBLE Pull the list of zookeepers from your deployment’s connections tab

SSL Configuration

Required if you plan to send / receive encrypted messages.

On the right side of the deployments deployments page click the security button.

Enter a common name and click generate to create a pair of key/certificates.

Do not leave this screen until you copy your keys as shown below below.

  • The values generated should be copied to EVENTADOR_KAFKA_CA_CERT, EVENTADOR_KAFKA_CLIENT_CERT and EVENTADOR_KAFKA_CLIENT_KEY. Copy full text in each box to their respective environment variable in the bootstrap_tutorial_environment.sh file. Be sure to include header/footer rows containing -----.
  • EVENTADOR_SSL_ENDPOINT you will find this value just below the plain text endpoint.

Additional Configuration

Finally, the last few are optional but can be helpful as you move past basic examples.

  • EVENTADOR_KAFKA_CONSUMER_GROUP identifies which consumer group is associated with your processes consumer.
  • EVENTADOR_KAFKA_CLIENT_ID can be useful when debugging. It is a user defined string sent with each request. It should be used to identify the application / process making the request.
  • EVENTADOR_ZOOKEEPER_ENSEMBLE older drivers used Zookeeper endpoint to find brokers. Rarely needed as updated drivers utilize the broker discovery protocol.

Using the setup

By now, you should have a bootstrap_tutorial_environment.sh script populated with your desired setup.

Navigate to the directory with your script and run . ./bootstrap_tutorial_environment.sh. You can check values were properly from command line with env | grep EVENTADOR

Next step

Congratulations! You now have a script which will set the environment variables used throughout our tutorials.

Questions, feedback or find any of these steps unclear? Please contact us. We love helping people get started.

Leave a Reply

Your email address will not be published. Required fields are marked *