Emergence Documentation

Setting up Emergence with Ubuntu 13.04

Install service binaries

These commands will install all the prerequisite service binaries. When prompted for a new MySQL password, set it to whatever you like, or just dismiss the dialog with a blank password; we will not be using or even starting the default instance.

We will be adding the repository recommended by Node’s install guide to get a more recent version of Node.js than is provided by Ubuntu’s official repositories:

user@hostname ~ $ sudo apt-get install software-properties-common

user@hostname ~ $ sudo add-apt-repository ppa:chris-lea/node.js

user@hostname ~ $ sudo apt-get update

user@hostname ~ $ sudo apt-get install python-software-properties python g++ make nodejs nginx php5-fpm php5-cli php-apc php5-mysql php5-gd php5-curl php5-intl php5-imagick mysql-server mysql-client ruby-compass gettext

Remove AppArmor

AppArmor must be removed, as it will try to “protect” MySQL from being controlled by our Emergence installation:

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

user@hostname ~ $ sudo apt-get remove apparmor

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 remove

user@hostname ~ $ sudo service php5-fpm stop && sudo update-rc.d -f php5-fpm remove

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

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 "apc.shm_size=128M" | sudo tee -a /etc/php5/mods-available/apc.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 git

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

user@hostname ~ $ 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