env 형식


로컬에서 실행

docker로 실행 - windows

docker로 실행 - linux(ubuntu)


dockerfile이 있어서 레포 통째로 cloudtype으로 배포해도 되는데 해보니까 너무 귀찮아서 AWS를 이용하기로 했어요

AWS로 배포

이대로 따라하려면 AWS CLI가 설치되어 있어야 해요~

1. EFS 파일 시스템 생성

EFS_FILE_SYSTEM_ID=$(aws efs create-file-system \\\\
  --region ap-northeast-2 \\\\
  --performance-mode generalPurpose \\\\
  --throughput-mode bursting \\\\
  --encrypted \\\\
  --query 'FileSystemId' \\\\
  --output text)

생성된 값을 .env의 EFS_FILE_SYSTEM_ID에 복사해 넣어주세요!!

2. EFS 마운트 타겟 생성

source .env

aws efs create-mount-target \\\\
  --file-system-id ${EFS_FILE_SYSTEM_ID} \\\\
  --subnet-id ${SUBNET_ID_1} \\\\
  --security-groups ${SECURITY_GROUP_ID} \\\\
  --region ap-northeast-2

aws efs create-mount-target \\\\
  --file-system-id ${EFS_FILE_SYSTEM_ID} \\\\
  --subnet-id ${SUBNET_ID_2} \\\\
  --security-groups ${SECURITY_GROUP_ID} \\\\
  --region ap-northeast-2

3. IAM 역할 생성

aws iam create-role \\\\
  --role-name ecsTaskExecutionRole \\\\
  --assume-role-policy-document file://trust-policy.json

aws iam attach-role-policy \\\\
  --role-name ecsTaskExecutionRole \\\\
  --policy-arn arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy

aws iam put-role-policy \\\\
  --role-name ecsTaskExecutionRole \\\\
  --policy-name EFSAccessPolicy \\\\
  --policy-document file://efs-access-policy.json

aws iam create-role \\\\
  --role-name ecsTaskRole \\\\
  --assume-role-policy-document file://trust-policy.json

aws iam put-role-policy \\\\
  --role-name ecsTaskRole \\\\
  --policy-name EFSAccessPolicy \\\\
  --policy-document file://efs-access-policy.json

4. CloudWatch Logs 그룹 생성