Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

installing

eliranmal edited this page May 12, 2013 · 1 revision

Installing Cloudify Widget

The Cloudify Widget is a server that allows to a Cloudify "recipe player" in other website, and allow visitors to launch a certain recipe with a single click. It uses HPCloud to provision VMs and host the installed recipes everytime a user launches a recipe using the widget. Provisioning of the VMs and the interaction with the cloud APIs is done via the jclouds library.

Supported Platforms

The widget sources supply setup and upgrade scripts that are suitable for CentOs 6.2.

The application should work on other platforms as well (although it has never been tested), however the setup and upgrade scripts should be rewritten for those platforms.

centos_auto_setup_machine.sh

Our setup script will set up the environment required for running and upgrading the source code.

Please note that environment changes are done manually - for example, the environment currently uses nginx as a front server. If we decide to modify this to Apache HTTP server, this change will be done manually. However - nginx configuration files for example, are updated automatically.

The setup script expects the following

  • To be executed from ~
  • 3 files resting in the same folder ** hpcloud.pem - a certificate to use as key when communicating with other machines on the cloud ** prod.conf - the configuration file for production ** sysconfig_play - a file that hold reusable environment variable

Generating hpcloud.pem

The hpcloud.pem is generated by the HP cloud console.

  • Log in to your HP cloud
  • Go to "compute"
  • Go to "Key Pairs"
  • Generate a new key pair
  • Click on "download"
  • rename the file to hpcloud.pem

PEM File

Generating prod.conf

prod.conf uses the syntax decided in Play!Framework 2.0 configuration.

Your prod.conf file should start with extending our cloudify.conf file (currently we require you to extend cloudify-prod.conf, but this might change soon).

include "cloudify-prod.conf"

To see which configuration you should specify, please read our cloudify.conf file which contains placeholders.

To see all the possible configurations, read our class Conf class. Our code uses simple naming conventions where the field name equals the configuration property name or specified in annotations.

Generating sysconfig_play file

The sysconfig_play file will be placed at /etc/sysconfig/play and can is used in our utility scripts such as the setup script, database upgrade scripts and so on.

The common use case is invoking it in a shell script by running the following line

. /etc/sysconfig/play

You can add to this file whatever you want.

Here is how the file should look like with placeholders

WIDGET_HOME=/my/user/home/play-2.0.4/cloudify-widget
DB_USER=<my db user>
DB_PASSWORD=<my db password>
DB_ADMIN=<my db admin username>
DB_ADMIN_PASSWORD=<my db admin password>
DB=<my db name>
COMPANY_DOMAIN=mydomain.com
SITE_DOMAIN=mysubdomain.$COMPANY_DOMAIN
SITE_STAGING_DOMAIN=mystagingdomain$SITE_DOMAIN
MONIT_FROM=noreply@$COMPANY_DOMAIN
MONIT_SET_ALERT=widget@$COMPANY_DOMAIN
CLOUDIFY_SECURITY_GROUP=widgetSecurityGroup
TAKIPI_KEY=<Only if I have one, otherwise provided>

Upgrading

Our upgrade script starts by pulling git modifications and continues by copying configuration files to their right locations (such as nginx configuration files).

The script will detect if configuration changes were made and will restart the services as needed.

We recommend upgrading by using the following commands

. /etc/sysconfig/play
git reset --hard
chmod 775 $WIDGET_HOME/*.sh
$WIDGET_HOME/upgrade_server.sh

Our Environment

By using our setup script you get the following

  1. MySQL Installation
  2. Monit - makes sure the site stays up and running
  3. Takipi - analyzes excpetions
  4. Init.d scripts - enables starting/stopping/restarting and querying status by running service widget start service widget stop service widget restart service widget status
  5. Nginx configuration which shows nice error page on downtime