GithubHelp home page GithubHelp logo

rethinkcli's Introduction

RethinkCLI

CLI tool for RethinkDB

Overview

This tool allows an automated script to ensure that a database / table exists before booting a microservice.

Dependencies

Libraries:

Getting Started with this tool

  1. Clone this repo
  2. Run make

Example Usage

This tool is for use with RethinkDB

$ # Run rethinkdb instance with docker
$ docker run -d -p 28015:28015 -p 8080:8080 rethinkdb

Ensure that a Database exists

$ # check that a database exists and create if it doesn't
$ ./dbtool -host localhost -port 28015 ensure_database random_database && echo "DATABASE IS PRESENT!"

Ensure that a Table exists

If the table doesn't exist then the last element will be the PK of the table.

$ # check that a table exists and if not create it.
$ ./dbtool -host localhost -port 28015 ensure_table random_database.random_table.CUSTOM_PK 

Bootstrapping a Microservice

Assuming an arbitrary python service that runs on port 3000 and requires a table basic_table in the euwest1 database.

Dockerfile

FROM python:3-onbuild

COPY dbtool /usr/bin/dbtool

COPY . /usr/src/app

EXPOSE 3000

CMD ["sh", "start_server.sh"]

start_server.sh

#!/bin/bash

# Ensure that the database exists
dbtool -host localhost -port 28015 ensure_database euwest1

# Ensure that the required table exists
dbtool -host localhost -port 28015 ensure_table euwest1.basic_table

python server.py

rethinkcli's People

Contributors

jasonforte avatar

Stargazers

Herman van Zyl avatar  avatar

Watchers

James Cloos avatar  avatar

rethinkcli's Issues

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.