Blue/Green 배포 방식

  1. 현재 실행 X한 container 확인
  2. 그 container 삭제하고 배포 시작
  3. 배포 끝나면 실행
  4. 실행 됬는지 확인
  5. 원래 실행 중이던 containe

Nginx 설정

service-url.inc 파일 생성

sudo nano /etc/nginx/conf.d/service-url.inc

service-url.inc 파일 생성 후

set $service_url <http://3.36.85.4:8880>

입력하고 저장해 준다.

sites-enabled의 defalut 파일 수정

server {

        include /etc/nginx/conf.d/service-url.inc;

        root /home/ubuntu/front/dist;
        index index.html index.htm index.nginx-debian.html;
    server_name www.pasds.world pasds.world; # managed by Certbot

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.html;
        }

        location /app {
                proxy_pass $service_url;
        }

include를 통하여 아까 생성한 service-url.inc 파일 넣어주고

service-url.inc 파일 안에 들어있는 $service_url 변수명을 proxy_pass 해준다

Jenkins pipeline