개발자

AWS Beanstalk 배포 하기 전에 신경써줘야 할 것이 있나요 ?

2023년 01월 23일조회 396

현재 nodejs로 백엔드를 구성하고 EB에 배포하는데 몇 가지 오류가 생겨서 질문 드립니다. 프로젝트 구조는 다음과 같습니다. -customer └ .gitignore └ .dockerignore └ src ( 백엔드 코드 ) └ .gitignore └ Dockerfile └ Package.json -product └ customer 와 동일 -shopping └ customer 와 동일 -proxy └ Dockerfile docker-compose.yaml 리전 ap-northeast-2(seoul region) 로컬에서 빌드하고 작동하는 거 확인 후 위 코드를 모두 압축해서 EB에 올렸습니다. EB에 올리기전에 vpc , igw, 등등 미리 생성해줘야 할 게 있나요? 추가로 .gitignore 같은 파일도 같이 올려도 되나요 ? ( 초보라서 질문의 질이 떨어질 수 있지만 고수분들의 너그러운 양해를 부탁드립니다 .ㅠㅠ ) 에러 로그를 보면 1. ELB Fail -> VPC has no internet gateway 2. Stack named 'awseb-e-33wucpgpey-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBV2LoadBalancer, AWSEBInstanceLaunchWaitCondition] 3. LaunchWaitCondition failed. The expected number of EC2 instances were not initialized within the given time. Rebuild the environment. If this persists, contact support.

1# customer, product, shopping Dockerfile.yaml
2FROM node
3
4WORKDIR /app/customer
5
6COPY package.json .
7
8RUN rm -rf node_modules/
9RUN npm update
10RUN npm install
11RUN npm uninstall bcrypt
12RUN npm install bcryptjs
13RUN npm install bcrypt
14
15COPY . .
16
17EXPOSE 8001
18CMD ["npm","update"]
19CMD ["npm","start"]
20------------------------------------------------------------------------
21------------------------------------------------------------------------
22# proxy Dockerfile.yaml
23FROM nginx
24
25RUN rm /etc/nginx/nginx.conf 
26
27COPY nginx.conf /etc/nginx/nginx.conf
28------------------------------------------------------------------------
29------------------------------------------------------------------------
30# docker-compose.yaml
31version: "3"
32services:
33  nosql-db:
34    image: mongo
35    ports:
36      - "27018:27017"
37    container_name: nosql-db
38    volumes:
39      - ./db/:/data/db
40  products:
41    build:
42      dockerfile: Dockerfile
43      context: ./products
44    container_name: products
45    ports:
46      - "8002:8002"
47    restart: always
48    depends_on:
49      - "nosql-db"
50    volumes:
51      - .:/app
52      - /app/products/node_modules
53
54    env_file:
55      - ./products/.env.dev
56  shopping:
57    build:
58      dockerfile: Dockerfile
59      context: ./shopping
60    container_name: shopping
61    ports:
62      - "8003:8003"
63    restart: always
64    depends_on:
65      - "nosql-db"
66    volumes:
67      - .:/app
68      - /app/shopping/node_modules
69    env_file:
70      - ./shopping/.env.dev
71  customer:
72    build:
73      dockerfile: Dockerfile
74      context: ./customer
75    container_name: customer
76    ports:
77      - "8001:8001"
78    restart: always
79    depends_on:
80      - "nosql-db"
81
82    volumes:
83      - .:/app/
84      - /app/customer/node_modules
85    env_file:
86      - ./customer/.env.dev
87  nginx-proxy:
88    build:
89      dockerfile: Dockerfile
90      context: ./proxy
91    depends_on:
92      - products
93      - shopping
94      - customer
95    ports:
96      - 80:80
이 질문이 도움이 되었나요?
'추천해요' 버튼을 누르면 좋은 질문이 더 많은 사람에게 노출될 수 있어요. '보충이 필요해요' 버튼을 누르면 질문자에게 질문 내용 보충을 요청하는 알림이 가요.
profile picture
익명님의 질문

답변 1

손정현님의 프로필 사진

안녕하세요! EB 인스턴스 생성할때 VPC 설정을 따로 안해주면 aws 기본 VPC 설정이 할당되는 것으로 알고 있습니다. - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.vpc.html 기본 VPC에서는 internet gateway가 같이 설정되는 것으로 알고 있어요. - https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html 생성하신 EB 설정을 한번 확인해보시면 좋을 것 같습니다 :)

지금 가입하면 모든 질문의 답변을 볼 수 있어요!

현직자들의 명쾌한 답변을 얻을 수 있어요.

또는

이미 회원이신가요?

목록으로

지금 가입하면 모든 질문의 답변을 볼 수 있어요!