command
module
Version:
v0.0.0-...-6780e01
Opens a new window with list of versions in this module.
Published: Aug 8, 2020
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
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
Methods
1. Using API GateWay + Lambda function ( Serverless Approach ) - Recommended
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
-
- Install the serverless CLI: npm install -g serverless
-
- cd lamda_function /
-
- Run : sls deploy --verbose
-
- 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
-
- Install docker and docker-compose if not present
-
- Run : docker-compose up -d and your API will start at port 8080
-
- 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
-
- Create GKE cluster
gcloud container clusters create jenkins-cd
--num-nodes 2
--machine-type n1-standard-2
--scopes "https://www.googleapis.com/auth/source.read_write,cloud-platform"
-
- Populate Credentials --> gcloud container clusters get-credentials jenkins-cd
-
- cd k8s/ and run kubectl apply -f *.yml
-
- Get service endpoint using command :kubectl get service and get ip
Hit API using
Optional if Jenkins CI/CD dynamic slaves is require
-
- Install Helm
-
- 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)
-
- 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
-
- Use the Helm CLI to deploy the Jenkins
- ./helm install -n cd stable/jenkins -f jenkins/values.yaml --version 1.2.2 --wait
-
-
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
-
- Create a build job and use JenkinsFile supplied to start ci/cd
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
lamda_function
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.