[5주차 개발일지 2] fly.io를 사용한 서버/클라이언트 배포 2 (241002)

2024. 10. 2. 15:26공부/DGTP TIL

1. 금일 배포를 마무리했습니다. 

 

2. 배포 과정에서 나타났던 대표적인 문제들

- 1. socket/websocket connection fail 

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000

dockerfile에서 위 부분을 제거하자 ws://~~~~:3000이라 뜨며 해당 포트를 바라보는 문제가 해결되었습니다.

#### BE ####
[http_service]
  internal_port = 4000
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[services]]
  internal_port = 4000
  protocol = "tcp"
  [[services.ports]]
    port = 80
    handlers = ["http"]
  
  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]

  [services.concurrency]
    soft_limit = 25
    hard_limit = 50

[[services]]
  internal_port = 5001
  protocol = "tcp"

  [[services.ports]]
    port = 5001
    handlers = ["http"]
  
  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]

  [services.concurrency]
    soft_limit = 25
    hard_limit = 50
    
#### FE ####
[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[services]]
  protocol = "tcp"
  internal_port = 5001
  processes = ["app"]

  [[services.ports]]
    port = 80
    handlers = ["http"]
    force_https = true

  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]

 

위와 같이 각각의 포트를 명시하니 연결 오류는 해결되었습니다.

(5001포트 대신 3000을 열고 5001로 요청을 하는 상황이였습니다.)

 

3. Health Check Fail

가장 많은 시간을 허비하게한 오류이자, 결국 해결하지 못해 체크를 날려버린 오류 입니다. 

- 1. be에선 해결

[services.concurrency]
    soft_limit = 25
    hard_limit = 50

- 2. fe에선 해결하지 못함. 그래서 concurrency와 port-check를 날려버림으로 해결했습니다.

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[services]]
  protocol = "tcp"
  internal_port = 5001
  processes = ["app"]

  [[services.ports]]
    port = 80
    handlers = ["http"]
    force_https = true

  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]
 
#### port에 대한 설명만 가득한 toml