Git Product home page Git Product logo

consume_process_store's Introduction

This assumes the Kafka operator is installed on your OpenShift cluster. If so, change the contents of kafka-cluster.yaml and kafka-topic.yaml to suit your application. Typically it's advisable to at least put a pre or postfix to the kafka broker and database application names.

Use the OpenShift webui to instantiate a Postgresql ephemeral instance and note your chosen database host name, your database name, database user and password as you'll need them in later steps.

Then get Kafka running via the following (Note: the Kafka user operator should also be used in a live/secure system):

Editing yaml notes:

kafka-cluster.yaml should have its metadata --> name field changed to <YOUR_PREFIX>-cluster kafka-topic.yaml should have its metadata --> name field changed to your desired topic name and metadata --> labels --> strimzi.io/cluster field changed to <YOUR_PREFIX>-cluster

oc create -f kafka-cluster.yaml
oc create -f kafka-topic.yaml

Now you can start an instance of the consume/compute application.

oc new-app openshift/python:latest~https://github.com/eldritchjs/consume_process_store#<YOUR_BRANCH> \
--context-dir=compute \
-e KAFKA_BROKERS=<YOUR_PREFIX>-cluster-kafka-brokers:9092 \
-e KAFKA_TOPIC=<YOUR_KAFKA_TOPIC> \
-e DBHOST=<YOUR_PREFIX>-postgresql \
-e DBNAME=<YOUR_DBNAME> \
-e DBUSERNAME=<YOUR_DBUSERNAME> \
-e DBPASSWORD=<YOUR_DBPASSWORD> \
--name <YOUR_PREFIX>-compute

You can start a basic webapp with commands and results endpoints to send messages onto Kafka and retrieve Postgresql results:

oc new-app openshift/python:latest~https://github.com/eldritchjs/consume_process_store#<YOUR_BRANCH> \
--context-dir=webapp \
-e KAFKA_BROKERS=<YOUR_PREFIX>-cluster-kafka-brokers:9092 \
-e KAFKA_TOPIC=<YOUR_KAFKA_TOPIC> \
-e DBHOST=<YOUR_PREFIX>-postgresql \
-e DBNAME=<YOUR_DBNAME> \
-e DBUSERNAME=<YOUR_DBUSERNAME> \
-e DBPASSWORD=<YOUR_DBPASSWORD> \
--name <YOUR_PREFIX>-webapp

Be sure to expose your webapp as a service so you can access it.

oc expose svc/<YOUR_PREFIX>-webapp

To send some commands over the topic (for testing the Kafka and Postgresql setup only):

oc new-app openshift/python:latest~https://github.com/eldritchjs/consume_process_store \
  --context-dir=command_producer \
  -e KAFKA_BROKERS=<YOUR_PREFIX>-cluster-kafka-brokers:9092 \
  -e KAFKA_TOPIC=<YOUR_KAFKA_TOPIC> \
  --name <YOUR_PREFIX>-command-producer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.