프로젝트 세팅
git Repo :
.gitignore
resource/application-dev.yml 생성
spring:
application:
name: bommeong-dev
jpa:
hibernate:
ddl-auto: create-drop # DB 설계 완료 될 시 update 로 변경
show-sql: true
properties:
hibernate:
format_sql: true
datasource:
url: jdbc:mariadb://database-dev-bommeong.cf4iyo2aig60.ap-northeast-2.rds.amazonaws.com:3306/bommeong?useUnicode=true&characterEncoding=utf8
username: root
password: devbommeong
driver-class-name: org.mariadb.jdbc.Driver
server:
port: 8080
cloud:
aws:
region:
static: ap-northeast-2
s3:
bucket: dev-bommung
credentials:
access-key: AKIA2UC3C5AS35HJUS56
secret-key: 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
stack:
auto: false
jwt:
secret:
key: 9ed821fbd01a1c4cf682aa41230e667399e734def75af23aee818b48b21cb2f8
YAML
복사
개발 배포 환경: (mung…meong… 이름이 헷갈릴 수도 있을텐데 죄송합니다… 다시 mung으로 돌릴까요… 뭉…은 좀 이상해서 처음부터 잘했어야하는데…)
→ 이대로 한번 해볼게요 ㅎㅎ
EC2 (dev-bommeong)
ssh:
RSA private key(.pem):
ssh -i "devBommung.pem" ec2-user@ec2-3-35-80-178.ap-northeast-2.compute.amazonaws.com
devBommung.pem
RDS
url: database-dev-bommeong.cf4iyo2aig60.ap-northeast-2.rds.amazonaws.com
id: root
password: devbommeong
S3:
bucket name: dev-bommung
access-key: AKIA2UC3C5AS35HJUS56
secret-key: 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
ec2 접속 후
java -jar 배포 파일 이름
→ 로그 볼 수 있음
nohup
→ 24시간 돌아가게 할 수 있음, 로그못봄
$source ./deploy.sh → 환경 변수 등록 후 바로 적용
export RDS_PWD=devbommeong
export RDS_URL=jdbc:mariadb://database-dev-bommeong.cf4iyo2aig60.ap-northeast-2.rds.amazonaws.com:3306/bommeong?useUnicode=true&characterEncoding=utf8
export SECRET_KEY=b2bx8dCVcKaQrtD3PyOm4khouC25fqUDu14KM0Gg
export ACCESS_KEY=AKIA2UC3C5AS35HJUS56
export JWT_KEY=9ed821fbd01a1c4cf682aa41230e667399e734def75af23aee818b48b21cb2f8
export BUCKET_NAME=dev-bommung
→ 스크립트에 넣어둘 예정