Skip to content

Instantly share code, notes, and snippets.

View KamalakannanRM's full-sized avatar

Kamalakannan R M KamalakannanRM

View GitHub Profile
@KamalakannanRM
KamalakannanRM / blue-green-nginx.md
Last active March 11, 2021 13:49
Blue/Green deployments with NGINX

Blue/Green deployments with NGINX

Blue/Green deployments is nothing new and the benefits of the methodology are well documented and already extensively discussed. For a quick description, it is when we have two identical copies of the production environment (one is called “Blue”, one is called “Green”) and only one of them is visible to the customers. We deploy to the inactive one and once we are happy the deployment is OK, we then switch them.

Config files

First we have the nginx.config that includes the server blocks for both the active and inactive versions of the app:

##################################
@KamalakannanRM
KamalakannanRM / jenkins.nginx.conf
Created November 29, 2019 13:59
Jenkins reverse proxy through Nginx with SSL
ssl_certificate /etc/nginx/ssl/jenkins.domain.tld/cert.pem;
ssl_certificate_key /etc/nginx/ssl/jenkins.domain.tld/privkey.pem;
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
server_name jenkins.domain.tld;
@KamalakannanRM
KamalakannanRM / nexus3.nginx.conf
Created November 29, 2019 13:58
Nexus3 OSS Repository Manager reverse proxy through Nginx with SSL
ssl_certificate /etc/nginx/ssl/nexus.domain.tld/cert.pem;
ssl_certificate_key /etc/nginx/ssl/nexus.domain.tld/privkey.pem;
upstream nexus {
server 127.0.0.1:8081 fail_timeout=0;
}
server {
listen 80;
server_name nexus.domain.tld;
@KamalakannanRM
KamalakannanRM / sonarq.nginx.conf
Created November 29, 2019 13:57
SonarQube reverse proxy through Nginx with SSL
ssl_certificate /etc/nginx/ssl/sonar.domain.tld/cert.pem;
ssl_certificate_key /etc/nginx/ssl/sonar.domain.tld/privkey.pem;
upstream sonar {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80;
server_name sonar.domain.tld;