diff --git a/.github/workflows/cd-prod.yml b/.github/workflows/cd-prod.yml index cc9f1d4b..5d68986b 100644 --- a/.github/workflows/cd-prod.yml +++ b/.github/workflows/cd-prod.yml @@ -36,8 +36,8 @@ jobs: context: . push: true tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/spot-backend:prod - ${{ secrets.DOCKERHUB_USERNAME }}/spot-backend:${{ github.sha }} + ${{ secrets.DOCKERHUB_USERNAME }}/realmatch-backend:prod + ${{ secrets.DOCKERHUB_USERNAME }}/realmatch-backend:${{ github.sha }} - name: Deploy uses: appleboy/ssh-action@v1.0.3 @@ -46,7 +46,17 @@ jobs: username: ubuntu key: ${{ secrets.PROD_SERVER_SSH_KEY }} script: | - cd /home/ubuntu/spot + cd /home/ubuntu/realmatch git pull origin main + docker compose pull docker compose up -d + + echo "Waiting for app to start..." + sleep 10 + + if ! docker compose ps | grep "Up"; then + echo "❌ Container is not running" + docker compose logs + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index ce2c3228..5b5dbb93 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -9,19 +9,21 @@ jobs: runs-on: ubuntu-latest services: - postgres: - image: postgres:16 + mysql: + image: mysql:8.0 env: - POSTGRES_DB: myapp_db - POSTGRES_USER: admin - POSTGRES_PASSWORD: secret + MYSQL_DATABASE: test_db + MYSQL_USER: test_user + MYSQL_PASSWORD: test + MYSQL_ROOT_PASSWORD: test_root ports: - - 5432:5432 + - 3306:3306 options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 + --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -ptest_root" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + env: SPRING_PROFILES_ACTIVE: test diff --git a/build.gradle b/build.gradle index 8f359a16..f490a7e2 100644 --- a/build.gradle +++ b/build.gradle @@ -55,9 +55,6 @@ dependencies { // swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.9' - - // postgresql (CI test 용) - runtimeOnly 'org.postgresql:postgresql' } tasks.named('test') { diff --git a/src/main/java/com/example/RealMatch/global/config/SecurityConfig.java b/src/main/java/com/example/RealMatch/global/config/SecurityConfig.java index 1f558a40..c1bfe019 100644 --- a/src/main/java/com/example/RealMatch/global/config/SecurityConfig.java +++ b/src/main/java/com/example/RealMatch/global/config/SecurityConfig.java @@ -26,12 +26,12 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private static final String[] PERMIT_ALL_URL_ARRAY = { - "/api/v1/test", + "/api/test", "/v3/api-docs/**", "/swagger-ui/**", "/swagger-resources/**", "/swagger-ui.html" }; private static final String[] REQUEST_AUTHENTICATED_ARRAY = { - "/api/v1/test-auth" + "/api/test-auth" }; @Value("${cors.allowed-origin}") diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 83a0b6ef..074981e3 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -9,7 +9,7 @@ server: spring: application: - name: Spot + name: Realmatch activate: on-profile: prod diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 41ce166c..d2881f5b 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -9,13 +9,13 @@ server: spring: application: - name: Spot + name: Realmatch datasource: - url: jdbc:postgresql://localhost:5432/myapp_db - username: admin - password: secret - driver-class-name: org.postgresql.Driver + url: jdbc:mysql://localhost:3306/test_db + username: test_user + password: test + driver-class-name: com.mysql.cj.jdbc.Driver hikari: maximum-pool-size: 10 minimum-idle: 5 @@ -28,7 +28,7 @@ spring: ddl-auto: none properties: hibernate: - dialect: org.hibernate.dialect.PostgreSQLDialect + dialect: org.hibernate.dialect.MySQL8Dialect format_sql: true show-sql: false