Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Dependencies

Tom Janssens edited this page Jan 14, 2015 · 5 revisions

Ruby Gems

Initially, the installation of Capistrano is easy, just execute these commands:

sudo gem install capistrano sudo gem install newrelic_rpm

The first line will install Capistrano, the second command installs New Relic support.

Phpmig

Locally

Note: if you are using the Vagrant box - which you definitely should - Phpmig will be configured for use already. If not, SSH into the Vagrant box and run "police reinstall" - this should run the composer install and create the Phpmig config file.

To do this manually:

Once Composer is installed on your system, go to the scripts/phpmig directory and install:

cd /path/to/police/repository/scripts/phpmig
composer install

You can now execute Phpmig using bin/phpmig. To test your installation, type:

bin/phpmig --version

Now copy the config.php-example file to config.php inside the phpmig directory and edit it.

To verify if your config file is now working, execute the following command:

bin/phpmig status

You should get output that resembles the following: (example)

Status  Migration ID    Migration Name 
-----------------------------------------
    up  20120511153757  IntegrateActivities
    up  20120527220812  AddProductModules
    up  20120614234716  AllowZipAttachments

On the servers

On the server, we've still installed Phpmig into the global path. (eg. use phpmig instead of bin/phpmig). Otherwise we have to run composer again on every deploy, which is a bit redundant and painfully slow because of the SS proxy. The composer approach is mostly there to get going quickly on your local environment.

To install on the server :

cd /usr/share/
mkdir phpmig && cd phpmig

Now create the composer.json file with the following contents:

{
  "require": {
    "php": ">=5.3.1",
    "davedevelopment/phpmig": "*",
    "pimple/pimple": "*"
  },
  "config": {
    "bin-dir": "bin/"
  }
}

If composer is not installed, you can do this using the following commands:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Now install using the following commands:

composer install
ln -s /usr/share/phpmig/vendor/davedevelopment/phpmig/src/Phpmig/ /usr/share/php/Phpmig # Copy source into PHP's include_path
ln -s /usr/share/phpmig/bin/phpmig /usr/bin/phpmig # Install executable into the global system path
phpmig help # Test

The configuration file (which loads the environment variables) can be found at /scripts/phpmig/config.php. This file is symlinked back into the phpmig directory on each deploy.

For more information and alternative installation methods visit the official getting started guide.

Elasticsearch

Follow these steps to install Elasticsearch 1.2 with Java 1.7 on our CentOS 5.9 servers:

Install Java 1.7

cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-i586.tar.gz"
tar -xzf jdk-7u60-linux-i586.tar.gz
rm jdk-7u60-linux-i586.tar.gz
/usr/sbin/alternatives --install /usr/bin/java java /opt/jdk1.7.0_60/bin/java 2
/usr/sbin/alternatives --config java

Test with** java -version**. All that's left to do is setup the environment variables in /etc/profile.d/police.sh :

export JAVA_HOME=/opt/jdk1.7.0_60
export JRE_HOME=/opt/jdk1.7.0_60/jre
export PATH=$PATH:/opt/jdk1.7.0_60/bin:/opt/jdk1.7.0_60/jre/bin

Install Elasticsearch 1.2

cd /opt/
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.2.1.tar.gz
tar -xzf elasticsearch-1.2.1.tar.gz
rm elasticsearch-1.2.1.tar.gz
mv elasticsearch-1.2.1 elasticsearch

Now install ES as a service:

cd /tmp/ 
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
mv elasticsearch-elasticsearch-servicewrapper-4943d5a/service /opt/elasticsearch/bin/
rm -rf /tmp/elasticsearch-elasticsearch-servicewrapper-4943d5a/
/opt/elasticsearch/bin/service/elasticsearch install
/sbin/chkconfig elasticsearch on
/sbin/chkconfig --list | grep elasticsearch # Check if it's registered to start on boot

Make the following changes in /opt/elasticsearch/config/elasticsearch.yml:

cluster.name: elasticsearch-production or elasticsearch-staging
node.name: "police-001"
path.logs: /var/log/elasticsearch/
path.data: /var/data/elasticsearch

Start ES and check if it's running :

/sbin/service elasticsearch restart
tail -f /var/log/elasticsearch/elasticsearch.log # See if the log is receiving input
http_proxy='' curl 'http://127.0.0.1:9200/?pretty' -i # Check if the service is running and ready.
Now apply the *.mapping files in the *<repo>/install/custom/elasticsearch/* folder to set everything up and start indexing!

Useful links:

Clone this wiki locally