Files
robot-shop/CF
Michele Mancioppi da3cde42f5 Update README.md
2019-09-06 09:49:13 +02:00
..
2019-08-24 06:10:08 +02:00
2019-09-05 15:56:38 +02:00
2019-09-06 09:49:13 +02:00

RobotShop on PCF [WIP]

Requirements

The following tiles up and running in the PCF foundation:

Create an organization and a space

cf create-org stan
cf create-space -o stan robotshop

Ensure routes are available

The following routes must be available for use:

  • web.<domain>
  • ratings.<domain>
  • cart.<domain>
  • catalogue.<domain>
  • shipping.<domain>
  • user.<domain>
  • payment.<domain>
  • dispatch.<domain>

Set up the services

cf target -o stan -s robotshop

cf cs p.mysql db-small mysql
cf cs mongodb-odb replica_set_small mongodb
cf cs p.redis cache-small redis
cf cs p.rabbitmq single-node-3.7 rabbitmq

First app push

RobotShop relies on specific binding names between services and apps, so we first push the apps without creating instances (all instance counts in the manifest are 0).

From the root of the repo:

cf push -f CF/manifest.yml

Bind services

cf bind-service mongo-init mongodb --binding-name catalogue_database
cf bind-service ratings mysql --binding-name ratings_database

cf bind-service catalogue mongodb --binding-name catalog_database

cf bind-service cart redis --binding-name cart_cache

cf bind-service shipping mysql --binding-name shipping_database

cf bind-service user redis --binding-name users_cache
cf bind-service user mongodb --binding-name users_database

cf bind-service payment rabbitmq --binding-name dispatch_queue

cf bind-service dispatch rabbitmq --binding-name dispatch_queue

Init MongoDB

cf run-task mongo-init 'node init-db.js' --name "Init MongoDB"

Init MySQL

This one is not automated yet, as the mysql-init task app chokes on the init.sql. Something that "works" is to bosh ssh on the MySQL and run the database init via commandline (mysql is on the path) using the credentials one finds by doing cf env shipping. First import init.sql and then the following:

CREATE DATABASE ratings
DEFAULT CHARACTER SET 'utf8';

USE ratings;

CREATE TABLE ratings (
    sku varchar(80) NOT NULL,
    avg_rating DECIMAL(3, 2) NOT NULL,
    rating_count INT NOT NULL,
    PRIMARY KEY (sku)
) ENGINE=InnoDB;

The above is the content of the ratings sql init script minus the unnecessary user privs.

Configure EUM

Create a website in Instana. Edit the web/static/eum.html file accordingly, specifically replacing the values of the reportingUrl and key ienums.

Spin up the containers

cf scale -i 1 web
cf scale -i 1 ratings
cf scale -i 1 cart
cf scale -i 1 catalogue
cf scale -i 1 shipping
cf scale -i 1 user
cf scale -i 1 payment
cf scale -i 1 dispatch