Giter Site home page Giter Site logo

yonder's Introduction

Yonder

Do you see yonder cloud that's almost in shape of a camel? ~ Hamlet

This repository contains code from my experiment in migrating a traditional client-server application to a vendor neutral cloud application. My goal was to take an simple SpringBoot service, write the required glue code and deploy it over yonder cloud. Then, to automate the process (where Terraform helped) and then, to repeat for each major cloud vendor.

Application

Here is the application in spirit

And here it is in flesh

To give it a character, I made the API fetch Nobel Laureates.

Usage

When it works, it looks something like the following:

> curl -H x-api-key:<gibberish> https://<endpoint>/nobel/1979/peace
[ {
  "id" : "540",
  "firstname" : "Mother Teresa",
  "surname" : null,
  "born" : "1910-08-26",
  "died" : "1997-09-05",
  "bornCountry" : "Ottoman Empire (now Republic of Macedonia)",
  "bornCity" : "Uskup (now Skopje)",
  "diedCountry" : "India",
  "diedCity" : "Calcutta",
  "gender" : "female",
  "prizes" : [ {
    "year" : 1979,
    "category" : "peace",
    "share" : "1",
    "motivation" : null
  } ]
} ]

Of course, it works for other categories and years too, as long as the category is one of: literature, physics, chemistry, economics, chemistry, peace or medicine and the year between 1901 and 2017.

AWS

Here is the AWS plan.

I used an AWS Free Tier account for this and it costed me nothing.

That, however, is NO GUARANTEE on how much it could cost you. You've been warned.

Prepare

# Store your credentials
> cat ~/.aws/credentials 
[default]
aws_access_key_id=<your-key-id>
aws_secret_access_key=<your-key>

# Generate an SSH key-pair
> ssh-keygen

# Do this once
> make init

Deploy

Use make deploy. Terraform will prompt you to type yes to confirm your intentions.

> make deploy

... <lots of output>

Plan: 16 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

... <logs of output>

Apply complete! Resources: 16 added, 0 changed, 0 destroyed.

Outputs:

Invoke the API = curl -H x-api-key:<gibberish> https://<gibberish>.execute-api.us-east-1.amazonaws.com/nobel
Login to Backend Service = ssh -i ~/.ssh/id_rsa ubuntu@<some-ip>
Login to Infrastructure Host = ssh -i ~/.ssh/id_rsa ubuntu@<some-other-ip>

Undeploy

To undo everything, use make undeploy. Terraform will again prompt you to type yes

> make undeploy

... <lots of output>

Plan: 0 to add, 0 to change, 16 to destroy.

Do you really want to destroy?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes
  
... <lots of output>


Destroy complete! Resources: 16 destroyed.

And then, you can do it all over again.

yonder's People

Contributors

aldrin avatar

Watchers

 avatar James Cloos 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.