simple_service_deloitte

command module
v0.0.0-...-6780e01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2020 License: MIT Imports: 6 Imported by: 0

README

Simple_service_deloitte

Assignment :
  • Build an API that will use a string as input and does a find and replace for certain words and outputs the result. For example: replace Google for Google©.

  • Example input: “We really like the new security features of Google Cloud”.

  • Expected output: “We really like the new security features of Google Cloud©”.

  • The words that need to be replaced are provided below the description of this assignment.

  • List of word that need to be replaced: • Oracle -> Oracle© • Google -> Google© • Microsoft -> Microsoft© • Amazon -> Amazon© • Deloitte -> Deloitte©

Solution : A Go API is created with GET and POST
    1. GET method - Displays welcome message
    1. POST method - Accepts plain text in body and Respond with updated String ( needs api key for authentication )
  •   Example : curl -X POST -H 'x-api-key: xxxxxxxxxxxxxxxx' https://api_url -d 'We really like the new security features of Google Cloud'
    

Methods

2. Deploy using Docker-compose
3. Create Kuberntes Cluster and deploy
Method 1 : Using API GateWay + Lambda function ( Serverless Approach )
This is the preferred approach to deploy simple API
    1. Install the serverless CLI: npm install -g serverless
    1. cd lamda_function /
    1. Run : sls deploy --verbose
    1. You will get api endpoints with api_key protection on POST method
Method 2 : Deploy using Docker-compose
This is the full ops approach to deploy simple api in a docker environemnt using docker-compose
    1. Install docker and docker-compose if not present
    1. Run : docker-compose up -d and your API will start at port 8080
    1. Get machine ip then trigger API using
Method 3 : Create Kuberntes Cluster and deploy
This is the mid ops approach to deploy simple api in a kubernetes cluster
Optional if Jenkins CI/CD dynamic slaves is require
    1. Install Helm
    1. Add yourself as a cluster administrator in the cluster's RBAC so that you can give Jenkins permissions in the cluster:
    • kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value account)
    1. Grant Tiller, the server side of Helm, the cluster-admin role in your cluster:
    • kubectl create serviceaccount tiller --namespace kube-system
    • kubectl create clusterrolebinding tiller-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
    1. Use the Helm CLI to deploy the Jenkins
    • ./helm install -n cd stable/jenkins -f jenkins/values.yaml --version 1.2.2 --wait
    1. Configure the Jenkins service account to be able to deploy to the cluster and connect to jenkins console

      kubectl create clusterrolebinding jenkins-deploy --clusterrole=cluster-admin --serviceaccount=default:cd-jenkins

    1. Create a build job and use JenkinsFile supplied to start ci/cd

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
lamda_function
main command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL