======Setting up An Application Server Centos 6.5 64bit ====== Create a folder to download and store the necessary software\\ mkdir -p /soft Turn off the firewall from starting up on system restart\\ chkconfig iptables off chkconfig ip6tables off Turn off selinux from interfering with installs, ports\\ sed -i 's/enforcing/disabled/g' /etc/selinux/config Update default system libraries\\ yum update init 6 (reboot System) We will need to install the following as we will be compiling some packages\\ yum install nano lynx wget vim at zip unzip bzip2 -y yum groupinstall "Development Tools" -y yum groupinstall "Additional Development" -y Install EPEL and additional repositories on CentOS \\ yum install epel-release -y Remove postfix \\ yum remove postfix Install sendmail \\ yum install sendmail chkconfig sendmail on How to Install Openssl \\ https://www.linuxhelp.com/how-to-install-and-update-openssl-on-centos-6-centos-7/ remove localtime \\ rm /etc/localtime set Los Angeles time zone\\ ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime apache service dependency \\ yum install pcre pcre-devel -y ===== Add user ===== adduser expprodl ===== Grant sudo power to expprodl ===== * vi /etc/sudoers (Add below mentioned lines) ## Drivers #Cmnd_Alias DRIVERS = /sbin/modprobe Cmnd_Alias APACHE = /opt/apache2/bin/apachectl, /bin/vi /opt/apache2/conf/httpd.conf Cmnd_Alias MYSQL = /sbin/service mysql stop, /sbin/service mysql start, /sbin/service mysql status, /sbin/service mysql restart Cmnd_Alias IPTABLES = /sbin/service iptables stop, /sbin/service iptables start, /sbin/iptables expprodl ALL= NOPASSWD: APACHE, MYSQL, IPTABLES ==== Install Apache ==== cd /tmp wget https://osdn.net/projects/sfnet_mapn/downloads/source/apache/httpd-2.2.21.tar.gz tar xvf httpd-2.2.21.tar.gz ./configure --prefix=/opt/apache2 --enable-mods-shared=most --enable-ssl --enable-usertrack --enable-unique-id --with-included-apr --with-pcre=/usr/bin/pcre-config make make install echo 'export APXS2=/opt/apache2/bin/apxs' >> /etc/profile.d/crossbow.sh logout === Verify === /opt/apache2/bin/apachectl start lynx localhost Expected output: You should see a default page text. === Install Apache modules === cd /tmp download file from dev learnexa box 192.241.161.147:/opt/lnxsoft/soft/apache-upload-progress-module.tar tar xvf apache-upload-progress-module.tar cd apache-upload-progress-module sudo apxs -c -i -a mod_upload_progress.c sudo /opt/apache2/bin/apxs -c -i -a mod_upload_progress.c (corrected) == Verify == ls /opt/apache2/modules/ | grep mod_upload_progress.so Expected output: mod_upload_progress.so Additionally, repeat the verification steps from Apache Installation section above. == Setup Ruby Enterprise Edition [EOL] == wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz && tar xvzf yaml-0.1.5.tar.gz ./configure --prefix=/usr/local make make install yum install GConf2-devel evolution-data-server-devel gnome-desktop-devel gnome-vfs2-devel gstreamer-devel yum install libcroco-devel libgsf-devel librsvg2-devel libsoup-devel yum install gtk-doc libcanberra-devel polkit-devel polkit-docs yum install libxslt-devel yum install libxslt wget http://cache.ruby-lang.org/pub/ruby/1.9/ruby-enterprise-1.8.7-2011.03.tar.gz get "ruby-enterprise-1.8.7-2011.03.tar.gz" from repository. The above mentioned url is not working ( corrected ) tar xvf ruby-enterprise-1.8.7-2011.03.tar.gz ./configure --prefix=/opt/ruby-enterprise-1.8.7-2011.03 ./installer prefix=/opt/ruby-enterprise-1.8.7-2011.03 (corrected) while installing ruby if any error comes, we need to run the patch which is mentioned clearly on the below url https://techglimpse.com/ruby-openssl-install-error-solution/ echo 'pathmunge /opt/ruby-enterprise-1.8.7-2011.03/bin' >> /etc/profile.d/crossbow.sh ln -s /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby /usr/bin/ ln -s /opt/ruby-enterprise-1.8.7-2011.03/bin/god /usr/bin/ ln -s /opt/ruby-enterprise-1.8.7-2011.03/bin/gem /usr/bin/ Verify ruby -v ==Update rubygems== gem update --system 1.8.29 ( not necessary ) cd /tmp (corrected) sftp> get rubygems-1.3.7.tgz ( or you can get it from dev01.learnexa.com "/opt/lnxsoft/soft" ) (corrected) tar zxvf rubygems-1.3.7.tgz (corrected) cd rubygems-1.3.7 (corrected) sudo ruby setup.rb (corrected) ==Install passenger== To install rake **************** gem install rake -v=0.8.7 (corrected) To install rack **************** gem install rack -v "1.6.4" (corrected) gem install passenger -v=4.0.44 (not necessary) gem install passenger -v "3.0.9" ( corrected ) == Integrate Apache and Passenger == export APXS2=/opt/apache2/bin/apxs ( corrected ) export APR_CONFIG=/opt/apache2/bin/apr-1-config ( corrected ) /opt/ruby-enterprise-1.8.7-2011.03/bin//passenger-install-apache2-module You will see a GUI. Keep on pressing next with a space bar and it will install the required module. \\ Make changes to the apache config file. (Config file remains same as the one used for ruby 1.8.7 REE's passenger 3 but the following lines need to be modified. #LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.9.1/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so LoadModule upload_progress_module modules/mod_upload_progress.so PassengerRoot /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.9.1/gems/passenger-4.0.44 PassengerDefaultRuby /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby #RailsFrameworkSpawnerIdleTime 0 PassengerMaxPreloaderIdleTime 0 #RailsAppSpawnerIdleTime 0 PassengerMaxPreloaderIdleTime 0 ### End Passenger tuning## #RailsAutoDetect off == (corrected) == vi /opt/apache2/conf/httpd.conf add the below lines at the end LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so LoadModule upload_progress_module modules/mod_upload_progress.so PassengerRoot /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9 PassengerRuby /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby # # PassengerRoot /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.44 # PassengerDefaultRuby /opt/ruby-1.9.3/bin/ruby # RailsFrameworkSpawnerIdleTime 0 #PassengerMaxPreloaderIdleTime 0 RailsAppSpawnerIdleTime 0 #PassengerMaxPreloaderIdleTime 0 ### End Passenger tuning## #RailsAutoDetect off ==Update the gem versions of the components== If the following gems are already installed, please uinstall them using “gem uninstall ” command and reinstall. gem install bundler -v=1.6.2 gem install rack -v "1.5.2" (not necessary ) gem install passenger -v "3.0.9" ( corrected ) gem install god -v=0.13.3 sudo gem install god -v=0.11.0 ( corrected ) sudo gem install net-ssh -v=2.2.1 ( corrected ) sudo gem install highline -v=1.6.2 ( corrected ) sudo gem install net-sftp -v 2.0.5 ( corrected ) sudo gem install net-scp -v 1.0.4 ( corrected ) sudo gem install net-ssh-gateway -v 1.1.0 ( corrected ) sudo gem install capistrano -v 2.5.21 ( corrected ) gem install capistrano -v=2.15.4 gem install capistrano-ext -v=1.2.1 Verify \\ This will be automatically verified in the next section. ==Setup Apache Conf files== cd /opt/apache2/conf wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/conf/httpd.conf_live wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/conf/httpd.conf_maintenance cp httpd.conf_live httpd.conf Verify \\ IP addresses in the conf file - By Default, Apache listens on All IP addresses. Additionally, repeat the verification steps from Apache Installation section above. Make sure the Rails Env variable is correctly set. ==Update ruby path as needed== * For God - Change ruby path in /deplo/systasks/god.sh and /etc/init.d/god * For Capistrano - Change ruby path in /home/expdev01/crossbow/config/deploy.rb and /home/expdev01/crossbow/runcap.sh ==Install needed gems before hand== Nokogiri yum install libxml2 libxml2-devel bundle config build.nokogiri --use-system-libraries gem install nokogiri -- --use-system-libraries -v='1.6.3.1' RedCloth bundle config build.RedCloth --with-cflags=-w gem install RedCloth -v='4.2.9' ==Database config file change== Change /deploy/crossbow/shared/config/database.yml “adapter” to mysql2 in all the needed stanzas. ==God configuration changes== Change /deploy/crossbow/shared/config/god/generic_monitoring.god to update the bundle paths to /opt/ruby-enterprise-1.8.7-2011.03/bin/bundle from /usr/local/bin/bundle ==Capistrano== Please update the capistrano config files as needed. Refer the link below for more information. [[https://wiki.exphosted.com/doku.php/qastageandproductiondeployment#deployment_steps]] ==Run db:seed== If you are using a fresh database for the current app setup, run the following task in the app directory bundle exec rake db:seed RAILS_ENV= Install JRE \\ yum install jre-7u45-linux-x64.rpm verify \\ java -version Expected output \\ java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) ==== FFMPEG ==== download file from dev learnexa box 192.241.161.147:/opt/lnxsoft/soft/ffmpeg-1.2.4-withmods.tar.gz tar xvzf faac-1.28.tar.gz cd faac-1.28 ./bootstrap cd ../faac-1.28/common/mp4v2/ vi mpeg4ip.h ## remove this line (new declaration ‘char* strcasestr(const char*, const char*) cd ../../ ./configure --enable-shared make make install cd lame-3.99.5 ./configure --enable-shared make make install ldconfig cd libogg-1.3.1 autoreconf --force --install ./configure make make install cd speex-1.2rc1 ./configure make make install yum install libogg-devel cd libtheora-1.1.1 ./configure --enable-shared make make install make check cd libvorbis-1.3.3 ./configure make make install before install libvpx on ffmpeg install nasm ( corrected )\\ wget http://www.nasm.us/pub/nasm/releasebuilds/2.09-original/nasm-2.09.tar.gz ( corrected ) tar -xvzf nasm-2.09.tar.gz ( corrected ) cd nasm-2.09 ( corrected ) ./configure ( corrected ) make ( corrected ) make install ( corrected ) nasm -version ( corrected ) cd libvpx/ ./configure make make install make && make install cd x264/ ./configure --enable-shared --disable-asm make make fprofiled make install #install ffmpeg ./configure --datadir=/usr/share/ffmpeg --extra-cflags=-I/tmp/ffmpeg-1.2.4/include --extra-ldflags=-L/tmp/ffmpeg-1.2.4/lib --bindir=/usr/local/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libtheora --enable-libspeex --enable-libfaac make ( corrected ) make install ( corrected ) create symlink for dependency ffmpeg \\ ln -s /usr/local/lib/libx264.so.140 /usr/lib64/libx264.so.140\\ ln -s /usr/local/lib/libx264.so.146 /usr/lib64/libx264.so.146 ( corrected )\\ ln -s /usr/local/lib/libtheoraenc.so.1 /usr/lib64/libtheoraenc.so.1\\ ln -s /usr/local/lib/libtheoradec.so.1 /usr/lib64/libtheoradec.so.1\\ ln -s /usr/local/lib/libspeex.so.1 /usr/lib64/libspeex.so.1\\ ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib64/libmp3lame.so.0\\ ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib64/libmp3lame.so.0\\ ln -s /usr/local/lib/libfaac.so.0 /usr/lib64/libfaac.so.0\\ ln -s /usr/local/lib/libfaac.so.0 /usr/lib64/libfaac.so.0\\ FFMPEG will be installed at /usr/local/bin. \\ Additionally, the ruby ffmpeg wrapper we use streamio-ffmpeg needs ffmpeg at /usr/bin. \\ ln -nfs /usr/local/bin/ffmpeg /usr/bin/ffmpeg Verify \\ ffmpeg -version Expected output: \\ ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers built on Jan 7 2014 01:23:25 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-54) configuration: --datadir=/usr/share/ffmpeg --extra-cflags=-I/tmp/ffmpeg-1.2.4/include --extra-ldflags=-L/tmp/ffmpeg-1.2.4/lib --bindir=/usr/local/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libtheora --enable-libspeex --enable-libfaac libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg' ==== Install Apache_OpenOffice_4.0.1 ==== tar xvzf Apache_OpenOffice_4.0.1_Linux_x86-64_install-rpm_en-US.tar.gz cd en-US/RPMS yum localinstall *.rpm --nogpgcheck cd /opt/openoffice4/ /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard& Verify \\ netstat -anp | grep 8100 Expected output \\ tcp 0 0 127.0.0.1:8100 0.0.0.0:* LISTEN 15465/soffice.bin ==== Libreoffice 5.4.4 installation steps ==== wget http://download.documentfoundation.org/libreoffice/stable/5.4.4/rpm/x86_64/LibreOffice_5.4.4_Linux_x86-64_rpm.tar.gz ( corrected ) sudo yum remove openoffice* libreoffice* ( corrected ) tar -xvf LibreOffice_5.4.4_Linux_x86-64_rpm.tar.gz ( corrected ) cd /tmp/LibreOffice_5.4.4_Linux_x86-64_rpm/RPMS/ ( corrected ) sudo yum localinstall *.rpm ( corrected ) cd /deploy/systasks ( corrected ) ./god.sh stop ( corrected ) vi /deploy/crossbow/current/config/environments/development.rb ( corrected ) update: OFFICE_HOME = "/opt/libreoffice5.4" ( corrected ) vi /deploy/crossbow/current/config/development.god ( corrected ) update: OFFICE_PATH = "/opt/libreoffice5.4/program" ( corrected ) cd /deploy/crossbow/current/ ( corrected ) touch tmp/restart.txt ( corrected ) cd /deploy/systasks ( corrected ) ./god.sh start ( corrected ) The below link gives the steps to install libre office 5.4.4. But the version 5.4.4 is not available instead 5.4.5 is available. We are tested Libre office 5.4.4 only. The libre office binary is available in "/soft/soft" directory in appserver. so kindly use 5.4.4 only ( corrected ) Libre office link : wget http://download.documentfoundation.org/libreoffice/stable/5.4.4/rpm/x86_64/LibreOffice_5.4.4_Linux_x86-64_rpm.tar.gz ( corrected ) ***************** wiki link : https://wiki.exphosted.com/doku.php/install_libre_office_centos?s[]=libreoffice ( corrected ) *********** Install glusterfs \\ cd /etc/yum.repos.d/ wget http://download.gluster.org/pub/gluster/glusterfs/repos/YUM/glusterfs-3.4/LATEST/CentOS/glusterfs-epel.repo nano glusterfs-epel.repo #The following is not a command. //SET enabled=0 for noarch// yum install glusterfs-fuse if the above link is not working follow the below steps ( corrected )\\ download the gluster.repo file from sftp ( corrected ) yum install glusterfs-fuse ( corrected ) Verify \\ mount.glusterfs Expected output: \\ Usage: mount.glusterfs : -o Options: man 8 mount.glusterfs To display the version number of the mount helper: mount.glusterfs --version ==== PDFTK & pdf2json ==== rpm -Uvh libgcj-4.1.2-55.el5.x86_64.rpm cd /usr/lib64 ln -s libgcj.so.10 libgcj.so.7rh wget ftp://ftp.icm.edu.pl/vol/rzm4/linux-dag/redhat/el6/en/x86_64/dag/RPMS/pdftk-1.44-2.el6.rf.x86_64.rpm yum localinstall pdftk-1.44-2.el6.rf.x86_64.rpm Yum will also install dependency packages: \\ (1/6): java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.x86_64.rpm (2/6): jpackage-utils-1.7.3-1jpp.3.el5.noarch.rpm (3/6): gjdoc-0.7.7-12.el5.x86_64.rpm (4/6): antlr-2.7.6-4jpp.2.x86_64.rpm (5/6): pdftk-1.44-2.el5.rf.x86_64.rpm (6/6): libgcj-4.1.2-54.el5.x86_64.rpm Verify \\ pdftk --version Expected output: \\ pdftk 1.44 a Handy Tool for Manipulating PDF Documents Copyright (C) 2003-10, Sid Steward - Please Visit: www.pdftk.com This is free software; see the source code for copying conditions. There is NO warranty, not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. tar xvf pdf2json-0.61.tar.gz cd pdf2json* && ./configure make make install yum install giflib-devel freetype-devel Verify \\ pdf2json Expected output: \\ pdf2json version 0.61 http://flexpaper.devaldi.com/pdf2json/, based on Xpdf version 3.02 ==swftools== PDF2SWF Dependencies wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/Kris_Shannon:/RHEL_or_CentOS_Extras/CentOS_6/x86_64/swftools-0.9.2-3.1.el6.sis.x86_64.rpm rpm -ivh swftools-0.9.2-3.1.el6.sis.x86_64.rpm Verify pdf2swf -V Expected output: pdf2swf - part of swftools 0.9.2 ==Mupdf== download file from dev learnexa box 192.241.161.147:/opt/lnxsoft/soft/mupdf-1.2-source.zip unzip mupdf-1.2-source.zip cd mupdf-1.2-source make && make install Verify mupdf Expected output: usage: mupdf [options] file.pdf [page] -b - set anti-aliasing quality in bits (0=off, 8=best) -p - password -r - resolution == Install Microsoft Core Fonts == cd /tmp yum install ImageMagick-6.5.4.7-7.el6_5.x86_64.rpm yum install ImageMagick-devel-6.5.4.7-7.el6_5.x86_64.rpm wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/installed-software/msttcorefonts-2.5-1.noarch.rpm rpm -ivh msttcorefonts-2.5-1.noarch.rpm cd /usr/share/fonts/default/ ln -s ../msttcorefonts TrueType ==verify== This package only installs font files. You will not be able to install rmagic gem if this was unsuccesfull. ==svn== yum install subversion -y yum install pcre-devel git mutt gcc gcc-c++ libxml2 libxml2-devel libxslt-devel libxslt mysql-devel make ==rake== yum install pcre-devel imagemagick imagemagick-devel git mutt gcc gcc-c++ libxml2 libxml2-devel libxslt-devel libxslt mysql-devel make gem uninstall rake gem install rake -v 0.8.7 ==Install God init.d== sudo mkdir /var/run/god sudo chown expprodl:expprodl /var/run/god Install INIT file cd /etc/init.d/ wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/conf/init/god ==Download Precompiled binaries and scripts== Application Setup cd /home/expprodl wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/crossbowsoft/*.zip #unless this is a build server rm crossbow.zip Install the /home/expprodl/app folder cd /home/expprodl unzip app.zip rm app.zip Install the /home/expprodl/bin folder cd /home/expprodl unzip bin.zip rm bin.zip Install crossbow application root skeleton wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/deploystructure/deploy.zip unzip deploy.zip chown -hR expprodl.expprodl deploy rm deploy.zip ==Detailed Log== 0.2 - added development libraries required for compiling native gem dependencies - gcc gcc-c++ libxml2-devel mysql-devel libxslt-devel make 0.1 - created. ==Memcached Role== cd /tmp wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/installed-software/memcached-1.4.5-1.el5.x86_64.rpm rpm -ivh memcached-1.4.5-1.el5.x86_64.rpm Modify the configuration so memcached allows network clients to connect: sed -i.bak s/OPTIONS=""/OPTIONS="-l 0.0.0.0"/g /etc/sysconfig/memcached Memcached is also monitored by God. == INIT Scripts == An Init script is automatically installed with the RPM version. You need to manually install an INIT script if building from source. Instructions here in the link above. Add memcached to list of services to be started at boot: chkconfig memcached on == Chat Role== ==Install Node== We use Juggernaut which is a node application. At the time of this writing, it is deprecated. cd /tmp wget --user=expbbbu --password= ftp://qacollab01.exphosted.com/softrepo/app/installed-software/node-v0.2.4.tar.gz tar zxvf node-v0.2.4.tar.gz cd node-v0.2.4 ./configure make && make install ==Install Node== Don't use the above version on NodeJS ( corrected ) wget https://nodejs.org/dist/v0.10.48/node-v0.10.48.tar.gz ( corrected ) We use Juggernaut which is a node application. ( corrected ) At the time of this writing, it is deprecated. ( corrected ) In the below location all the binaries are available in the same machine ( corrected ) cd /soft/soft ( corrected ) tar zxvf node-v0.10.48.tar.gz ( corrected ) cd node-v0.10.48 ( corrected ) ./configure ( corrected ) make ( corrected ) make install ( corrected ) ==Install Binaries== The production user expprodl 's home directory is already shipped [[https://wiki.exphosted.com/doku.php?id=setup_an_app_server#application_setup]] with the required Juggernaut and Redis software. #Ensure you are expprodl cd ~/bin chat_sss.sh start before continue with chat server installation take the below mentioned zip file from "/soft/soft" and unzip it ( corrected ) cd /home/ ( corrected ) cp /soft/soft/app.zip . ( corrected ) cp /soft/soft/bin.zip . ( corrected ) unzip app.zip ( corrected ) unzip bin.zip ( corrected ) ==Install Binaries== #Ensure you are odeploy ( corrected ) cd ~/bin ( corrected ) vi chat_sss.sh ( corrected ) change the appuser name as "odeploy" ( corrected ) JUGDIR="/home/odeploy/apps/chat/juggernaut" ( corrected ) REDISDIR="/home/odeploy/apps/chat/redis-2.0.3" ( corrected ) chat_sss.sh start ( corrected ) sudo touch /var/log/chat.log ( corrected ) sudo chown -R odeploy:odeploy /var/log/chat.log ( corrected ) cd /home/odeploy/apps/chat/juggernaut ( corrected ) npm install ( corrected ) npm -v ( corrected ) touch /var/log/chat-redis.log ( corrected ) sudo chown -R odeploy:odeploy /var/log/chat-redis.log ( corrected ) ==INIT Scripts== echo "Start Juggernaut, Redis" >> /etc/rc.local echo "/home/expprodl/bin/chat_sss.sh start" > /etc/rc.local ==Installing Solr/Tomcat On Search Server== wget http://apache.mirrors.hoobly.com/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz (not working) wget https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz (working) tar -xzf apache-tomcat-6.0.32.tar.gz mv apache-tomcat-6.0.32 /opt/tomcat6 wget http://mirror.atlanticmetro.net/apache//lucene/solr/1.4.1/apache-solr-1.4.1.tgz ( not working ) wget https://archive.apache.org/dist/lucene/solr/1.4.1/apache-solr-1.4.1.tgz ( working ) tar -xzf apache-solr-1.4.1.tgz cd apache-solr-1.4.1 cp -r example/solr /opt/ cp dist/apache-solr-1.4.1.war /opt/solr/ cp dist/apache-solr-1.4.1.war /opt/tomcat6/webapps/solr.war ###Set solr data path in /opt/solr/conf/solrconfig.xml (set to the shared drive on search server, unsure if this is required) mkdir -p /nfs00/share00/solr/data ( not required - corrected ) ###/opt/tomcat6/bin/catalina.sh (set JAVA_OPT under the while loop) JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/opt/solr" export JAVA_OPTS mkdir -p /opt/solr/data ( corrected ) vi /opt/solr/conf/solrconfig.xml ( corrected ) change the dataDir as below ( corrected ) ${solr.data.dir:/opt/solr/data} ( corrected ) sudo cp /deploy/crossbow/current/solr/conf/schema.xml /opt/solr/conf/ ( corrected ) ##/opt/tomcat6/conf/tomcat-users.xml to include user/passwd ADD lines below ##/opt/tomcat6/conf/server.xml, add URIEncoding=“UTF-8” ##Copy schema.xml from /deploy/crossbow/current/solr/conf (src = App server) to /opt/solr/conf (destination = Tomcat/Search server) ##Change ownership of /opt/solr and /opt/tomcat6 to the app user used to run tomcat. ===HAPROXY INSTALLATION STEPS=== before doing the HAProxy installation change the app port number to 81 in httpd.conf ( /opt/apache2/conf/httpd.conf ) because HAProxy will run in 80 port number ( corrected ) cd /home/odeploy/bin ( corrected ) sh ./apache_sss.sh start ( corrected ) make sure the httpd is running with port 81 by issuing the below command ( corrected ) netstat -lnput ( corrected ) sudo yum install Xvfb ( corrected ) https://watilearnd2day.wordpress.com/2015/10/03/setup-load-balancer-on-linux-rhelcentos-using-haproxyis/ ( corrected ) ( for installation of Haproxy . Also refer dev machine for configuration ) ( corrected ) wget https://www.haproxy.org/download/1.5/src/haproxy-1.5.15.tar.gz ( corrected ) tar xvzf haproxy-1.5.15.tar.gz ( corrected ) make clean ( corrected ) make TARGET=custom CPU=native USE_PCRE=1 USE_LIBCRYPT=1 USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1 USE_OPENSSL=yes ( corrected ) make install PREFIX="/opt/haproxy" ( corrected ) haproxy -vv ( corrected ) Add the following line on /etc/rsyslog.conf ( both TCP and UDP ) ( corrected ) # Provides UDP syslog reception ( corrected ) $ModLoad imudp ( corrected ) $UDPServerRun 514 ( corrected ) # Provides TCP syslog reception ( corrected ) $ModLoad imtcp ( corrected ) $InputTCPServerRun 514 ( corrected ) local1.* /var/log/haproxy.log ( corrected ) service rsyslog restart ( corrected ) netstat -anu |grep :514 ( corrected ) copy the "/opt/haproxy/haproxy.cfg" from dev02.learnexa.com ( corrected ) copy the "/etc/init.d/haproxy" from dev02.learnexa.com ( corrected ) mkdir -p /opt/haproxy/errors ( corrected ) cd /opt/haproxy/errors ( corrected ) touch 503.http ( corrected ) mkdir -p /var/run/haproxy/ ( corrected ) ==Download and Install MySQL database on database server== USE VERSION 5.5, Download locations for MySQL 5.5 wget http://downloads.mysql.com/archives/mysql-5.5/MySQL-shared-compat-5.5.13-1.rhel5.x86_64.rpm wget http://downloads.mysql.com/archives/mysql-5.5/MySQL-client-5.5.13-1.rhel5.x86_64.rpm wget http://downloads.mysql.com/archives/mysql-5.5/MySQL-server-5.5.13-1.rhel5.x86_64.rpm wget http://downloads.mysql.com/archives/mysql-5.5/MySQL-devel-5.5.13-1.rhel5.x86_64.rpm remove the existing version of mysql 5.1.73 ( corrected ) yum remove mysql-libs-5.1.73-8.el6_8.x86_64 ( corrected ) yum remove mysql-devel-5.1.73-8.el6_8.x86_64 ( corrected ) yum remove mysql-5.1.73-8.el6_8.x86_64 ( corrected ) if you got the below error ( corrected ) error: Failed dependencies: ( corrected ) libaio.so.1()(64bit) is needed by MySQL-server-5.5.13-1.rhel5.x86_64 ( corrected ) libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.13-1.rhel5.x86_64 ( corrected ) libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.13-1.rhel5.x86_64 ( corrected ) download the libaio.so.1 from the below mentioned url ( corrected ) https://rpmfind.net/linux/RPM/remi/enterprise/5/x86_64/mysql-server-5.5.54-1.el5.remi.x86_64.html ( corrected ) https://rpmfind.net/linux/rpm2html/search.php?query=libaio.so.1%28LIBAIO_0.1%29%2864bit%29&submit=Search+...&system=&arch= ( corrected ) rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm ( corrected ) rpm -ivh MySQL-shared-compat-5.5.13-1.rhel5.x86_64.rpm ( corrected ) rpm -ivh MySQL-devel-5.5.13-1.rhel5.x86_64.rpm ( corrected ) rpm -ivh MySQL-client-5.5.13-1.rhel5.x86_64.rpm ( corrected ) rpm -ivh MySQL-server-5.5.13-1.rhel5.x86_64.rpm ( corrected ) == mysql configuration file (my.cnf) == my.cnf to be placed in /etc/my.cnf # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.5/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock default-storage-engine=InnoDB # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 innodb_buffer_pool_size = 512M skip-external-locking key_buffer_size = 256M max_allowed_packet = 32M tmp_table_size=64M max_heap_table_size=64M table_open_cache = 256 table_cache=2048 sort_buffer_size = 1M read_buffer_size = 1M read_rnd_buffer_size = 4M #thread_cache_size = 16 interactive_timeout=600 wait_timeout=28800 query_cache_size= 16M max_connections=600 skip-name-resolve # Recommended in standard MySQL setup #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES log-bin=mysql-bin server-id=1 innodb_flush_log_at_trx_commit=1 sync_binlog=1 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid Note: Run the ln command below (on app servers), else deploy:cold (initial deploy task) will fail to install mysql gem ln -s /usr/lib64/mysql/libmysqlclient.a /usr/lib64/libmysqlclient.a /usr/bin/mysqladmin -u root password newpasswd Run the below as mysql root to create required database, user and privileges, adjust values as required: create database cb_production DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; grant all on cb_production.* to produser@'localhost' identified by 'prodpswd'; grant all on cb_production.* to produser@'websrvr_IP_or_NAME' identified by 'prodpswd'; == bundle install == before proceed with bundle install follow the below steps ( corrected ) vi /etc/bashrc ( corrected ) search the below mentioned line ( corrected ) if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then ( corrected ) replace with the below mentioned line ( corrected ) if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then ( corrected ) vi /etc/profile ( corrected ) search the below mentioned line ( corrected ) if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then ( corrected ) replace with the below mentioned line ( corrected ) if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then ( corrected ) To avoid the error during "bundle install" run the below command and then execute " bundle install" ( corrected ) gem install rmagick -v '1.15.17' --install-dir /deploy/crossbow/shared/bundle/ruby/1.8/ -- --disable-htmldoc ( corrected ) bundle install ( corrected ) bundle exec rake db:create ( corrected ) bundle exec rake db:migrate ( corrected ) bundle exec rake db:seed ( corrected ) =====AFTER COLLAB SERVER IS COMPLETED FOLLOW THE BELOW STEPS TO CONFIGURE APP SERVER WITH COLLAB SERVER===== vi /etc/hosts and add the below entry ( corrected ) 10.138.84.57 odevcollab01_https ( corrected ) cd /mnt ( corrected ) mkdir crossbow ( corrected ) mount.glusterfs odevcollab01_https:crossbow /mnt/crossbow ( corrected ) cd /deploy/crossbow/shared ( corrected ) mkdir streams ( corrected ) mkdir assets ( corrected ) mkdir system ( corrected ) adduser red5 ( corrected ) change the same uid and gid of "red5" in appserver which should be match with collabserver (998) in the below mentioned files ( corrected ) /etc/passwd ( corrected ) /etc/group ( corrected ) chown -R odeploy:red5 streams ( corrected ) chmod -R 775 streams ( corrected ) chown -R odeploy:odeploy assets ( corrected ) chown -R odeploy:odeploy system ( corrected ) mount.glusterfs odevcollab01_https:crossbow /mnt/crossbow ( corrected ) mount -B /mnt/crossbow/streams /deploy/crossbow/shared/streams ( corrected ) mount -B /mnt/crossbow/assets /deploy/crossbow/shared/assets ( corrected ) mount -B /mnt/crossbow/system /deploy/crossbow/shared/system ( corrected ) configure the yml files in /deploy/crossbow/shared/config ( compare with the dev02.learnexa.com machine ) ( corrected ) ( compiled from dev02.learnexa.com ) ( corrected ) copy the god.sh from dev machine (/deploy/systasks/) ( corrected ) copy the god script from dev machine (/etc/init.d/god) ( corrected ) ===GOD SERVICE CONFIGURATION IN APP SERVER=== To start god manually ( if it is not running via god.sh script - to track the error ) ( corrected ) god -c /deploy/crossbow/current/config/development.god -D ( corrected ) check the below symlinks are available. if not create it ( corrected ) cd /usr/local/bin ( corrected ) ln -s /opt/ruby-enterprise-1.8.7-2011.03/bin/bundle . ( corrected ) ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js npm ( corrected ) check the below symlink is available ( corrected ) cd /deploy/crossbow/current/config/god/ ( corrected ) generic_monitoring.rb -> /deploy/crossbow/shared/config/generic_monitoring.rb ( corrected ) if not copy generic_monitoring.rb from dev02.learnexa.com ( corrected ) cd /deploy/crossbow/shared/config ( corrected ) vi roster ( corrected ) #!/usr/bin/env ruby RAILS_ROOT = File.dirname(File.dirname(__FILE__)) RAILS_ENV = 'development' require 'rubygems' require "#{RAILS_ROOT}/lib/expertus/online_user_store" require "#{RAILS_ROOT}/lib/expertus/roster" constants = {} ARGV.each do |arg| variable, value = arg.split('=') constants[variable] = value end env = EVN['RAILS_ENV'] if defined? ENV && EVN['RAILS_ENV'] env = env || constants['RAILS_ENV'] || RAILS_ENV CHAT_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/juggernaut.yml")[env] Juggernaut.options = {:host => CHAT_CONFIG['redis_host'], :port => CHAT_CONFIG['redis_port']} puts "Starting Roster" Expertus::Roster.subscribe cd /deploy/crossbow/shared/config ( corrected ) sudo chmod 755 roster ( corrected ) /deploy/systasks/god.sh stop ( corrected ) /deploy/systasks/god.sh start ( corrected ) ====Before run the deployment script do the below steps ==== cd /home/odeploy/crossbow/config ( corrected ) vi deploy.rb ( corrected ) find and replace with "dev02.learnexa.com" to "dev.learnexa.com" ( corrected ) cd /home/odeploy/crossbow/config/deploy ( corrected ) vi development.rb ( corrected ) replace the old appserver ip with new appserver (private ip) ( corrected ) mkdir -p /deploy/crossbow/backups ( corrected ) vi /home/odeploy/bin/runbackup.sh ( corrected ) make sure the backup script like below ( corrected ) #/bin/bash cd /deploy/crossbow/backups || exit 1 DATE=`date '+%Y%m%d%H%M'` DBNAME="development" FILENAME=${DBNAME}_${DATE}.sql echo "Backing up ${DBNAME} db..." test -p cbsock || mkfifo cbsock (echo '[client]'; echo 'user=root'; echo 'password=Expertus1@') > cbsock & [ -p pipe ] || mknod pipe p gzip < pipe > ${FILENAME}.gz & mysqldump --defaults-extra-file=cbsock -R ${DBNAME} >pipe && echo ${DBNAME} database dmp gzipped to file ${FILENAME}.gz ... find . -name '*.gz' -mtime +30 -exec rm -f {} \; vi /deploy/crossbow/shared/config/development.rb ( corrected ) # Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests Paperclip.options[:command_path] = "/usr/local/bin/" config.cache_classes = true # Full error reports are disabled and caching is turned on config.action_controller.consider_all_requests_local = false config.action_controller.perform_caching = true #config.log_level = :info config.action_view.cache_template_loading = true # See everything in the log (default is :info) config.log_level = :debug # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Use a different cache store in production # Object cache require 'active_support/cache/dalli_store23' config.cache_store = :dalli_store # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false # Enable threaded mode # config.threadsafe! config.after_initialize do ActiveMerchant::Billing::Base.mode = :test ActionController::Base.ip_spoofing_check = false end APP_URL = "https://dev.learnexa.com" CHAT_SERVER_URL="https://dev.learnexa.com:8090" CHAT_SERVER_PORT=8090 BIG_BLUE_BUTTON_API_URL = 'http://159.65.107.78/bigbluebutton/api' BIG_BLUE_BUTTON_SALT = '74682d7e47c263d4dc70a4a685957744' COLLAB_SSL_ENABLED = true API_URL = "https://api.dev.learnexa.com" PUBLIC_URL = "https://dev.learnexa.com" OFFICE_HOME = "/opt/libreoffice5.4" JOD_CONVERTER_USE_REGISTRY_FILE = false PDF2SWF_ENABLE_POLY2BITMAP = false LOG_ERROR = true SSL_ENABLED = true HTTP_ONLY_HEADER = "HTTP_X_HTTP_ONLY" OWN_DOMAIN_SSL_ENABLED = true LRS_SSL_ENABLED = true SWF_ABORT_TIME = 86400 cd /deploy/crossbow/current/config/environments ( corrected ) ln -s /deploy/crossbow/shared/config/development.rb ( corrected ) mkdir -p /deploy/crossbow/shared/log ( corrected ) mkdir -p /deploy/crossbow/shared/assets/protected ( corrected ) cd /deploy/crossbow/shared/streams ( corrected ) mkdir uploaded ( corrected ) chown -R odeploy:red5 uploaded ( corrected ) check the symlinks are properly established in the below mentioned directory. if not follow the below steps ( corrected ) cd /deploy/crossbow/current/public ( corrected ) vi /deploy/crossbow/shared/config/robots.txt ( corrected ) # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: User-Agent: * Disallow: / vi /deploy/crossbow/shared/config/crossdomain.xml ( corrected ) Create the below mentioned directory and grant the permissions ( corrected ) (if the below mentioned directories are not created thumbnail will not work ) ( corrected ) mkdir -p /deploy/crossbow/shared/assets/protected ( corrected ) mkdir -p /deploy/crossbow/shared/assets/photos ( corrected ) mkdir -p /deploy/crossbow/shared/assets/homepage_features ( corrected ) mkdir -p /deploy/crossbow/shared/assets/assets ( corrected ) cd /deploy/crossbow/shared/assets/ ( corrected ) chmod 755 protected ( corrected ) chmod 755 photos ( corrected ) chmod 755 homepage_features ( corrected ) chmod 755 assets ( corrected ) ====redis configuration==== Testing redis to connect using public ip ( before change the public ip to private ip ) sudhakaranm@sudhakaran-peo-gssi:~$ redis-cli -h 159.89.156.61 -p 6379 ( corrected ) 159.89.156.61:6379> ( corrected ) To change the redis ip from public to private ip you will get the redis directory in the below script ( corrected ) vi /home/odeploy/bin/.chat_sss.sh ( corrected ) REDISDIR="/home/odeploy/apps/chat/redis-3.0.5/src/" ( look like this ) ( corrected ) cd /home/odeploy/apps/chat/redis-3.0.5/src/ ( corrected ) vi redis.conf ( corrected ) add the below line or uncomment the existing one ( add the private ip ) ( corrected ) bind 10.138.240.18 127.0.0.1 ( corrected ) save and quit ( corrected ) cd /deploy/crossbow/current/config ( corrected ) vi redis.yml ( corrected ) production: host: chat.learnexa.com port: 6379 development: host: dev.learnexa.com ( need to replace "dev.learnexa.com" with "localhost" ) port: 6379 staging: host: chat.learnexa.com port: 6379 change host in development portion as "localhost" in the above mentioned block ( corrected ) vi juggernaut.yml ( corrected ) # This file contains the settings required for chat via Juggernaut. # Ex - : # redis_host: host where redis is installed # redis_port: redis port # juggernaut_host: host where juggernaut is installed # juggernaut_port: Juggernaut port # juggernaut_protocol: This can be http or https. If its https then make sure that juggernaut is running with https. # To run juggernaut in https mode, create folder called 'keys' in the 'juggernaut' directory, containing your privatekey.pem and certificate.pem files. development: redis_host: dev.learnexa.com ( need to replace "dev.learnexa.com" with "localhost" ) redis_port: 6379 juggernaut_host: dev.learnexa.com juggernaut_port: 8090 juggernaut_protocol: https staging: redis_host: localhost redis_port: 6379 juggernaut_host: qa01.exphosted.com juggernaut_port: 8090 test: redis_host: localhost redis_port: 6379 juggernaut_host: localhost juggernaut_port: 8080 production: redis_host: chat.learnexa.com redis_port: 6379 juggernaut_host: chat.learnexa.com juggernaut_port: 8090 juggernaut_protocol: https change "redis_host: dev.learnexa.com" as "localhost" in development portion ( corrected ) == restart the chat service == cd /home/odeploy/bin ( corrected ) ./chat_sss.sh stop ( corrected ) ./chat_sss.sh start ( corrected ) == restart the passenger == cd /deploy/crossbow/current/tmp ( corrected ) touch restart.txt ( corrected ) Testing redis to connect using public ip ( after changed the public ip with private ip ) sudhakaranm@sudhakaran-peo-gssi:~$ redis-cli -h 159.89.156.61 -p 6379 ( corrected ) Could not connect to Redis at 159.89.156.61:6379: Connection refused ( corrected ) not connected> ( corrected ) === When the appserver restarted we need execute the below commands to up the services === run as root user ( corrected ) mount.glusterfs odevcollab01_https:crossbow /mnt/crossbow ( corrected ) mount -B /mnt/crossbow/streams /deploy/crossbow/shared/streams ( corrected ) mount -B /mnt/crossbow/assets /deploy/crossbow/shared/assets ( corrected ) mount -B /mnt/crossbow/system /deploy/crossbow/shared/system ( corrected ) /etc/init.d/haproxy restart ( corrected ) run as appuser ( odeploy ) ( corrected ) cd ~/bin ( corrected ) ./tomcat_sss.sh start ( corrected ) ./apache_sss.sh start ( corrected ) ./chat_sss.sh start ( corrected ) ==== DEPLOYMENT STEPS ==== HINT: In the below steps the Error "1130 (HY000)" happended because we are not having any salve db. ( Corrected ) [odeploy@odev05 crossbow]$ ./runcap.sh As we planned mysql sync break ERROR 1130 (HY000): Host '159.89.156.61' is not allowed to connect to this MySQL server ERROR 1130 (HY000): Host '159.89.156.61' is not allowed to connect to this MySQL server Select Target environment 1). Development 2). Production Enter target environment number [1,2]: 1 Select Cap Task 1). deploy (Use this for incremental code deployments) 2). deploy:setup (Use this to setup the necessary application folders) 3). deploy:check (Use this to verify application folder setup) 4). deploy:cold 5). deploy:migrate 6). deploy:restart 7). deploy:update 8). deploy:web:enable (Use this to remove maintenance page, App2 becomes accessible from back-end) 9). httpstate:allup (Use this as a final step to enable Internet access to all web servers) Enter Cap Task number [1-9]: 1 Enter TAG value or leave blank to use trunk as repository: Ready to run task deploy in environment development..? [yY]: y Running cap development deploy .. * executing `development' triggering start callbacks for `deploy' * executing `multistage:ensure' * executing `deploy' * executing `deploy:update' ** transaction: start * executing `deploy:update_code' triggering before callbacks for `deploy:update_code' * executing `verify_tag' Enter SVN UserName: yamini Enter SVN Password: ********* ( svn password ) * executing `deploy:web:disable' * executing "/deploy/systasks/web.sh disable" servers: ["10.138.240.18"] Password: ********** ( odeploy password ) == Production post deployment check list == [[https://wiki.exphosted.com/postdeploymentchecklist]] ==Before start runcap check folder permissions == Mysql & apache service only start by root , Remaining service must start & stop god with user privilege