====== Setup Performexa ======
===== Software Versions =====
ruby : 2.2.3
rubygems : 2.4.5
rails : 4.2.4
===== Install Default developer packages =====
Add below mentioned both entrys
127.0.0.1 server url
server url
#This was tested in CentOS 6.5.
yum install epel-release -y
yum update -y
yum groupinstall "Development Tools" -y
yum groupinstall "Additional Development" -y
yum install gcc gcc-c++ make wget libtool libxml libxml-devel libxslt libxslt-devel subversion curl-devel java-1.7.0-openjdk java-1.7.0-openjdk-devel git-core openssl-devel -y
yum install ImageMagick ImageMagick-devel -y
yum install gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel -y
===== Add appuser =====
useradd -m expdev01
vi /etc/sudoers
expdev01 ALL=(ALL) NOPASSWD: ALL ##add this line
su - expdev01
===== Ruby & Rubygems =====
=== Using rbenv ===
a) Install rbenv
# Check out rbenv into ~/.rbenv.
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
# Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility.
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
# Ubuntu Desktop note: Modify your ~/.bashrc instead of ~/.bash_profile.
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# Restart your shell so that PATH changes take effect. (Opening a new terminal tab will usually do it.)
# Now check if rbenv was set up -
type rbenv
#=> "rbenv is a function"
b) Install rbenv-build
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
c) Install ruby 2.2.3
rbenv install 2.2.3
d) Update rubygems to 2.4.5
rbenv global 2.2.3 #make this version of ruby global
rbenv rehash #reload shims
gem -v #check the gem version (Most likely this will be 2.4.5.1)
gem install rubygems-update
update_rubygems
gem update --system '2.4.5'
mkdir -p ~/.rbenv/plugins
git clone git://github.com/dcarley/rbenv-sudo.git ~/.rbenv/plugins/rbenv-sudo
install gem god (0.13.7)
mkdir -p /var/run/god ##with below permission and ownership
drwxr-xr-x 2 expdev01 expdev01 /var/run/god
===== Installing MYSQL 5.6.x =====
yum install wget -y
wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server.x86_64 -y
/etc/init.d/mysqld start
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("GIVE-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
===== Installing NGINX and Phusion Passenger =====
Add Latest Nginx repository
/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
Install Passenger and Nginx
sudo yum install -y nginx
gem install passenger
Edit passenger configuration for Nginx
# for passenger root
passenger-config --root
/etc/nginx/conf.d/passenger.conf
passenger_root /home/expdev01/.rvm/gems/ruby-2.2.2/gems/passenger-5.0.18;
passenger_ruby /home/expdev01/.rvm/rubies/ruby-2.2.2/bin/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;
sudo service nginx restart
Validate passenger and Nginx installation
sudo passenger-config validate-install
copy from existing working machine /deploy folder structure -- find and replace ip and urs according to setup
chown -R expdev01:expdev01 /deploy ##appuser change ownership
===== Installing Ejabberd =====
Download the latest version of Ejabberd from www.process-one.net website, at the time of writing this document 15.07 was the latest.
wget "https://www.process-one.net/downloads/downloads-action.php?file=/ejabberd/15.07/ejabberd-15.07-linux-x86_64-installer.run"
chmod 751 ejabberd-15.07-linux-x86_64-installer.run
./ejabberd-15.07-linux-x86_64-installer.run
Do you accept this license? [y/n]: y
Installation Directory [/opt/ejabberd-15.07]:
ejabberd server domain [devtalent02.exphosted.com]: devtalent01.exphosted.com
Administrator username [admin]:
Administrator password [********] :
Retype password [********] :
Cluster [y/N]: n
Do you want to continue? [Y/n]: y
----------------------------------------------------------------------------
Please wait while Setup installs ejabberd on your computer.
Installing
0% ______________ 50% ______________ 100%
#########################################
----------------------------------------------------------------------------
cd /opt/ejabberd-15.07/bin
cp ejabberd.init /etc/init.d/ejabberd
/etc/init.d/ejabberd start
=== Configure ejabberd ===
1. Change the config settings. Config file can be found in your ejabberd directory under conf (ex - /opt/ejabberd-15.07/conf/ejabberd.yml)
Change "register:" (around line 481)
register:
all: allow
registration_timeout: infinity
Change "registration_timeout:" (around line 494)
registration_timeout: infinity //(yaml file level)
Enable "mod_ping"
mod_ping:
send_pings: true
ping_interval: 250
timeout_action: none
2. Start/Restart ejabberd
3. Create a shared roster for every one.
{{:shared_roster_all.png|Screenshot with information}}
4. Add a host entry for the IP pointing to the URL.
===== Install the gems used by the application =====
The Application uses bundler gem to manage the gem dependencies.
Install the bundler gem first.
sudo gem install bundler
Once the bundler gem is installed, from the application directory (eg: /deploy/crossbow/current), run
bundle install
This would install all the necessary gems required by the application.
bundle install will end with this message:
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
===== Database creation and loading seed data =====
Modify the database.yml file to reflect proper DB settings in development and test section and then run following rake task to create all the databases.
bundle exec rake db:create:all
Once the DBs are created run the migrations to create necessary tables using following command.
bundle exec rake db:migrate
bundle exec rake db:migrate RAILS_ENV=test
Run rake db:seed to create the default company and related data (This is just one time task)
bundle exec rake db:seed
The default company will be created with name 'Performexa' and subdomain as 'default'. No subdomain in url will refer to default company. e.g. http://dev01.performexa.com will take default company as a context. An admin user for the default company will also be created. The username for admin user is 'admin@performexa.com' and password is 'pforperformance'.