Giter Site home page Giter Site logo

sensorstatusgcp's Introduction

This repo builds following architecture on GCP for identifying failed industrial sensors in real time.

This is described in this blog

Architecture

Deploy

  • Create YCQL and YSQL tables in Yugabyte cloud instance. Create table script are in resources/createyb.txt Create your yugabye cloud accoiunt here

  • Create DB Secrets in GCP secret Manager. Since credentials are same for YCQL and YSQL, code use same for both connections

gcloud secrets create cql_user --replication-policy="automatic"
gcloud secrets create cql_password --replication-policy="automatic"
gcloud secrets create cql_host --replication-policy="automatic"
gcloud secrets create cql_ca_cert --replication-policy="automatic"

echo -n "<YB Username>" | gcloud secrets versions add cql_user --data-file=-
echo -n "<YB Password>" | gcloud secrets versions add cql_password --data-file=-
echo -n "<YB Host>" | gcloud secrets versions add cql_host --data-file=-
echo -n $(cat /home/kamal/root.crt) | gcloud secrets versions add cql_ca_cert --data-file=-

  • Create a pubsub topic (any name will do) and subscription name sourcesub. If you decide to change the subscription name then provide that as commandline parameter
--input_sub <subscription name>
  • Submit the job to dataflow (Add input_sub param if required)
python process.py \
    --region europe-west3 \
    --runner DataflowRunner \
    --project <your project id> \
    --temp_location gs://beam-storage-eu-west/tmp/ \
    --save_main_session True \
    --requirements_file requirements.txt
  • Dataflow job takes about 10-15mins to actually startup with default compute nodes.

  • Now start your generator based on cconfig file provided in resources folder. Do remeber to set you project and topic name in .env file.

    • The config required by this is in "resources/config.yaml". Copy this file to generators "schema" directory as "config.yaml" Then start the generator using below command
npm start -- -i 5000

Note

psycopg2 postgresql library does not work straight away with dataflow, as it need OS level packages to be installed as a dependency. This will need custom image to work with, hence pg8000 was used which is native python.

sensorstatusgcp's People

Watchers

James Cloos avatar Kamal avatar

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.