Coder Social home page Coder Social logo

express-aws-pipeline's Introduction

express-aws-pipeline's People

Contributors

choewy avatar

Stargazers

 avatar

Watchers

 avatar

express-aws-pipeline's Issues

2. AWS IAM & CodeDeploy & Pipeline 설정

IAM EC2 역할 생성

역할 만들기

  • 신뢰할 수 있는 엔티티 유형 : AWS 서비스
  • EC2

권한 추가

  • AmazonEC2RoleforAWSCodeDeploy

이름 지정, 검토 및 생성

  • 역할 이름 : ExpressDeployRole

IAM CodeDeploy 역할 만들기

역할 만들기

  • 신뢰할 수 있는 엔티티 유형 : AWS 서비스
  • 사용 사례 : 다른 AWS 서비스의 사용 사례
    • CodeDeploy : CodeDeploy

이름 지정, 검토 및 생성

  • 역할 이름 : CodeDeployRole

EC2 인스턴스 생성

  • 이름 및 태그 : express
  • 애플리케이션 및 OS 이미지 : Ubuntu20.04LTS
  • 키 페어 발급
  • 고급 세부 정보
    • IAM 인스턴스 프로파일 : ExpressDeployRole
  • 네트워크 추가
    • HTTP : PORT 80, IPv4(0.0.0.0/0)
    • HTTP : PORT 80, IPv6(::0)
    • 사용자 정의 TCP : PORT 5000, IPv4(0.0.0.0/0)
    • 사용자 정의 TCP : PORT 5000, IPv6(::0)

CodeDeploy 설정

애플리케이션 생성

  • 애플리케이션 이름 : express-server
  • 컴퓨팅 플랫폼 : EC2/온프레미스

배포 그룹 생성

  • 배포 그룹 이름 : express-server-group
  • 서비스 역할 : CodeDeployRole
  • 배포 유형 : 현재 위치
  • 환경 구성 : Amazon EC2 인스턴스
    - 키 : { Name : express }
  • 로드 밸런서 : 로드 밸런싱 비활성화

파이프라인

파이프라인 생성

  • 파이프라인 이름 : express-pipeline
  • 소스 공급자 : Github(버전 2)
    • GitHub에 연결
      • 연결 이름 : express-server-github
    • 리포지토리 이름 : 선택
    • 브랜치 이름 : 선택
  • 빌드 스테이지 추가
    • 빌드 : 건너뛰기
    • 배포
      • 배포 공급자 : AWS CodeDeploy
      • 리전 : 아시아 태평양(서울)
      • 애플리케이션 이름 : express-server
      • 배포 그룹 : express-server-group

1. AWS EC2 Instance(ubuntu20.04) 설정

ssh

$ cd .ssh
$ chmod 400 [ SSH_KEY_FILE ].pem
$ sudo ssh -i '[ SSH_KEY_FILE ].pem' ubuntu@[ INSTANCE_PUBLIC_DNS ]
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
ubuntu@[ PUBLIC_IP ] : ~$

apt update & upgrade

$ sudo apt update && apt upgrade

install node.js 16.x.x

$ sudo apt install -y curl
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ sudo apt install -y nodejs
$ sudo npm install -g [email protected]
$ node -v && npm -v

install docker

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> stable"

$ sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io
$ docker --version

install docker compose v2.4.1

$ sudo mkdir -p /usr/local/lib/docker/cli-plugins
$ sudo curl -SL https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
$ sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
$ docker compose version

install CodeDeploy Agent

$ sudo apt install ruby-full
$ sudo apt install wget
$ cd /home/ubuntu
$ wget https://aws-codedeploy-ap-northeast-2.s3.ap-northeast-2.amazonaws.com/latest/install
$ chmod +x ./install
$ sudo ./install auto
$ sudo service codedeploy-agent status
lines 1-13/13 (END) q

ruby 3.x가 설치된 경우

aws codedeploy-agent는 ruby 2.x버전만 지원하므로 ruby 3.x 버전을 삭제 후 다음과 같이 rvm을 사용하여 2.7.6 버전으로 설치해주어야 합니다.

$ sudo apt remove ruby
$ sudo apt install git curl autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc
$ source ~/.zshrc
$ rbenv install 2.7.6
$ rbenv global 2.7.6

port fowording

$ sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.