-앱 빌드

sbt dist



-ec2 런치



-elastic-ip 붙이기



-putty설치

https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/putty.html

puttyGen으로 .pem 파일을 .ppk로 변환

인스턴스에 로그인



-openjdk 설치

sudo yum install java-1.8.0-openjdk




-인스턴스에 파일 복사

pscp -i .pem-파일-위치 C:\빌드압축/파일/위치.zip /home/ec2-user/



-파일을 /opt/로 이동

mv



-zip 파일 풀기

unzip 파일명.zip



-원하는 디렉토리명으로 바꿈

mv



-서버 설정 변수 확인 

play.filter.allowed

cors.allowedOrigins(elastic-ip)

static file location: /opt/디렉토리/conf



-bash 스크립트를 실행하여 앱이 올라가는 지 확인

sudo bash 스크립트이름 -Dhttp.port=80



-systemd에 .service 파일 생성

.service 파일 위치: /etc/systemd/system/xxxx.service

파일 예제

=================================

[Service]

Type=simple

PIDFile=/path/to/app/RUNNING_PID

WorkingDirectory=/path/to/app

ExecStart=/bin/bash /path/to/app/bin/filename -Dhttp.port=80

Restart=on-failure

RestartSec=3

SuccessExitStatus=143


[Install]

WantedBy=multi-user.target

=================================


-서비스 리로드(.service 파일 수정 후 반드시 싫행)

 sudo systemctl daemon-reload



-서비스가 등록됐는지 확인

 sudo systemctl status xxxx.service -l



-기동

sudo systemctl start xxxx






Posted by 타다키치
,