Summary
This article provides a sample application profile that can be imported for use in Cisco CloudCenter which installs and configures a scalable OpenCart application, using a nginx loadbalancer and MySQL database.
Product Versions Validated
Product | Version |
Cisco CloudCenter | 4.8.0 |
OpenCart | 1.5.6.4 |
nginix | 1.10.2 |
MySQL | 5.6.27 |
Details
OpenCart is an Apache PHP based application with MySQL database. For this sample deployment of OpenCart we will front end Apache PHP with load balancer based on nginx. The Apache PHP tier will be modeled to be scalable with an initial node count of 2 (and the maximum number of nodes that the user or APIs are permitable to scale up to is configurable as well). The concepts demonstrated by this sample application profile can be used to model any other desired application.
OpenCart is free open source ecommerce platform for online merchants. OpenCart provides a professional and reliable foundation from which to build a successful online store.
In the above diagram, following requirements are being considered:
- Apache php tier is multi-node with initial deployment with two nodes
- MySQL database is modeled as single node
- nginx load balancer is front ending the Apache php tier
Figure - CloudCenter Topology Modeler view of the modeled OpenCart application
Considerations for installing Apache php package:
- Installation scripts in OpenCart package create DB tables and other entries using Opencart.sql file during the install. With single node based Apache php tier it is not an issue. With multi-node tier, the first node works fine but the subsequent nodes hit issue while executing the sql file. Following changes have been made to account for that:
- Modified CREATE TABLE lines to CREATE TABLE IF NOT EXISTS so that it checks for TABLE presence before trying to create a table in DB
- Modified INSERT INTO lines to INSERT IGNORE INTO so that it checks for entries in tables before inserting them
- Added db_prefix ‘oc_’ in the cli_install.php file in install folder
- Install script for OpenCart package refers to Apache php tier IP as a http_server variable when issuing install command. This works fine when you have single node as the variable has single IP in it. With multi-node, the value has comma separated IPs of nodes of the apache php tier. The node IP needs to be derived from tier IPs and node names
Applicable Profile along with OpenCart package contents are available at following github location:
https://github.com/datacenter/c3-community/tree/master/ApplicationProfiles/Opencart/Multi-node
Application Profile - opencart-multinode-app-profile.zip
OpenCart Package - opencart.zip
Openart Install Script - install_opencart_cli.sh
DB Setup Script - createdb.sql
Additional Information
CloudCenter - http://www.cisco.com/go/cloudcenter
CloudCenter Product Documentation - http://docs.cloudcenter.cisco.com
OpenCart - https://www.opencart.com/
nginx - https://nginx.org/en/
MySQL - https://www.mysql.com/
Update History