-
Notifications
You must be signed in to change notification settings - Fork 5
HOME canary releases
We need to create a new config for mup, which will deploy another app, which will be connected to the same database but running on different port.
-
Create new MUP deploy config by copying the directory
.deploy/hometo.deploy/home-canary -
Change
.deploy/home-canary/mup.jsas following (change bolded lines):
module.exports = {
plugins: ['mup-git'],
servers: {
one: {
host: 'mosbehome.ctagroup.org',
username: 'ubuntu',
pem: '/home/pgorecki/.ssh/home-cta.pem',
},
},
meteor: {
name: 'home-monterey-canary',
path: '../../',
docker: {
image: 'abernix/meteord:node-8.9.1-base',
args: [
'--link=mongodb:mongodb'
],
},
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
PORT: '4000',
ROOT_URL: 'https://mosbehome.ctagroup.org',
MONGO_URL: 'mongodb://mongodb:27017/home-monterey',
},
deployCheckWaitTime: 60,
},
};
- Double check that you are in
.deploy/home-canarydirectory. - Run
mup setup && mup deployfrom canary directory. New docker container with an app will be running on port 4000, which is connected to the same Mongodb as the production app running on port 3000 (both apps use the same DB)
We need to configure Nginx server, which will redirect user either to a production app or canary app based on the cookie value. Nginx
- Login to production server using
mup sshone from.deploy/home-canarydirectory. - Edit
/etc/nginx/sites-enabled/home.ctagroup.orgas following:
map $cookie_canary $server {
default meteor;
"yes" meteor_canary;
}
upstream meteor {
server 127.0.0.1:3000;
}
upstream meteor_canary {
server 127.0.0.1:4000;
}
server {
server_name home.ctagroup.org www.home.ctagroup.org;
access_log /var/log/nginx/home.ctagroup.org.access.log ;
error_log /var/log/nginx/home.ctagroup.org.error.log;
root /var/www/home.ctagroup.org/htdocs;
index index.html index.htm;
location ~ /\.well-known/ {
try_files $uri $uri/ =404;
}
location / {
proxy_pass http://$server;
add_header X-debug $server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Client-Verify SUCCESS;
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
# include common/locations.conf;
include /var/www/home.ctagroup.org/conf/nginx/*.conf;
}
- Restart nginx
sudo service nginx restart
User visiting https://home.ctagroup.org/ can switch to canary server by opening web console (F12) and typing the following in the console: document.cookie='canary=yes'. Then hit F5 to refresh the page. You will see the app version on the front page of HOME app. Also, for apps deployed after 2018.04.27 you can check the build info using:re
Meteor.call('app.buildInfo', function (err, res) { console.log(err,res) })
in the browser console.
To switch back to the production server, visit https://home.ctagroup.org/, open web console (F12) and type typing the following in the console: document.cookie='canary=no'. Then hit F5 to refresh the page.