Cloud Foundry의 기본(1)

in #kr7 years ago (edited)

CloudFoundry를 이용한 MSA 구축 경험 정리 겸 공유합니다.

goRouter

불필요한 응답시간을 제거하기 위해 단일 프로세스는 모든 routing logic을 포함합니다.

Gorouter는 NATS(경량 pub-sub message broker)를 통해 route 정보를 업데이트 받습니다.

# 매 2분 이내
{
  "host": "127.0.0.1",
  "port": 4567,
  "uris": [
    "my_first_url.vcap.me",
    "my_second_url.vcap.me"
  ],
  "tags": {
    "another_key": "another_value",
    "some_key": "some_value"
  }
}

Gorouter 는 /healthz endpoint를 모니터링을 위해 제공합니다.

/routes endpoint는 모든 route 정보를 JSON 형태로 반환합니다.

{"0295dd314aaf582f201e655cbd74ade5.cloudfoundry.me":["127.0.0.1:34567"],
"03e316d6aa375d1dc1153700da5f1798.cloudfoundry.me":["127.0.0.1:34568"]}

Blue- Green 배포

  1. cf push Blue -n app
  2. cf push Green -n app-temp
  3. Green 상태에서 할수 있는 테스트 다 함. DB 데이터 조심
  4. cf map-route Green example.com -n app
  5. cf unmap-route Blue example.com -n app
  6. cf unmap-route Green example.com -n app-temp
  7. 그런데 service name 에 따라서 자동으로 eureka에 등록이 될텐데, 어떻게 blue-green이 되는지 확인해 봐야됨(URL base가 아닐 때)

클라우드를 위한 앱 설계

  1. 로컬 파일 시스템 사용을 지양
  2. 최상위 도메인에 쿠키를 사용하여 정보를 공유할지 고려
  3. CF는 80, 443 를 허용함. WebSocket도 허용함(Upgrade Header 이용하지만, 추가 고려사항 있음)
  4. CF는 정상적인 인스턴스 종료를 위해 10초간 기다리고 아직도 자식 프로세스가 동작중이면 강제 종료시킴. 비정상 종료에 문제가 발생할 수 잇다면 정상 종료를 위해 termination signal 에 대한 처리를 해야 함.
  5. 기본적으로, 폴더 내 모든 파일이 push 됨(svn, gitignore 파일 등) 이를 피하려면 .cfignore에 파일 무시 목록을 추가해야 함
  6. 인스턴스는 2개 이상 설정하여 CF 업그레이드 프로세스중 서비스가 안되는 상황을 피해야 됨
  7. 빌드팩 사용
Sort:  

Welcome to Steemit!

We have all been waiting for you, we are glad you could make it.
I have given you a upvote to help you out!

Hope you love Steemit as much as we do.

Give these a read:

Chat with us:

If this post was helpful, please leave an upvote. It helps me to keep helping new users.

I'm sunnybooster, a booster for accounts not posts. Send me 0.5 STEEM or SBD to get a week of upvotes! If you don't yet know what this is its fine.

I am a bot and this was automated. I exist to help out new members and attempt to get them hooked

Congratulations @chocomaru! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You made your First Comment

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.030
BTC 58224.09
ETH 2508.01
USDT 1.00
SBD 2.34