-
Notifications
You must be signed in to change notification settings - Fork 2
[#47] Railway 배포 자동화 설정 #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jun108059
wants to merge
27
commits into
Nexters:main
Choose a base branch
from
jun108059:develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
761d3dd
🐛 Fix: Railway CLI 액션을 npm 설치 방식으로 변경
jun108059 2e6fa85
🐛 Fix: TestCode 수정
jun108059 849587a
🐛 Fix: railway login추가
jun108059 23faea3
🐛 Fix: railway token 수정
jun108059 799c11e
🐛 Fix: railway login 다시 추가
jun108059 c74c7b6
🐛 Fix: Dockerfile로 빌드하도록 수정
jun108059 abad735
🐛 Fix: project argument 제거
jun108059 4ef3af5
🐛 Fix: service id 수정
jun108059 f0502b6
🐛 Fix: TOKEN env 수정
jun108059 93fd89b
⚙️Add: ADMIN 배포를 위한 github action
jun108059 6c80307
🐛 Fix: env 설정 변경
jun108059 c2a3422
🐛 Fix: node nev 설정과 빌드 에러 해결
jun108059 c41e44d
🐛 Fix: node nev 설정과 빌드 에러 해결
jun108059 4450bd9
⚙️ Update: 자동 배포 제거(수동 배포)
jun108059 e943040
⚙️ Update: Production 환경 workflow 수정
jun108059 199e806
⚙️ Update: Swagger server URL 환경별 적용 추가
jun108059 7a7220f
🐛 Fix: application.yml 설정
jun108059 56e41a6
✨ Add: 어드민 기능 - 스키장 슬포르 업데이트 기능 추가
jun108059 d3dcf55
✨ Add: 어드민 기능 - 스키장 슬포르 업데이트 기능 추가
jun108059 05b9669
Merge pull request #3 from jun108059/feature/admin-slope-update
jun108059 d8f347a
🐛 Fix: page 무한 로딩 에러 수정
jun108059 a5a0cb0
⚙️ Update: App version 강제 업데이트 3.1.2
jun108059 bcdc6d4
Merge pull request #5 from jun108059/feature/app-version-up
jun108059 597e276
Merge pull request #4 from jun108059/feature/admin-slope-update
jun108059 043baa1
✨ 웹캠 조회/수정 어드민 추가
jun108059 1ed3d25
✨ 웹캠 조회/수정 어드민 추가
jun108059 dd2132f
Merge pull request #7 from jun108059/feature/admin-webcam-update
jun108059 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Deploy Frontend to Development | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: deploy-frontend-dev-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| deploy-frontend-dev: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
| cache-dependency-path: 'weski-admin/package-lock.json' | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: weski-admin | ||
| run: npm ci | ||
|
|
||
| - name: Type check | ||
| working-directory: weski-admin | ||
| run: npm run type-check | ||
|
|
||
| - name: Lint | ||
| working-directory: weski-admin | ||
| run: npm run lint | ||
|
|
||
| - name: Build application | ||
| working-directory: weski-admin | ||
| run: npm run build | ||
| env: | ||
| NEXT_PUBLIC_API_URL: ${{ secrets.BACKEND_URL_DEV }} | ||
| RAILWAY_ENVIRONMENT: development | ||
| NODE_ENV: production | ||
|
|
||
| - name: Install Railway CLI | ||
| run: npm install -g @railway/cli | ||
|
|
||
| - name: Deploy to Railway Dev | ||
| working-directory: weski-admin | ||
| env: | ||
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_DEV }} | ||
| run: railway up --detach --service ${{ secrets.RAILWAY_SERVICE_ID_FRONTEND_DEV }} |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Deploy Frontend to Production | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: deploy-frontend-prod-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| deploy-frontend-prod: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
| cache-dependency-path: 'weski-admin/package-lock.json' | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: weski-admin | ||
| run: npm ci | ||
|
|
||
| - name: Type check | ||
| working-directory: weski-admin | ||
| run: npm run type-check | ||
|
|
||
| - name: Lint | ||
| working-directory: weski-admin | ||
| run: npm run lint | ||
|
|
||
| - name: Build application | ||
| working-directory: weski-admin | ||
| run: npm run build | ||
| env: | ||
| NEXT_PUBLIC_API_URL: ${{ secrets.BACKEND_URL_PROD }} | ||
| RAILWAY_ENVIRONMENT: production | ||
| NODE_ENV: production | ||
|
|
||
| - name: Install Railway CLI | ||
| run: npm install -g @railway/cli | ||
|
|
||
| - name: Deploy to Railway Prod | ||
| working-directory: weski-admin | ||
| env: | ||
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }} | ||
| run: railway up --detach --service ${{ secrets.RAILWAY_SERVICE_ID_FRONTEND_PROD }} |
This file contains hidden or 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,16 +1,18 @@ | ||
| name: Deploy to Production | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
||
|
|
||
| concurrency: | ||
| group: deploy-weski-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| deploy-prod: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Check out code | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
|
|
@@ -19,28 +21,18 @@ jobs: | |
| java-version: '17' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Cache Gradle dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
| - name: Setup Gradle (cache) | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Run tests | ||
| run: ./gradlew test | ||
|
|
||
| - name: Build application | ||
| run: ./gradlew clean build -x test | ||
| - name: Install Railway CLI | ||
| run: npm install -g @railway/cli | ||
|
|
||
| - name: Deploy to Railway Prod | ||
| uses: railwayapp/cli@v3 | ||
| with: | ||
| command: up --service WeSki-server | ||
| env: | ||
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_PROD_TOKEN }} | ||
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }} | ||
| SPRING_PROFILES_ACTIVE: prod | ||
| SWAGGER_SERVER_URL_PROD: ${{ secrets.SWAGGER_SERVER_URL_PROD }} | ||
| run: railway up --detach --service ${{ secrets.RAILWAY_SERVICE_ID_PROD }} | ||
This file contains hidden or 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,15 +1,32 @@ | ||
| FROM openjdk:17-jdk-slim | ||
| ## ===== Build stage ===== | ||
| FROM gradle:8.9-jdk17-alpine AS build | ||
| WORKDIR /workspace | ||
|
|
||
| # tzdata 패키지 설치 및 시간대 설정 | ||
| RUN apt-get update && apt-get install -y tzdata && \ | ||
| ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime && \ | ||
| echo "Asia/Seoul" > /etc/timezone | ||
| # Gradle 캐시 최적화를 위해 래퍼/설정 먼저 복사 | ||
| COPY gradle gradle | ||
| COPY gradlew settings.gradle.kts build.gradle.kts ./ | ||
| RUN chmod +x gradlew | ||
|
|
||
| EXPOSE 8080 | ||
| # 소스 복사 후 빌드 (테스트는 CI에서 돌리므로 -x test) | ||
| COPY src ./src | ||
| RUN ./gradlew --no-daemon clean bootJar -x test | ||
|
|
||
| ## ===== Runtime stage ===== | ||
| FROM eclipse-temurin:17-jre-alpine | ||
|
|
||
| RUN addgroup -S spring && adduser -S spring -G spring | ||
| USER spring | ||
|
|
||
| ARG JAR_FILE=build/libs/*.jar | ||
| COPY ${JAR_FILE} weski-app.jar | ||
| WORKDIR /app | ||
| COPY --from=build /workspace/build/libs/*.jar /app/app.jar | ||
|
|
||
| # 런타임 환경 | ||
| ENV TZ=Asia/Seoul \ | ||
| JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -XX:+UseG1GC" \ | ||
| SPRING_PROFILES_ACTIVE=dev | ||
|
|
||
| # 실제 개방 포트는 Railway가 PORT로 지정할 수 있음 | ||
| EXPOSE 8080 | ||
|
|
||
| CMD java -Dserver.port=${PORT:-8080} \ | ||
| -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE:-prod} \ | ||
| -jar /weski-app.jar | ||
| # 별도 스크립트 없이 바로 실행 | ||
| ENTRYPOINT [ "sh", "-c", "exec java $JAVA_OPTS -jar /app/app.jar" ] |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow_dispatch trigger should include input parameters or documentation explaining when and how this manual deployment should be used, especially since it replaced automatic develop branch deployment.