-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi tier app #53
base: master
Are you sure you want to change the base?
Multi tier app #53
Changes from 6 commits
310852c
49128d2
6517419
19d3707
9e7b8d1
70de032
464e2a2
35682e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Shipped - Define and enforce application level policies | ||
|
||
Shipped provide us to update multi level policy for each service level with in application. | ||
|
||
## Prerequisite | ||
|
||
1. How to Create Project with Shipped. | ||
2. How to Add services to project with Shipped. | ||
3. How to create env | ||
4. How to deploy project. | ||
|
||
## Application Level Policies | ||
|
||
Application level polices are the rules, that will support enhance your application durablity on running container. It help you to manage memory management, disk read and write managment, task management, network managment and load balancing. | ||
|
||
![](assets/1.PNG) | ||
|
||
To test CiscoShipped Create a sample program in golang, that will leak the memory and we do memory management from shipped ui for the same service, So that our app will up and running without fail. | ||
|
||
### Steps involve | ||
|
||
1. Fork the sample program from Cisco Cloud. | ||
2. Create Project in Shipped. | ||
3. Add Existing project to Shipped. | ||
4. Build Project. | ||
5. Create New Env | ||
6. Deploy the successfull build to env. | ||
7. Finally app will be up and running, Keep running app | ||
8. Change the Env Setting, Add New Policy to app | ||
9. Checkout the effects. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Fork Sample Application from CiscoCloud. | ||
|
||
### Fork aie-burnit from below link | ||
|
||
1) <a href="https://github.com/CiscoCloud/aie-burnit" target="_blank">aie-burnit</a> | ||
|
||
Note : <a href="https://help.github.com/articles/fork-a-repo/#fork-an-example-repository" target="_blank">How to Fork Git Hub?</a>, Ignore if you already did. | ||
|
||
|
||
After Fork done, Repo will be copied from CiscoCloud to your own public repo. | ||
|
||
## Create project & Add Services in Shipped. | ||
|
||
Project Name : "applicationPolicy" | ||
|
||
Under <b>Develop</b> Tab > Go to <b>Add Existing Repository</b> Section > Search for aie-burnit | ||
|
||
App highlighted repo to your project. | ||
|
||
![](assets/2.PNG) | ||
|
||
Project will look like this | ||
|
||
![](assets/3.PNG) | ||
|
||
## Build Project | ||
|
||
Click on Save project that trigger build for the services that we have added. | ||
|
||
Once build Get Complete we will Deploy. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Create Environment | ||
|
||
Click on <b>New Environment</b>, Enter Name of Env "Test" and Save it. | ||
Our <b>test</b> environment has been created. | ||
|
||
![](assets/4.PNG) | ||
|
||
|
||
## Deploy Services | ||
|
||
### Deploy Data Service (Postgres) | ||
|
||
Select Successfull build for aie-burnit service from left hand side and, choose the env, that we had created "test". then click deploy. Your app started running. | ||
|
||
![](assets/5.PNG) | ||
|
||
Click on Env Settings and click on <b>Alerting Thresholds</b> | ||
|
||
![](assets/6.PNG) | ||
|
||
Scroll Down, Click on Add new Policy | ||
|
||
![](assets/7.PNG) | ||
|
||
![](assets/8.PNG) | ||
|
||
![](assets/9.png) | ||
|
||
Click add policy, You policy get added to the service. | ||
|
||
Policy Explanation : | ||
|
||
![](assets/10.PNG) | ||
|
||
We have defined rule, which signifies that if Memory Use is greater then 75% then Scale Up the container from 1 to 2, and again, if again memory use is greater than 75% with in 2 container it will Scale up by 1 from 2 to 3 container. As we defined 3 as maximum limit so from here it will not scale up. | ||
|
||
Lets create another policy with different condition. | ||
|
||
Policy Explanation : | ||
|
||
![](assets/11.PNG) | ||
|
||
We are trying to set alaram on memory use, If Mem Use is Greater then 75% then trigger the alaram. | ||
|
||
We can scale the percentage by moving green dot with in the spider web as show in below . | ||
|
||
We have two set of dots, Inner green dots (highlighted) to set the minimum threshold. and Outer green dots (highlighted) to set the maximum threshold value. | ||
|
||
As we move dots you can see that policy that we have added, value will auto update. | ||
|
||
So let save it and go back to environment. | ||
|
||
![](assets/12.PNG). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## aie-burnit Usage | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we should add snapshot of deploy page with link to open aie-burnit app. |
||
We have deployed app up and running on test env. | ||
|
||
![](assets/13.PNG) | ||
|
||
We can specify the no of MB's by which we can start memory leak in app to see how policy response to our app. | ||
|
||
So we are adding 2 and click on update button, once done we will click on resume (it resume app with memory leak.) | ||
|
||
![](assets/14.PNG) | ||
|
||
As we can see memory leak has been increasing. As Memory leak reached 75% of policy, we will get alert, in shipped ui. | ||
|
||
We can see alert under Run page > | ||
|
||
![](assets/15.PNG) | ||
|
||
After reach to threshold we have stopped memory leak and capture the below output. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we we need to highlight |
||
|
||
![](assets/16.PNG) | ||
|
||
|
||
Below are the related metrics graphs | ||
|
||
![](assets/17.PNG) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Shipped - Multi-tier Application | ||
|
||
Shipped enables you to build a multi-tier application to allow any application developed and distributed among more than one tier. The multi-tier app logically separates the different application-specific tier. This division allows each tier to be separately developed, tested, executed, and reused. | ||
|
||
Shipped provides a sample multi-tier app containing two services: vote-api and vote-ui. | ||
|
||
<table> | ||
<thead> | ||
<th> | ||
Service Name | ||
</th> | ||
<th> | ||
Technology | ||
</th> | ||
<th> | ||
Details | ||
</th> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<a href="https://github.com/CiscoCloud/vote-api" target="_blank">vote-api</a> | ||
</td> | ||
<td> | ||
golang | ||
</td> | ||
<td> | ||
$host_api_url/data<br/> | ||
/GET <br/> | ||
/POST | ||
Request Body {"count" : "1"}<br/> | ||
<a href="https://github.com/CiscoCloud/vote-api" target="_blank">more detail</a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> <a href="https://github.com/CiscoCloud/vote-ui" target="_blank">vote-ui</a></td> | ||
<td>express js</td> | ||
<td>Consume the above rest api into ui application. for <a href="https://github.com/CiscoCloud/vote-ui" target="_blank">more detail</a></td> | ||
</tr> | ||
<tr> | ||
<td>vote-db</td> | ||
<td>postgres</td> | ||
<td>Creating DB from datastore in shipped.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
||
## Prerequisite | ||
|
||
Fork <a href="https://github.com/CiscoCloud/vote-api" target="_blank">vote-api</a> and <a href="https://github.com/CiscoCloud/vote-ui" target="_blank">vote-ui</a> from Cisco Cloud. When done, contents are copied from Cisco Cloud to your public repo. | ||
|
||
Click <a href="https://help.github.com/articles/fork-a-repo/#fork-an-example-repository" target="_blank">here</a> to learn how to fork GitHub. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Create a Project and Add Services | ||
|
||
|
||
1. Log in to <a href="https://ciscoshipped.io">Shipped UI</a>. | ||
2. Click **Create New Application**. | ||
3. Enter your new project name, for example, multitierapp, click **Start Composing**. | ||
4. Click **Add an existing repository**, and search for vote-api and vote-ui. | ||
|
||
![](posts/files/shipped-multi-tier/assets/1.png) | ||
|
||
6. Click **Datastores** and select **Postgres**. | ||
7. Click **Add Service**. | ||
|
||
![](posts/files/shipped-multi-tier/assets/2.png) | ||
|
||
1. Click **Save Project** to trigger a build for all the services added. | ||
|
||
|
||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
## Create an Environment for Deployment | ||
|
||
|
||
1. Click <b>New Environment</b>. | ||
1. Enter the name for the environment, Test for example. | ||
1. Click **Save**. | ||
|
||
![](posts/files/shipped-multi-tier/assets/4.png) | ||
|
||
You are now ready to deploy *Postgres*, *vote-api*, and *vote-ui* services. The order of service deployment is important. Because Postgres has a set of default environment variables that other two services depend on, therefore it is the first to be deployed. After Postgres is deployed, you can copy those variables and apply them to vote-api and vote-ui. | ||
|
||
### Deploy Postgres | ||
|
||
|
||
1. Click the **Deployment** tab. | ||
|
||
![](posts/files/shipped-multi-tier/assets/deploy-postgres.png) | ||
|
||
1. Select **Postgres** and the environment (Test), click **Deploy Build**. | ||
|
||
1. Copy the environment variables of Postgress, which you need to set for vote-api and vote-ui. | ||
|
||
2. Click **Settings**. | ||
3. Scroll down to the **Deployment Configurations** section. | ||
4. Copy the environment variables. | ||
|
||
![](posts/files/shipped-multi-tier/assets/postgres-settings.png) | ||
|
||
|
||
### Deploy vote-api | ||
|
||
1. Click **Back to Environments**. | ||
|
||
![](posts/files/shipped-multi-tier/assets/vote-api.png) | ||
|
||
1. Click the vote-api icon, then **Settings**. | ||
|
||
3. Scroll down to the **Deployment Configurations** section. | ||
4. Click **Add New variable**, and enter the key value pair. | ||
|
||
In addition to the variables copied from Postgres, you also need to set the API endpoint so the UI application will read the same variables. | ||
|
||
**Note**: Do not change the key value. | ||
|
||
The following example shows the vote-api variables. | ||
|
||
![](posts/files/shipped-multi-tier/assets/vote-api-cfg.png) | ||
|
||
|
||
<table><tr> | ||
<td>Key</td> | ||
<td>Value</td> | ||
</tr> | ||
<tr> | ||
<td>SEED_PORT</td> | ||
<td>4001</td> | ||
</tr> | ||
<tr> | ||
<td>HOST_VOTE_API</td> | ||
<td>http://test--multitierapp--vote-api--254b61.gce.shipped-cisco.com</td> | ||
</tr> | ||
<tr> | ||
<td>HOST_VOTE_UI</td> | ||
<td>http://test--multitierapp--vote-ui--247fa6.gce.shipped-cisco.com</td> | ||
</tr> | ||
<tr> | ||
<td>SEED_HOST</td> | ||
<td>test--multitierapp--postgres--d1329f-0.service.consul</td> | ||
</tr> | ||
<tr> | ||
<td>HOST_POSTGRES</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We just need to copy single environment variable. HOST_POSTGRES Once Dinesh fix is pushed, avoid asking user to copy SEED_HOST, PORT etc. |
||
<td>http://test--multitierapp--postgres--d1329f.gce.shipped-cisco.com</td> | ||
</tr> | ||
</table> | ||
|
||
1. Click **Save**. | ||
|
||
1. Click **Back to Environments**. | ||
2. Click **Deploy Build**. | ||
|
||
|
||
### Deploy vote-ui | ||
|
||
**Note**: Do not deploy vote-ui until vote-api is first deployed. | ||
|
||
1. Click the vote-ui icon, then click **Deploy Build**. | ||
|
||
![](posts/files/shipped-multi-tier/assets/vote-ui-deploy.png) | ||
|
||
1. Click the green button when the build is done. | ||
|
||
![](posts/files/shipped-multi-tier/assets/vote-ui-deploy-sucess.png) | ||
|
||
The following screen is displayed. | ||
|
||
![](posts/files/shipped-multi-tier/assets/15.png) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div> | ||
|
||
<h3>Software Requirements</h3> | ||
<ul> | ||
<li>To work on this lab on your own machine, you must be compatible with <a href="https://www.vagrantup.com/">Vagrant</a>, and <a href=https://www.virtualbox.org/wiki/End-user_documentation">Virtual Box</a>.</li> | ||
<li>Shipped supports Mac OS X, Windows 7 or higher, and Ubuntu 13.04 or higher. </li> | ||
|
||
<li>Shipped supports any modern browser, but Chrome gives the best experience.</li> | ||
</ul> | ||
|
||
|
||
<h3>Hardware Requirements</h3> | ||
<ul> | ||
<li>Total Memory: Minimum 4 GB, but 8 GB is better.</li> | ||
<li>Available Storage: Minimum 20 GB free, but 50 GB of Disk Storage free is better.</a></li> | ||
</ul> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"labId": "shipped-multitier-app", | ||
"title": "Shipped 8 - Deploy Multi-tier App Using shipped", | ||
"byod": true, | ||
"time": "30", | ||
"slug": "Set up quickly in Shipped", | ||
"files": [ | ||
{"title": "1.md"}, | ||
{"title": "2.md"}, | ||
{"title": "3.md"} | ||
], | ||
"tags": [ | ||
{"title": "Shipped"}, | ||
{"title": "Cloud"} | ||
], | ||
"related": [ | ||
{ | ||
"labId": "shipped-first-time", | ||
"title": "Shipped 1 - Using Shipped the First Time" | ||
}, | ||
{ | ||
"labId": "shipped-quick-start", | ||
"title": "Shipped 2 - Quick Start" | ||
}, | ||
{ | ||
"labId": "shipped-import-project", | ||
"title": "Shipped 3 - Shipped import existing project" | ||
}, | ||
{ | ||
"labId": "shipped-bootstrap-spark", | ||
"title": "Shipped 4 - Bootstrap Project" | ||
}, | ||
{ | ||
"labId": "shipped-cli-labs", | ||
"title": "Shipped 5 - Shipped Using CLI" | ||
}, | ||
|
||
{ | ||
"labId": "shipped-cicd", | ||
"title": "Shipped 6 - Shipped Continous Integration and Deployment" | ||
}, | ||
|
||
{ | ||
"labId": "shipped-application-level-policy", | ||
"title": "Shipped 7 - Define and enforce application level policies" | ||
}, | ||
{ | ||
"labId": "shipped-multitier-app", | ||
"title": "Shipped 8 - Deploy Multi-tier App Using shipped" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have snapshot of both 51% and 75%. We should decide values and take snapshot with same value.