Skip to content

bampli/t1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

t1

Using docker-compose

  • Web: Nginx
  • App: Flask
  • DB: MySQL
  • NOSQL: Datastax

Get Started

docker-compose up

Based on best practices for Python projects with Docker Compose, presented at DockerCon-2020.

Graph Traversal

query
@server.route('/ver')
def gtest():

    graph_name = 'trees_prod'
    ep_graphson3 = GraphExecutionProfile(
        row_factory=graph_graphson3_row_factory,
        graph_options=GraphOptions(
            graph_protocol=GraphProtocol.GRAPHSON_3_0,
            graph_name=graph_name))

    cluster = Cluster(contact_points=['172.18.0.4'], execution_profiles={'core': ep_graphson3})

    session = cluster.connect()

    rec = session.execute_graph("g.V().has('Sensor', 'sensor_name', '104115939').
                project('name').
                by('sensor_name').fold()",
            execution_profile='core')

    result = []
    for c in rec:
        result.append(c)

    return flask.jsonify({"response": result})
response
GET /ver
Server response
{"response":[[{"name":"104115939"}]]}

Using Kind & Tilt

Prerequisites:

  • Docker
  • Kind
  • Tilt

Cluster infrastructure with Cassandra

  • Create local registry at localhost:5000
  • Create Cassandra operator v1.3
  • Launch Cassandra
  • Create configMap with secret password
  • Apps apply configMap before running
  • Check Tiltfile

Get started

# cleaning
scripts/prune.sh

# start the fun
scripts/setup.sh
scripts/setup-configMap.sh
scripts/setup-dashBoard.sh

# develop apps
tilt up

Kubernetes Dashboard

Available at: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Authenticate with Token provided by following command:

kubectl -n kubernetes-dashboard describe secret admin-user-token | grep ^token