| Info |
|---|
This page is dedicated to users who want to install Open-Source Scalr on their own instances. To evaluate Scalr, we fully recommend trying Hosted Scalr which doesn't require any up-front installation. |
| Table of Contents |
|---|
System Requirements
Disclaimer
It is extremely difficult (read: costly) to move from self-hosted to hosted Scalr, because of the continuously changing codebase. If you are considering self-hosting Scalr, be aware that you will in all likelihood not be able to move to hosted Scalr should you later prefer not having to manage updates and upgrades.
Minimum Server requirements
To self host Scalr, you will need servers of the following minimum specs:
1x m1.large for mysql
1x m1.large for app
1x c1.medium for cron jobs
In later versions planned for Q2 2012, you will need an extra:
- 1x m1.large for redis
- 1x m1.small for rabbitmq
Packages
Package names and installation methods vary.
Open-Source Scalr requires a web server capable of
URL rewriting (like mod_rewrite)
Running on a POSIX-compatible (Linux, BSD) OS
PHP 5.3.5 or higher 5.3.X branch.
MySQL 5.1.X
You may need to install dependencies as well, such as
- libssh2
- OpenSSL
- net-snmp-utils
- bind9
Required PHP configuration options
- safe_mode must be set to Off
- register_globals must be Off
Required PHP extensions
- mysqli
- cURL
- Sockets (--enable-sockets) with SSL support (--with-openssl)
- GetText
- SimpleXML
- mcrypt
- mhash
- pcntl
- posix
- ssh2
- DOM
- SOAP
- SNMP
- pecl_http
- rrd
Also, rrdtool package as well as librrd should be of version 1.3.x. You can download specific version here: http://oss.oetiker.ch/rrdtool/pub/?M=D
Also, apache mod_rewrite is required. Make sure that "AllowOverride All" is set for the scalr virtualhost.
Installation
Download the most recent code release from http://scalr.net/pricing/open-source/.Unzip this archive.
Copy the contents of the app/ folder to your webserver. Only the app/www folder must be readable by the webserver; all other folders must be underneath the web root. Scalr WILL NOT work from a subfolder of the document root (i.e. domain.com/something). Please create a subdomain and point its document root to the Scalr app/www folder. In the notes that follow, /scalr_home_dir/ refers to the app/ folder location on the webserver.
Set AllowOverride (Apache) or other directives as appropriate for the Scalr domain to implement the rewrite rules found in /scalr_home_dir/etc/.htaccess. If you are using webserver software other than Apache (say lighttpd) you will need to convert the .htaccess rules into a form suitable for your server.
Set permissions
The following folders (and subfolders) and files must be writable by the webserver. Change ownership to the webserver user and set permissions to 700, or else (less secure) set permissions to 777 (world-writable):- cache
Create and configure database
- Create new MySQL database and database user for Scalr.
- Import database from sql/scalr.sql file.
- Edit database connection details in /scalr_home_dir/etc/config.ini file on the webserver.
Set cron jobs
For system to work properly, it needs to run a few tasks periodicaly. Scalr has a single cron/cron.php file that must be executed with various command-line switches. The following tasks must be scheduled:
| Code Block | ||||
|---|---|---|---|---|
| ||||
*/2 * * * * /usr/bin/php -q /scalr_home_dir/cron-ng/cron.php --Poller * * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --Scheduler2 */10 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --MySQLMaintenance * * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --DNSManagerPoll 17 5 * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --RotateLogs */2 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --EBSManager */20 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --RolesQueue */5 * * * * /usr/bin/php -q /scalr_home_dir/cron-ng/cron.php --DbMsrMaintenance */2 * * * * /usr/bin/php -q /scalr_home_dir/cron-ng/cron.php --Scaling */5 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --DBQueueEvent */2 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --SzrMessaging */4 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --RDSMaintenance */2 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --BundleTasksManager * * * * * /usr/bin/php -q /scalr_home_dir/cron-ng/cron.php --ScalarizrMessaging * * * * * /usr/bin/php -q /scalr_home_dir/cron-ng/cron.php --MessagingQueue */2 * * * * /usr/bin/php -q /scalr_home_dir/cron-ng/cron.php --DeployManager */2 * * * * /usr/bin/php -q /scalr_home_dir/cron/cron.php --UsageStatsPoller |
Load Statistics Configuration
Settings Configuration
First of all you need to edit Settings -> Core settings under admin account. You need to set path to rrdtool binary, path to rrd databases and other settings.
System Requirements (in additional to Scalr requirements)
rrdtool >= 1.3.5 (necessary for pango support)
rrdtool-php
Cron
Additional cron task must be scheduled to collect the statisical data:
| Code Block | ||||
|---|---|---|---|---|
| ||||
* * * * * root /usr/bin/php -q /var/www/scalr/app/cron-ng/cron.php --SNMPStatsPoller |
Configuration
BIND
All file paths are absolute.
named.conf file should be readable and writable by BIND user.
Add include "/var/named/etc/namedb/client_zones/zones.include"; to the named.conf
Create '/var/named/etc/namedb/client_zones' directory for zone files. BIND user should have read/write/exec permissions on this directory as well as for all files within it.
Create a blank file '/var/named/etc/namedb/client_zones/zones.include' for zone definitions.
| Code Block | ||||
|---|---|---|---|---|
| ||||
In /path/to/scalr/etc/security.ini: [ec2] ; You can set the security group name to ; anything you want. Scalr will add it to ; all instances launched. security_group_name = 'scalr.ip-pool' [ip-pool] ; You can add any number and any name to ; the below list. host1 = '3.1.4.1/28' host2 = '5.9.2.6/28' host3 = '5.3.5.8/28' ; This entry is specifically for phpmyadmin pma = '9.7.9.3/32' ; This entry is specifically for statistics stats = '2.3.8.4/32' |
Congratulations! You may now proceed to configuration. Log in as admin / admin, go to Settings->Core settings and edit settings.
Known issues with errors
- Problem: You see OperationalError: database is locked in server log and some usual things like script execution, database bundles don't work
Solution: SSH to this server, and execute:
Code Block theme Midnight language bash $ rm -f /etc/scalr/private.d/db.sqlite $ /etc/init.d/scalarizr restart
- Problem: You see Received RebundleFailed event from server. Reason: EBS volume vol-XXXXXXXX wasn't attached in a reasonable time and you're useing _t1.micro_ server type
- Solution: Reboot this server and try again