Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _includes/doc_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@
<li><a href="/microservices-demo/deployment/nomad.html">Nomad</a></li>
</ul>
</li>
<li><span>Apcera</span>
<ul>
<li><a href="/microservices-demo/deployment/apcera.html">Apcera</a></li>
</ul>
</li>
</ul>
90 changes: 90 additions & 0 deletions deployment/apcera.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
layout: default
deployDoc: true
---

## Socks Shop on Apcera

These instructions will help you deploy and run the Socks Shop application on the [Apcera Platform](https://www.apcera.com/platform), an enterprise-grade container management platform for cloud-native and legacy applications. Apcera is secure by default, only permitting things explicitly authorized by policy, and supports multi-cloud deployments.

Apcera has tested Socks Shop on the Apcera Community Edition running single-cloud clusters in Amazon AWS, Google Cloud Platform, Microsoft Azure, and VMware. We have also tested Socks Shop on the Apcera Enterprise Edition running a multi-cloud cluster that spanned across AWS, GCP, and VMware.

### Packaging

The Socks Shop application is packaged and configured for Apcera using a [Multi-Resource Manifest file](https://docs.apcera.com/jobs/multi-resource-manifests/) called socksshop-docker.json which is similar to a Docker Compose file. Scripts are provided to make it easy to deploy all the services and a network from the manifest, to start and stop the services, and to delete everything that was deployed.

### Pre-requisites

- Set up your preferred private or public cloud environment, preferably AWS, Google, Azure, or VMware.
- Install [Apcera Community Edition (CE)](https://docs.apcera.com/setup/apcera-setup/) in your cloud or use the Apcera Enterprise Edition (EE) if you own it.
- Download the Apcera command line tool [APC](https://docs.apcera.com/quickstart/installing-apc/) from the Apcera [Web Console](https://docs.apcera.com/quickstart/using_console/) and install it.

```
git clone https://github.com/microservices-demo/microservices-demo
cd microservices-demo/deploy/apcera
```
- *(Optional)* If you are not an admin user in your Apcera cluster, you might need an Apcera administrator to import a [policy](https://docs.apcera.com/policy/introduction/) file to give you permission to create the Socks Shop services and network in your sandbox.

```
apc import policy socksShop.pol
```

### Networking and Security

In this demo scenario, we create a single [virtual network](https://docs.apcera.com/jobs/virtual-networks/) to which all the services except *zipkin* and *user-sim* are added. Services inside the virtual network can all talk to each other. Apcera [job links](https://docs.apcera.com/jobs/job-links/) are used to let the *user-sim* load testing service send requests to the *front-end* service and to let the main Socks Shop services send traces to the *zipkin* service. Using job links in this fashion simulates how real, cloud-based load testing and APM solutions can be integrated into applications running on Apcera without sacrificing security.

### Deployment

All of the Socks Shop services and the network are deployed to Apcera with a single script. However, you first need to target your cluster and login to it with APC. After that, just run the deploySocksShop.sh script.

<!-- deploy-doc require-env APCERA_CLUSTER APCERA_USER APCERA_PASSWORD -->
<!-- deploy-doc-hidden pre-install
apc target $APCERA_CLUSTER
printf "$APCERA_USER\n$APCERA_PASSWORD\n" | apc login --basic
-->
```
apc target <your_cluster>
apc login
```
<!-- deploy-doc-start create-infrastructure -->

./deploySocksShop.sh

<!-- deploy-doc-end -->

After determining your targeted cluster and default namespace, this script does the following:

- It sets your current namespace to \<your_default_namespace\>/socksshop.
- It runs the "apc manifest deploy" command against the socksshop-docker.json manifest to create the services and the socksshop-network virtual network.
- It creates [job affinity tags](https://docs.apcera.com/jobs/job-affinity/) to make sure that each service that uses a database is deployed to the same Apcera instance manager as the database.
- It then runs the startSocksShop.sh script to start all of the Socks Shop services.

Altogether, the script should take under two minutes to run.

### Using

- You can access the Socks Shop front-end service in a browser with the URL:
- http://front-end.\<your_cluster\>
- Note that the *edge-router* service is not used since Apcera provides its own router.
- You can view logs for the services in the Apcera Web Console or by using the "apc app logs" command.

### Testing

A load testing service, *user-sim*, is provided in the socksshop-docker.json manifest file. It will run when the manifest is deployed after a delay of 60 seconds. This is a load test provided to simulate user traffic to the application. You can view the results of the test in the *user-sim* log.

### Tracing
[Zipkin](http://zipkin.io/) has been written into some of the services. While the system is up you can view the traces at http://zipkin.\<your_cluster\>. Currently *orders* provides the most comprehensive traces.

### Starting and Stopping

You can use the startSocksShop.sh and stopSocksShop.sh scripts to start and stop all the services.

### Cleaning up

Run the deleteSocksShop.sh script to delete the Socks Shop services and network.

<!-- deploy-doc-start destroy-infrastructure -->

./deleteSocksShop.sh

<!-- deploy-doc-end -->