Giter VIP home page Giter VIP logo

eventlogger's Introduction

eventlogger

GitHub Actions status Dockerhub build status

Introduction

A sample API that allows submitting and retrieving data; as well as logging event times. The /event endpoint supports POST requests; while /events can be used to retrieve all submitted events associated to a particular api key. (further details on testing can be found at the bottom of this document under Testing)

Note: The instructions assume an OSX machine with brew installed.

Getting Started

Clone repo & install pre-req tools:

From an OSX machine's Terminal; launch the following commands:

  git clone https://github.com/helhindi/eventlogger.git &&cd eventlogger

Install brew:

  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install tools:

Install ['aws-cli', 'terraform', 'skaffold'] by running:

  brew bundle --verbose

Initialise aws-cli:

Assuming you've installed aws-cli (as shown above); init, authenticate and set compute zone interactively via:

  aws-cli init

Create a GCS bucket for TF state and initialise it:

  gsutil mb -l [REGION] gs://[BUCKET_NAME]
  terraform init -backend-config=bucket=[BUCKET_NAME] -backend-config=project=[GOOGLE_PROJECT]

Initialise Terraform GCP vars:

  export TF_VAR_project="$(gcloud config list --format 'value(core.project)')"
  export TF_VAR_region="europe-west2"

Note: Verify the vars by running:

  echo TF_VAR_region=$TF_VAR_region&&echo TF_VAR_project=$TF_VAR_project

Also, enter your gcp_project_id and gcp_location in the /terraform.tfvars file.

Now specify an administrative account user=admin and set a random password:

  export TF_VAR_user="admin"
  export TF_VAR_password="m8XBWryuWEJ238ew"

Initialise and create:

  terraform init
  terraform plan

Once happy with the above plan output; apply using:

  terraform apply

Once the infrastructure is deployed; authenticate and connect to your cluster via kubectl and deploy your code using:

  skaffold run (or 'skaffold dev' if you want to see code changes deployed immediately)

Testing:

Now to test the flask web service; run:

  curl localhost:8080/test

To test the postgres db; run:

  curl localhost:8080/test_db

eventlogger's People

Contributors

helhindi avatar

Watchers

 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.