deploy.sh ํ์ผ์์ ๋ค์ ๊ฐ๋ค์ ์ค์ ๊ฐ์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์:
# ์ค์ (์ค์ ๊ฐ์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์ธ์)
EC2_IP="3.34.123.45" # ์ค์ EC2 ํผ๋ธ๋ฆญ IP
GITHUB_REPO="https://github.com/yourusername/bitcoin-center-seoul.git" # ์ค์ GitHub ์ ์ฅ์ URL
KEY_PATH="~/.ssh/bitcoin-center-seoul-key" # SSH ํค ๊ฒฝ๋ก# SSH ํค๊ฐ ์๋์ง ํ์ธ
ls -la ~/.ssh/bitcoin-center-seoul-key
# ์๋ค๋ฉด ์์ฑ
ssh-keygen -t rsa -b 4096 -f ~/.ssh/bitcoin-center-seoul-key# 1. ์์ค์ฝ๋ ์์ ํ GitHub์ push
git add .
git commit -m "์
๋ฐ์ดํธ ๋ด์ฉ"
git push origin main
# 2. ๋ฐฐํฌ ์คํ
./deploy.sh- โ ์ค์ ํ์ธ - EC2 IP์ GitHub URL ๊ฒ์ฆ
- โ EC2 ์ฐ๊ฒฐ ํ ์คํธ - SSH ์ฐ๊ฒฐ ํ์ธ
- โ GitHub์์ ์ต์ ์ฝ๋ pull - main ๋ธ๋์น์์ ์ต์ ์ฝ๋ ๊ฐ์ ธ์ค๊ธฐ
- โ ์์กด์ฑ ์ค์น - npm install
- โ ํ๋ก๋์ ๋น๋ - npm run build
- โ ์๋น์ค ์ฌ์์ - PM2๋ก ์ ํ๋ฆฌ์ผ์ด์ ์ฌ์์
- โ ์ํ ํ์ธ - ์๋น์ค ๋ฐ ์น์ฌ์ดํธ ์ ์ ํ ์คํธ
# SSH ํค ๊ถํ ํ์ธ
chmod 600 ~/.ssh/bitcoin-center-seoul-key
# EC2 ๋ณด์ ๊ทธ๋ฃน์์ ํฌํธ 22 ์ด๋ ค์๋์ง ํ์ธ# EC2์์ ์ง์ ํ์ธ
ssh -i ~/.ssh/bitcoin-center-seoul-key ubuntu@YOUR_EC2_IP
cd /var/www/bitcoin-center-seoul
npm run build# PM2 ์ํ ํ์ธ
ssh -i ~/.ssh/bitcoin-center-seoul-key ubuntu@YOUR_EC2_IP 'pm2 status'
# PM2 ๋ก๊ทธ ํ์ธ
ssh -i ~/.ssh/bitcoin-center-seoul-key ubuntu@YOUR_EC2_IP 'pm2 logs bitcoin-center-seoul'# ์๋น์ค ์ํ ํ์ธ
ssh -i ~/.ssh/bitcoin-center-seoul-key ubuntu@YOUR_EC2_IP 'pm2 status'
# ๋ก๊ทธ ์ค์๊ฐ ํ์ธ
ssh -i ~/.ssh/bitcoin-center-seoul-key ubuntu@YOUR_EC2_IP 'pm2 logs bitcoin-center-seoul --follow'
# Nginx ์ฌ์์
ssh -i ~/.ssh/bitcoin-center-seoul-key ubuntu@YOUR_EC2_IP 'sudo systemctl restart nginx'
# ์น์ฌ์ดํธ ์ ์ ํ
์คํธ
curl -I https://bitcoincenterseoul.com- HTTPS: https://bitcoincenterseoul.com
- WWW: https://www.bitcoincenterseoul.com
- HTTP: http://YOUR_EC2_IP (์๋์ผ๋ก HTTPS๋ก ๋ฆฌ๋ค์ด๋ ํธ)