Steps to add maintenance page in Performexa production deployment script
——————————————————————————————————
1. Add gem 'turnout', '~> 2.4' into Gemfile
2. bundle install
3. Add the Maintenance page file into project public directory with file name maintenance.html
4. Make the above changes into project file and commit into the svn
5. Do the deployment in the specific evironment
6. Add maintenance options(deploy:web:enable, deploy:web:disable) in /home/<appuser>/tincan
7. Open the runcap.sh file from the follwing location and do the below changes
cd /home/<appuser>/tincan vi runcap.sh
8. In the printmenu() function add two more cases (ie) case 3 and case 4 to make the selection (Enable / Disable) for maintenance page
Add the following statements below this statement " echo "2). deploy:restart" "
echo "3). deploy:web:enable (Use this to remove maintenance page, all app servers are enabled)"
echo "4). deploy:web:disable (Use this to install maintenance page, public access to all app servers is disabled)"
Do the below change in the next line
Initially it will be like this " read -p 'Enter Cap Task number [1-2]: ' captask ". It has to be changed like this "read -p 'Enter Cap Task number [1-4]: ' captask "
9. Add two below mentioned fuction to perform the site maintenance page operation
addMaintenenceMode()
{
echo `pwd`
cd /deploy/tincan/current
echo `pwd`
bundle exec rake maintenance:start allowed_ips="182.72.26.6"
}
In the addMaintenenceMode() function we are allowing the ipaddress “182.72.26.6” to access the site even though the site in maintenance mode because it is our public ip
removeMaintenenceMode()
{
echo `pwd`
cd /deploy/tincan/current
echo `pwd`
bundle exec rake maintenance:end
}
Save the file and exit