Skip to content

Commit

Permalink
Create content/nginx/cupick.ddns.net 를 서버와 동기화
Browse files Browse the repository at this point in the history
  • Loading branch information
unchaptered committed Oct 2, 2022
1 parent 0b167b6 commit 9823d77
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: sh ecosystem.config.json.sh ${{ secrets.NODE_ENV }} ${{ secrets.PORT }} ${{ secrets.SALT }} ${{ secrets.CORS_URL_ONE_WITHOUT_PORT }} ${{ secrets.CORS_URL_TWO_WITHOUT_PORT }} ${{ secrets.CORS_URL_THREE_WITHOUT_PORT }} ${{ secrets.CORS_URL_FOUR_WITHOUT_PORT }} ${{ secrets.FROTN_REDIRECT_URL_WITHOUT_PORT }} ${{ secrets.SERVER_URL_WITH_PORT }} ${{ secrets.JWT_ACCESS_EXPIRED_IN }} ${{ secrets.JWT_REFRESH_EXPIRED_IN }} ${{ secrets.JWT_VERIFY_EXPIRED_IN }} ${{ secrets.JWT_RESET_EXPIRED_IN }} ${{ secrets.JWT_HASH_ALGOIRHTM }} ${{ secrets.HASH_PASSPHRASE }} ${{ secrets.MYSQL_HOST }} ${{ secrets.MYSQL_USER }} ${{ secrets.MYSQL_DATABASE }} ${{ secrets.MYSQL_PASSWORD }} ${{ secrets.MYSQL_CONNECTION_LIMIT }} ${{ secrets.S3_ACCESS_KEY }} ${{ secrets.S3_SECRET_KEY }} ${{ secrets.BUCKET }} ${{ secrets.REGION }} ${{ secrets.SES_API_VERSION }} ${{ secrets.SES_API_REGION }} ${{ secrets.SES_ACCESS_KEY }} ${{ secrets.SES_SECRET_KEY }} ${{ secrets.SES_SENDER_EMAIL }} ${{ secrets.MYSQL_HOST }}

- name: Zip file
run: zip -r ${{github.event.pull_request.timestamp}}_server.zip .github/workflows ./scripts ./jest ./src ./test ./appspec.yml ./gitignore ./package.json ./package-lock.json ./tsconfig.build.json ./tsconfig.json ./jest.config.json ./ecosystem.config.json
run: zip -r ${{github.event.pull_request.timestamp}}_server.zip .github/workflows ./scripts ./content ./jest ./src ./test ./appspec.yml ./gitignore ./package.json ./package-lock.json ./tsconfig.build.json ./tsconfig.json ./jest.config.json ./ecosystem.config.json

- name: AWS configure credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
2 changes: 1 addition & 1 deletion appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:

hooks:
AfterInstall:
- location: scripts/after-deploy.sh
- location: scripts/after-install.sh
timeout: 300
runas: ubuntu
# runas는 사용자 이름
45 changes: 45 additions & 0 deletions content/nginx/cupick.ddns.net
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
server {

server_name cupick.ddns.net;

location / {

# Connect to ReadReplica RDS
if ($request_method = GET) {

proxy_pass http://127.0.0.1:3001;
}

# Connect to Origin RDS
proxy_pass http://127.0.0.1:3000;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot

ssl_certificate /etc/letsencrypt/live/cupick.ddns.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cupick.ddns.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = cupick.ddns.net) {
return 301 https://$host$request_uri;
} # managed by Certbot



listen 80;
listen [::]:80;

server_name cupick.ddns.net;

#location / {
# return 301 https://cupick.ddns.net$request_uri;
#}
return 404; # managed by Certbot


}
3 changes: 3 additions & 0 deletions scripts/after-deploy.sh → scripts/after-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ REPOSITORY=/home/ubuntu/project

cd $REPOSITORY

sudo cp content/nginx/cupick.ddns.net /etc/nginx/sites-enabled/cupick.ddns.net
sudo service nginx reload

sudo npm install

# sudo pm2 kill
Expand Down

0 comments on commit 9823d77

Please sign in to comment.