Today my friend and business partner Raphael pointed me to the new release of Scalr. I knew Scalr from the past, but i did not get in detailed touch yet. Scalr released version 1.1.0 under the GPL v2- and now I thought about to give it a detailed try.
Scalr promise alot of value within Cloud Computing and the use of Amazon EC2.
Scalr is a fully redundant, self-curing and self-scaling hosting environment using Amazon’s EC2.
It allows you to create server farms through a web-based interface using prebuilt AMI’s for load balancers (pound, nginx, or Amazon’s load balancing service), app servers (apache, rails, others), databases (mysql master-slave, others), and a generic AMI to build on top of.
The health of the farm is continuously monitored and maintained. When the Load Average on a type of node goes above a configurable threshold a new node is inserted into the farm to spread the load and the cluster is reconfigured. When a node crashes a new machine of that type is inserted into the farm to replace it.
Multiple AMI’s are provided for load balancers, mysql databases, application servers, and a generic base image to customize. Scalr allows you to further customize each image, bundle the image and use that for future nodes that are inserted into the farm. You can make changes to one machine and use that for a specific type of node. New machines of this type will be brought online to meet current levels and the old machines are terminated one by one.
Under http://www.scalr.net is also a pay service available, but i want to build my own environment.
If you want to install Scalr the wiki is a good starting point.
I droped some lines here in my blog to document my installation on a Ubuntu 9.04 Server.
Systemrequirements are definied on the project website as follows:
My server installation was build up with a LAMP. A good How-To for LAMP installation you can find here.
I had to customize my PHP5 installation for the required PHP extension listed in the project wiki. I searched for the plugins with following command
apt-cache search php5-*, and installed the required extensions manually.
Furthermore I created a database for scalr and a valid user for it.
# mysql -u -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)
mysql> CREATE DATABASE ;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON .* TO ""@"localhost" IDENTIFIED BY "";
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
MySQL Server is running in my environment on the same host. Choose a database-name, database-user and a password for database-user.
Now you can check if your environment is set up for Scalr. For that I downloaded a script from the project site to test it.
Move this to your webserver directory e.g.:
mv testenvironment.php /var/www
Point your webserver to
http:///testenvironment.php to check your environment.
I got an error “Cannot find SSH2 functions. Make sure that SSH2 Functions enabled.”
Searching for that error in google pointed to a blog entry.
Installed the following with apt-get.
apt-get install php-pear libssh2-1 libssh2-1-dev
The missing php extension can be installed with this command:
pecl install ssh2 "channel://pecl.php.net/ssh2-0.10"
An error occured
ERROR: `make' failed. I followed the blog entry from Octavian Neacsu, but I did not do all the same he documented.
I edited also the file /tmp/pear/download/ssh2-0.10/ssh2.c and replaced like mentoined the line containing:
#if LIBSSH2_APINO < 200412301450
Changed my directory with
cd /tmp/pear/download/ssh2-0.10/ and compiled manually again with following commands:
Be aware of errors at this point!
Check again if your environment is set up probably with pointing your browser to your webserver
If everything is set up correctly you can download the latest version of Scalr from here.
In my case I did this with
Unzip the downloaded file and move it to your webserver directory.
Like it is mentoined in the wiki, Scalr will not work from the subfolder. For that i changed my Apache webserver environment a little. This is up to you do to this like you want. In my case nothing else run on my webserver, so Scalr was moved to the root directory of Apache.
Next i imported the sql script to the created database with following command
mysql -p < scalr/sql/database.sql
and configured the database connection details in /scalr_home_dir/etc/config.ini file.
Go ahead with the wiki install description and set the permissions 777 on the following folders:
The cron jobs were set up in my environment with the following command:
and pasted this modified to my paths:
* * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --Poller
* * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --Scaling
1 1 * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --RotateLogs
*/15 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --MySQLMaintenance
*/6 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --DNSMaintenance
*/10 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --EBSArraysMaintenance
*/5 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --EBSMaintenance
*/3 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --DNSZoneListUpdate
*/2 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --DBQueueEvent
*/3 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --MessagingQueue
*/11 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --Cleaner
*/2 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --EBSQueue
*/3 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --UsageStatsPoller
Finally I had to set up my AWS cradentials as it is described on the wiki pages of Scalr.
1. Put your EC2 access certificate into /scalr_home_dir/etc/cert-XXXXXXXXXXXX.pem
2. Put your EC2 private key into /scalr_home_dir/etc/pk-XXXXXXXXXXXX.pem
Where XXXXXXXXXXXX is Your Access Key name, which you specify on “Settings->Core settings” page.
Now I was able to point my browser to http://mydomain.com/ and login in with admin and password admin. (Change this settings after login!)
Within the next days I will post Scalr 1.1.0 – getting in touch – Part II on my blog.Scalr 1.1.0 – getting in touch – Part I