-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from LminWoo99/develop
Develop
- Loading branch information
Showing
4 changed files
with
145 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
#name: CD | ||
# | ||
#on: | ||
# push: | ||
# branches: [ "master"] | ||
# pull_request: | ||
# branches: [ "master" ] | ||
# | ||
#permissions: | ||
# contents: read | ||
# | ||
#jobs: | ||
# build: | ||
# | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Set up JDK 11 | ||
# uses: actions/setup-java@v3 | ||
# with: | ||
# java-version: '11' | ||
# distribution: 'temurin' | ||
# | ||
# | ||
# - name: make application-prod.yml | ||
# run: | | ||
# cd ./src/main/resources | ||
# touch ./application.yml | ||
# echo "${{ secrets.APPLICATION_PROD }}" > ./application.yml | ||
# - name: make application-prod.yaml | ||
# run: | | ||
# cd ./src/main/resources | ||
# touch ./application.yaml | ||
# echo "${{ secrets.APPLICATION_PRO }}" > ./application.yaml | ||
# | ||
# | ||
# - name: Grant execute permission for gradlew | ||
# run: chmod +x gradlew | ||
# | ||
# - name: Build with Gradle | ||
# run: ./gradlew build -x test | ||
# | ||
# - name: Docker build | ||
# run: | | ||
# docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
# docker buildx build --push --platform linux/amd64 -t ${{ secrets.DOCKER_USERNAME }}/chat . | ||
# # docker tag chat ${{ secrets.DOCKER_USERNAME }}/chat | ||
# docker push ${{ secrets.DOCKER_USERNAME }}/chat | ||
# | ||
# - name: Deploy | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.HOST }} | ||
# username: ec2-user | ||
# key: ${{ secrets.PRIVATE_KEY }} # pem 키 | ||
# script: | | ||
# docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
# docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
# docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
# docker-compose up -d | ||
# docker image prune -a -f | ||
# | ||
# - name: Deploy to Instance | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.HOST }} | ||
# username: ec2-user | ||
# key: ${{ secrets.PRIVATE_KEY }} | ||
# | ||
# script: | | ||
# docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
# docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
# docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
# docker-compose up -d | ||
# docker image prune -a -f | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: [ "master"] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
|
||
- name: make application-prod.yml | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application.yml | ||
echo "${{ secrets.APPLICATION_PROD }}" > ./application.yml | ||
- name: make application-prod.yaml | ||
run: | | ||
cd ./src/main/resources | ||
touch ./application.yaml | ||
echo "${{ secrets.APPLICATION_PRO }}" > ./application.yaml | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
- name: Docker build | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker buildx build --push --platform linux/amd64 -t ${{ secrets.DOCKER_USERNAME }}/chat . | ||
# docker tag chat ${{ secrets.DOCKER_USERNAME }}/chat | ||
docker push ${{ secrets.DOCKER_USERNAME }}/chat | ||
- name: Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ec2-user | ||
key: ${{ secrets.PRIVATE_KEY }} # pem 키 | ||
script: | | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
docker-compose up -d | ||
docker image prune -a -f | ||
- name: Deploy to Instance | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ec2-user | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
|
||
script: | | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/chat | ||
docker stop $(docker ps -a -q | grep -v $(docker-compose ps -q kurento)) # Kurento 서비스를 제외한 다른 모든 컨테이너 중지 | ||
docker rm $(docker ps --filter 'status=exited' -a -q) # 종료된(exited) 상태의 모든 컨테이너 삭제 | ||
docker-compose up -d | ||
docker image prune -a -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 46 additions & 46 deletions
92
src/main/java/com/example/VideoChatting/config/SslConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
//package com.example.VideoChatting.config; | ||
// | ||
//import org.apache.catalina.Context; | ||
//import org.apache.catalina.connector.Connector; | ||
//import org.apache.tomcat.util.descriptor.web.SecurityCollection; | ||
//import org.apache.tomcat.util.descriptor.web.SecurityConstraint; | ||
//import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | ||
//import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | ||
//import org.springframework.context.annotation.Bean; | ||
//import org.springframework.context.annotation.Configuration; | ||
// | ||
//@Configuration | ||
//public class SslConfig { | ||
// | ||
// @Bean | ||
// public ServletWebServerFactory servletContainer() { | ||
// CustomTomcatServletWebServerFactory tomcat = new CustomTomcatServletWebServerFactory(); | ||
// | ||
// // Add HTTP to HTTPS redirect : http 로 요청이 들어오면 https 로 리다이렉트 | ||
// tomcat.addAdditionalTomcatConnectors(httpToHttpsRedirectConnector()); | ||
// | ||
// return tomcat; | ||
// } | ||
// | ||
// static class CustomTomcatServletWebServerFactory extends TomcatServletWebServerFactory { | ||
// @Override | ||
// protected void postProcessContext(Context context) { | ||
// SecurityConstraint securityConstraint = new SecurityConstraint(); | ||
// securityConstraint.setUserConstraint("CONFIDENTIAL"); | ||
// SecurityCollection collection = new SecurityCollection(); | ||
// collection.addPattern("/*"); | ||
// securityConstraint.addCollection(collection); | ||
// context.addConstraint(securityConstraint); | ||
// } | ||
// } | ||
// | ||
// private Connector httpToHttpsRedirectConnector() { | ||
// Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); | ||
// connector.setScheme("http"); | ||
// connector.setPort(8080); | ||
// connector.setSecure(false); | ||
// connector.setRedirectPort(8443); | ||
// return connector; | ||
// } | ||
// | ||
//} | ||
package com.example.VideoChatting.config; | ||
|
||
import org.apache.catalina.Context; | ||
import org.apache.catalina.connector.Connector; | ||
import org.apache.tomcat.util.descriptor.web.SecurityCollection; | ||
import org.apache.tomcat.util.descriptor.web.SecurityConstraint; | ||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; | ||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SslConfig { | ||
|
||
@Bean | ||
public ServletWebServerFactory servletContainer() { | ||
CustomTomcatServletWebServerFactory tomcat = new CustomTomcatServletWebServerFactory(); | ||
|
||
// Add HTTP to HTTPS redirect : http 로 요청이 들어오면 https 로 리다이렉트 | ||
tomcat.addAdditionalTomcatConnectors(httpToHttpsRedirectConnector()); | ||
|
||
return tomcat; | ||
} | ||
|
||
static class CustomTomcatServletWebServerFactory extends TomcatServletWebServerFactory { | ||
@Override | ||
protected void postProcessContext(Context context) { | ||
SecurityConstraint securityConstraint = new SecurityConstraint(); | ||
securityConstraint.setUserConstraint("CONFIDENTIAL"); | ||
SecurityCollection collection = new SecurityCollection(); | ||
collection.addPattern("/*"); | ||
securityConstraint.addCollection(collection); | ||
context.addConstraint(securityConstraint); | ||
} | ||
} | ||
|
||
private Connector httpToHttpsRedirectConnector() { | ||
Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); | ||
connector.setScheme("http"); | ||
connector.setPort(8080); | ||
connector.setSecure(false); | ||
connector.setRedirectPort(8443); | ||
return connector; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters