Backend Testing Add Hosts entry
vi /etc/hosts

207.20.42.196 test.learnexa.com #for prodapp04 not required vpn

step1

Install maintenance page
login to prodapp01 as expprodl appuser

/home/expprodl/crossbow

./runcap.sh


Select Target environment
1). Staging
2). Production
Enter target environment number [1,2]: 2

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, all app servers are enabled)
9). deploy:web:disable (Use this to install maintenance page, public access to all app servers is disabled)
Enter Cap Task number [1-9]:  9



need to change like mentioned below for memcache 

login to prodapp03

ssh expprodl@10.166.152.14

vi /deploy/crossbow/current/config/environments/production.rb

from
config.cache_store = :dalli_store, "10.166.152.11"

to
config.cache_store = :dalli_store, "10.166.152.22"


restart passenger , god stop and start services on prodapp03 


/deploy/systasks/god.sh stop

/deploy/systasks/god.sh start


/deploy/systasks/god.sh status   #to know god status 



#to restart passenger


cd /deploy/crossbow/current/

touch tmp/restart.txt

step2

add below changes /opt/haproxy/haproxy.cfg

From

backend deploy_testing_learnexa
        balance roundrobin
        option httplog
        option forwardfor
        cookie SERVERID insert indirect
        source 10.166.152.242
        #timeout client 150000ms
        timeout connect 35000ms
        timeout server 8m
        option httpchk HEAD /contact-us/new HTTP/1.1\r\nHost:\ www.learnexa.com\r\nUser-Agent:\ HaProxy
       server prodapp01 10.166.152.11:80 check port 80  cookie app1 maxconn 31 inter 5000 rise 2 fall 3
#       server prodapp04 10.166.152.22:80 check port 80 cookie app4 maxconn 31 inter 5000 rise 2 fall 3



TO

backend deploy_testing_learnexa
        balance roundrobin
        option httplog
        option forwardfor
        cookie SERVERID insert indirect
        source 10.166.152.242
        #timeout client 150000ms
        timeout connect 35000ms
        timeout server 8m
        option httpchk HEAD /contact-us/new HTTP/1.1\r\nHost:\ www.learnexa.com\r\nUser-Agent:\ HaProxy
#       server prodapp01 10.166.152.11:80 check port 80  cookie app1 maxconn 31 inter 5000 rise 2 fall 3
       server prodapp04 10.166.152.22:80 check port 80 cookie app4 maxconn 31 inter 5000 rise 2 fall 3

 haproxy reload

/etc/init.d/haproxy reload

After validation completed do below 
*********************************************************************************************************************************

This is for adding prodapp04 and remove  prodapp01  server  live for public

add below changes /opt/haproxy/haproxy.cfg

FROM

backend learnexa
	balance roundrobin
        option httplog
        option forwardfor
 	cookie SERVERID insert indirect
	source 10.166.152.246
	#timeout client 150000ms
	timeout connect 35000ms
        timeout server 8m
	option httpchk HEAD /contact-us/new HTTP/1.1\r\nHost:\ www.learnexa.com\r\nUser-Agent:\ HaProxy
	server prodapp01 10.166.152.11:80 check port 80  cookie app1 maxconn 31 inter 5000 rise 2 fall 3
	server prodapp03 10.166.152.14:80 check port 80 cookie app3 maxconn 31 inter 5000 rise 2 fall 3


TO

backend learnexa
	balance roundrobin
        option httplog
        option forwardfor
 	cookie SERVERID insert indirect
	source 10.166.152.246
	#timeout client 150000ms
	timeout connect 35000ms
        timeout server 8m
	option httpchk HEAD /contact-us/new HTTP/1.1\r\nHost:\ www.learnexa.com\r\nUser-Agent:\ HaProxy
	server prodapp01 10.166.152.11:80 check port 80  cookie app1 maxconn 31 inter 5000 rise 2 fall 3
	 server prodapp04 10.166.152.22:80 check port 80 cookie app4 maxconn 31 inter 5000 rise 2 fall 3


#haproxy reload

/etc/init.d/haproxy reload 




Remove maintenance page
login to prodapp01 as expprodl appuser

/home/expprodl/crossbow

./runcap.sh


Select Target environment
1). Staging
2). Production
Enter target environment number [1,2]: 2

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, all app servers are enabled)
9). deploy:web:disable (Use this to install maintenance page, public access to all app servers is disabled)
Enter Cap Task number [1-9]:  8