|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +deployDoc: true |
| 4 | +--- |
| 5 | + |
| 6 | +## Socks Shop on Apcera |
| 7 | + |
| 8 | +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. |
| 9 | + |
| 10 | +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. |
| 11 | + |
| 12 | +### Packaging |
| 13 | + |
| 14 | +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. |
| 15 | + |
| 16 | +### Pre-requisites |
| 17 | + |
| 18 | +- Set up your preferred private or public cloud environment, preferably AWS, Google, Azure, or VMware. |
| 19 | +- 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. |
| 20 | +- 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. |
| 21 | + |
| 22 | +``` |
| 23 | +git clone https://github.com/microservices-demo/microservices-demo |
| 24 | +cd microservices-demo/deploy/apcera |
| 25 | +``` |
| 26 | +- *(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. |
| 27 | + |
| 28 | +``` |
| 29 | +apc import policy socksShop.pol |
| 30 | +``` |
| 31 | + |
| 32 | +### Networking and Security |
| 33 | + |
| 34 | +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. |
| 35 | + |
| 36 | +### Deployment |
| 37 | + |
| 38 | +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. |
| 39 | + |
| 40 | +<!-- deploy-doc require-env APCERA_CLUSTER APCERA_USER APCERA_PASSWORD --> |
| 41 | +<!-- deploy-doc-hidden pre-install |
| 42 | +apc target $APCERA_CLUSTER |
| 43 | +printf "$APCERA_USER\n$APCERA_PASSWORD\n" | apc login --basic |
| 44 | +--> |
| 45 | +``` |
| 46 | +apc target <your_cluster> |
| 47 | +apc login |
| 48 | +``` |
| 49 | +<!-- deploy-doc-start create-infrastructure --> |
| 50 | + |
| 51 | + ./deploySocksShop.sh |
| 52 | + |
| 53 | +<!-- deploy-doc-end --> |
| 54 | + |
| 55 | +After determining your targeted cluster and default namespace, this script does the following: |
| 56 | + |
| 57 | +- It sets your current namespace to \<your_default_namespace\>/socksshop. |
| 58 | +- It runs the "apc manifest deploy" command against the socksshop-docker.json manifest to create the services and the socksshop-network virtual network. |
| 59 | +- 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. |
| 60 | +- It then runs the startSocksShop.sh script to start all of the Socks Shop services. |
| 61 | + |
| 62 | +Altogether, the script should take under two minutes to run. |
| 63 | + |
| 64 | +### Using |
| 65 | + |
| 66 | +- You can access the Socks Shop front-end service in a browser with the URL: |
| 67 | + - http://front-end.\<your_cluster\> |
| 68 | +- Note that the *edge-router* service is not used since Apcera provides its own router. |
| 69 | +- You can view logs for the services in the Apcera Web Console or by using the "apc app logs" command. |
| 70 | + |
| 71 | +### Testing |
| 72 | + |
| 73 | +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. |
| 74 | + |
| 75 | +### Tracing |
| 76 | +[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. |
| 77 | + |
| 78 | +### Starting and Stopping |
| 79 | + |
| 80 | +You can use the startSocksShop.sh and stopSocksShop.sh scripts to start and stop all the services. |
| 81 | + |
| 82 | +### Cleaning up |
| 83 | + |
| 84 | +Run the deleteSocksShop.sh script to delete the Socks Shop services and network. |
| 85 | + |
| 86 | +<!-- deploy-doc-start destroy-infrastructure --> |
| 87 | + |
| 88 | + ./deleteSocksShop.sh |
| 89 | + |
| 90 | +<!-- deploy-doc-end --> |
0 commit comments