Sign inSign up

wpoke/poke-api

By wpoke

•Updated over 7 years ago

Poke API is a scheduler and an API which have to main goal to trigger agent using Apache Kafka.

Image
0

10K+

wpoke/poke-api repository overview

⁠Poke API

Poke API is a scheduler and an API which have to main goal to trigger agent using Apache Kafka.

⁠Environment variables

NameDescriptionType
SCHEDULER_ENABLEDEnable the scheduler in order to send events in kafkaBoolean
SHARDING_ENABLEDEnable sharding, allows to start multiple instances with scheduling enabledBoolean
SHARDING_NBSHARDSSet the number of shards, must be a power of twoNumber
APP_SECRETApplication secretString
MACAROONS_SECRETMacaroon secretString
JAAS_PATHPath to the .jaas file containing kafka credentialsString
POSTGRESQL_ADDON_URIURI of the PostgreSQL databaseURI
POSTGRESQL_ADDON_PORTPort of the PostgreSQL databaseNumber
POSTGRESQL_ADDON_DBName of the PostgreSQL databaseString
POSTGRESQL_ADDON_USERUser to use with the PostgreSQL databaseString
POSTGRESQL_ADDON_PASSWORDPassword of the user to use with the PostgreSQL databaseString
POSTGRESQL_ADDON_HOSTHost of the PostgreSQL databaseString
WARP_PRODUCERThe UUID of the producerUUID
WARP_SIP_HASH_APPHexadecimal key of the Warp 10 instanceHex
WARP_SIP_HASH_TOKENHexadecimal key of the Warp 10 instanceHex
WARP_AES_TOKENHexadecimal key of the Warp 10 instanceHex
WARP_ENDPOINTURL of the Warp 10 instanceURL
KAFKA_HOSTHost of the kafka instance with optionnaly a portString
KAFKA_HTTPCHECKS_TOPICTopic of the HTTP checksString
KAFKA_HTTPCHECKS_INTERVALInterval to treat message batchingString
KAFKA_SSLCHECKS_TOPICTopic of the SSL checksString
KAFKA_SSLCHECKS_INTERVALInterval to treat message batchingString
KAFKA_DNSCHECKS_TOPICTopic of the DNS checksString
KAFKA_DNSCHECKS_INTERVALInterval to treat message batchingString
KAFKA_ICMPCHECKS_TOPICTopic of the ICMP checksString
KAFKA_ICMPCHECKS_INTERVALInterval to treat message batchingString
KAFKA_ENDPOINTKafka endpointString
KAFKA_WRITER_USERKafka user with writing permissionString
KAFKA_WRITER_PASSWORDPassword of the kafka permissionString
KAFKA_SECURITY_PROTOCOLKafka security protocol which can be PLAINTEXT, SASL_PLAINTEXT, SASL_SSL and SSLString
ZOOKEEPER_SERVERSZookeeper connection string (e.g. 192.168.0.1:2181,192.168.0.2:2181,192.168.0.3:2181)String

⁠Usage

To use the Poke API you should fill the previous environment variables in order to start the application. This means you should have at least as dependencies:

  • An instance of PostgreSQL
  • An instance of Apache Kafka
  • An instance of Warp 10

Once, all dependencies are up and running, you can compile the Poke API using the following command:

sbt stage

Now, you are ready to run it in production using the following command:

./target/universal/stage/bin/poke-api

⁠Sharding

If you want to start multiples instances with the scheduler enabled, you must enable sharding.

Set SHARDING_ENABLED to true and SHARDING_NBSHARDS to a power of two.

The number of shards must be at least as big as the number of instances you want to start.

That being said, changing the number of shards is not trivial; you would have to either stop all scheduler instances or have checks being scheduled at least twice during the change.

It's better to choose a "big enough" number, in case you want to add more instances later.

⁠Development

To contribute to the project you will need the same dependencies that for the usage. Furthermore, the project

To start the incremental compilation type the following commands:

$ sbt

[info] Loading settings from plugins.sbt,scaffold.sbt ...
[info] Loading project definition from poke-api/project
[info] Loading settings from build.sbt ...
[info] Loading project definition from .sbt/1.0/staging/49b31237ef85983ed75d/anorm-pg-entity/project
[info] Loading settings from build.sbt ...
[info] Set current project to poke-api (in build poke-api/)
[info] sbt server started at .sbt/1.0/server/e3a928848655bdf089a9/sock
[poke-api] $ ~compile
...
[success] Total time: 2 s, completed Mar 20, 2018 5:14:47 PM
1. Waiting for source changes... (press enter to interrupt)

So, now you are ready to contribute :smile:.

Tag summary

Content type

Image

Digest

Size

342.2 MB

Last updated

over 7 years ago

docker pull wpoke/poke-api