Emergence Documentation

Setting up Emergence with Ubuntu 13.10

Install service binaries

These commands will update your system and then install all the packages required for Emergence:

user@hostname ~ $ sudo apt-get update && sudo apt-get upgrade -y

user@hostname ~ $ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python-software-properties python g++ make nodejs npm nodejs-legacy nginx php5-fpm php5-cli php5-apcu php5-mysql php5-gd php5-json php5-curl php5-intl php5-imagick mysql-server mysql-client ruby-compass gettext

Stop and disable default service instances

Emergence will be configuring and launching nginx, mysql, and php5-fpm for us, so we need to get the default instances set up by Ubuntu out of the way:

user@hostname ~ $ sudo service nginx stop && sudo update-rc.d -f nginx disable

user@hostname ~ $ sudo service php5-fpm stop && (echo "manual" | sudo tee /etc/init/php5-fpm.override)

user@hostname ~ $ sudo service mysql stop && (echo "manual" | sudo tee /etc/init/mysql.override)

Configure AppArmor to allow Emergence to manage mysqld

AppArmor must be configured to allow MySQL to use Emergence files instead of the defaults:

user@hostname ~ $ echo -e "/emergence/services/etc/my.cnf r,\n/emergence/services/data/mysql/ r,\n/emergence/services/data/mysql/** rwk,\n/emergence/services/run/mysqld/mysqld.sock w,\n/emergence/services/run/mysqld/mysqld.pid rw," | sudo tee -a /etc/apparmor.d/local/usr.sbin.mysqld

user@hostname ~ $ sudo /etc/init.d/apparmor reload

Increase shared memory limit

Ubuntu comes with a low limit of 32MB for shared memory. Emergence relies heavily on APC caching and needs kernel.shmmax increased to a more flexible amount. We’ll use 128MB:

user@hostname ~ $ echo -e "kernel.shmmax = 268435456\nkernel.shmall = 65536" | sudo tee -a /etc/sysctl.d/60-shmmax.conf

user@hostname ~ $ sudo sysctl -w kernel.shmmax=268435456 kernel.shmall=65536

user@hostname ~ $ echo -e "apcu.shm_size=128M\napc.shm_size=128M" | sudo tee -a /etc/php5/mods-available/apcu.ini

Install Emergence from GitHub

Clone Emergence into your home directory, then use npm to install the package and its dependencies:

user@hostname ~ $ sudo apt-get install -y git

user@hostname ~ $ git clone https://github.com/JarvusInnovations/Emergence ~/Emergence && cd ~/Emergence

user@hostname ~/Emergence $ sudo npm install -g

Start Emergence

npm -g installed the kernel’s startup script to /usr/bin/emergence-kernel. You can now launch it manually, or install the init script:

user@hostname ~ $ sudo wget http://emr.ge/dist/debian/upstart -O /etc/init/emergence-kernel.conf

user@hostname ~ $ sudo start emergence-kernel

Create a site

You can now open your web browser to take control of Emergence and create your first site: If you’re installing to a remote machine, replace with your remote IP or hostname.

When prompted, log in with the username and password admin / admin.

Secure your installation

Once you confirm that you are able to access the control panel, use the htpasswd tool provided in npm to delete the default admin account and create your own. Then restart the Emergence kernel to apply the changes:

user@hostname ~ $ sudo npm install -g htpasswd

user@hostname ~ $ sudo htpasswd -D /emergence/admins.htpasswd admin

user@hostname ~ $ sudo htpasswd -s /emergence/admins.htpasswd myusername

user@hostname ~ $ sudo restart emergence-kernel

(Optional) install Sencha CMD

Enter /usr/local/bin as the install path when prompted by Sencha’s CMD installer:

user@hostname ~ $ sudo apt-get install openjdk-7-jre ruby1.9.3 unzip

user@hostname ~ $ wget http://cdn.sencha.com/cmd/

user@hostname ~ $ unzip SenchaCmd-*-linux-x64.run.zip

user@hostname ~ $ chmod +x SenchaCmd-*-linux-x64.run

user@hostname ~ $ sudo ./SenchaCmd-*-linux-x64.run

user@hostname ~ $ sudo mkdir /usr/local/bin/Sencha/Cmd/repo

user@hostname ~ $ sudo chown www-data:www-data -R /usr/local/bin/Sencha/Cmd/repo