Skip to content

Commit

Permalink
Merge pull request #38 from studio-recoding/feat-main-api
Browse files Browse the repository at this point in the history
[🚀feat] docker의 포트포워딩을 80:8080으로 변경
  • Loading branch information
JeonHaeseung authored Apr 14, 2024
2 parents 253505f + b0280ad commit df216c6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ jobs:
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -q)
docker pull jeonhaeseung/ness-server-dev:dev
docker run -d --name backend-server -p 8080:8080 --restart unless-stopped jeonhaeseung/ness-server-dev:dev
docker run -d --name backend-server -p 80:8080 --restart unless-stopped jeonhaeseung/ness-server-dev:dev
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ out/

### Secrets ###
application-dev.yml
application-prod.yml
application-prod.yml

## etc ###
docker-compose.yml
2 changes: 2 additions & 0 deletions config/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx:1.21.4
COPY ./default.conf /etc/nginx/conf.d/default.conf
17 changes: 17 additions & 0 deletions config/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server {
listen 80;
server_name nessplanning.com;

if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}

location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
}
11 changes: 11 additions & 0 deletions config/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ then
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -a -G docker $(whoami)
fi

if ! type docker-compose > /dev/null
then
echo "docker does not exist"
echo "Start installing docker"
sudo dnf install -y libxcrypt-compat
echo "docker-compose does not exist"
echo "Start installing docker-compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public JwtTokenProvider jwtTokenProvider() {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
//configuration.addAllowedOrigin("*"); // 모든 오리진 허용-주의! 나중에 FE와 BE에 대해서만 열어주기
configuration.addAllowedOrigin("http://localhost:3000");
configuration.addAllowedOrigin("http://localhost:8080");
//configuration.addAllowedOriginPattern("https://*.nessplanning.com");
//configuration.addAllowedOriginPattern("https://*.nessplanning.com:3000");
//configuration.addAllowedOriginPattern("https://api.nessplanning.com:8080");
configuration.addAllowedOriginPattern("https://*.nessplanning.com");
configuration.addAllowedOriginPattern("https://*.nessplanning.com:8080");
configuration.addAllowedOriginPattern("https://*.nessplanning.com:3000");
configuration.addAllowedOriginPattern("https://api.nessplanning.com:8080");
configuration.addAllowedMethod("*"); //모든 Method 허용(POST, GET, ...)
configuration.addAllowedHeader("*"); //모든 Header 허용
configuration.setMaxAge(Duration.ofSeconds(3600)); //브라우저가 응답을 캐싱해도 되는 시간(1시간)
Expand Down

0 comments on commit df216c6

Please sign in to comment.