-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kwoun Ki Ho <73146678+Chocochip101@users.noreply.github.com> Co-authored-by: leetaehoon <xogns1514@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 김형호 <140397285+HyungHoKim00@users.noreply.github.com> Co-authored-by: cutehumanS2 <oddpinkjadeite@gmail.com> Co-authored-by: HyungHoKim00 <hkim1109@naver.com> Co-authored-by: Kwoun Ki Ho <fingercut3822@gmail.com> Co-authored-by: Leetaehoon <66353672+xogns1514@users.noreply.github.com> Co-authored-by: 최가희 <60508828+cutehumanS2@users.noreply.github.com>
- Loading branch information
1 parent
47cdda2
commit 5631720
Showing
288 changed files
with
15,990 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: BE/DOCS - API Docs Build & Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: be/develop | ||
|
||
permissions: | ||
contents: write | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: backend | ||
|
||
steps: | ||
- name: Checkout Latest | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Build RestDocs with Gradle | ||
run: ./gradlew asciidoctor | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ${{ github.workspace }}/backend/build/docs/asciidoc | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
steps: | ||
- name: Deploy API Docs to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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 |
---|---|---|
@@ -0,0 +1,160 @@ | ||
name: BE/CD - [DEV] Build & Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: be/develop | ||
|
||
jobs: | ||
build: | ||
environment: dev | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: backend | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set timezone to Korea | ||
uses: szenius/set-timezone@v2.0 | ||
with: | ||
timezoneLinux: "Asia/Seoul" | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
cache-write-only: true | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew bootJar | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Get current date and time | ||
id: datetime | ||
run: | | ||
echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT" | ||
- name: Image build and push | ||
run: | | ||
docker build --build-arg PROFILE=dev -t ${{ secrets.DOCKER_REPO_NAME }}/cruru:dev-${{ steps.datetime.outputs.datetime }} --platform linux/arm64 . | ||
docker push ${{ secrets.DOCKER_REPO_NAME }}/cruru:dev-${{ steps.datetime.outputs.datetime }} | ||
- name: Upload docker-compose yaml script to artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docker-compose | ||
path: | | ||
${{ github.workspace }}/backend/docker-compose.dev.yml | ||
${{ github.workspace }}/backend/promtail-config.yml | ||
outputs: | ||
BUILD_VERSION: ${{ steps.datetime.outputs.datetime }} | ||
|
||
deploy: | ||
environment: dev | ||
runs-on: [self-hosted, be-dev] | ||
needs: build | ||
defaults: | ||
run: | ||
working-directory: backend | ||
steps: | ||
- name: Set docker-compose YAML script to runner | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docker-compose | ||
path: ${{ github.workspace }}/backend | ||
|
||
- name: Extract secrets as .env file | ||
run: | | ||
cat <<EOF > .env | ||
# Docker Hub info from Github Secrets | ||
DOCKER_REPO_NAME=${{ secrets.DOCKER_REPO_NAME }} | ||
DOCKER_IMAGE_VERSION_TAG=dev-${{ needs.build.outputs.BUILD_VERSION }} | ||
# DB Configuration secrets info from Github Secrets | ||
MYSQL_DB_NAME=${{ secrets.MYSQL_DB_NAME }} | ||
MYSQL_ROOT_HOST=${{ secrets.MYSQL_ROOT_HOST }} | ||
MYSQL_TIME_ZONE=${{ secrets.MYSQL_TIME_ZONE }} | ||
DB_PORT=${{ secrets.DB_PORT }} | ||
DB_IP_ADDRESS=${{ secrets.DB_IP_ADDRESS }} | ||
DB_URL=${{ secrets.DB_URL }} | ||
DB_USER=${{ secrets.DB_USER }} | ||
DB_PASSWORD=${{ secrets.DB_PASSWORD }} | ||
DDL_AUTO=${{ secrets.DDL_AUTO }} | ||
# DB server configuration secrets info from Github Secrets | ||
APP_IP_ADDRESS=${{ secrets.APP_IP_ADDRESS }} | ||
SERVER_BINDING_PORT=${{ secrets.SERVER_BINDING_PORT }} | ||
SERVER_PORT=${{ secrets.SERVER_PORT }} | ||
SUBNET=${{ secrets.SUBNET }} | ||
# Monitoring configuration server info from Github secrets | ||
MONITORING_INSTANCE_ADDR_LOKI_PORT=${{ secrets.MONITORING_INSTANCE_ADDR_LOKI_PORT }} | ||
MONITORING_BINDING_PORT=${{ secrets.MONITORING_BINDING_PORT }} | ||
MONITORING_PORT=${{ secrets.MONITORING_PORT }} | ||
MONITORING_BASE_PATH=${{ secrets.MONITORING_BASE_PATH }} | ||
# Apply-form post URL generating format | ||
APPLY_POST_BASE_URL=${{ secrets.APPLY_POST_BASE_URL }} | ||
# Email Auth info | ||
EMAIL_USERNAME=${{ secrets.EMAIL_USERNAME }} | ||
EMAIL_PASSWORD=${{ secrets.EMAIL_PASSWORD }} | ||
# Security settings | ||
JWT_TOKEN_SECRET_KEY=${{ secrets.JWT_TOKEN_SECRET_KEY }} | ||
JWT_TOKEN_EXPIRE_CYCLE=${{ secrets.JWT_TOKEN_EXPIRE_CYCLE }} | ||
JWT_SIGN_ALGORITHM=${{ secrets.JWT_SIGN_ALGORITHM }} | ||
# Cookie settings | ||
COOKIE_ACCESS_TOKEN_KEY=${{ secrets.COOKIE_ACCESS_TOKEN_KEY }} | ||
COOKIE_HTTP_ONLY=${{ secrets.COOKIE_HTTP_ONLY }} | ||
COOKIE_SECURE=${{ secrets.COOKIE_SECURE }} | ||
COOKIE_DOMAIN=${{ secrets.COOKIE_DOMAIN }} | ||
COOKIE_PATH=${{ secrets.COOKIE_PATH }} | ||
COOKIE_SAME_SITE=${{ secrets.COOKIE_SAME_SITE }} | ||
COOKIE_MAX_AGE=${{ secrets.COOKIE_MAX_AGE }} | ||
EOF | ||
# - name: Check if MySQL container is running | ||
# id: mysql_running | ||
# run: | | ||
# if [ "$(sudo docker ps -q -f name=database-container)" ]; then | ||
# echo "mysql_running=true" >> $GITHUB_ENV | ||
# else | ||
# echo "mysql_running=false" >> $GITHUB_ENV | ||
# fi | ||
|
||
# - name: Start MySQL container if not running | ||
# if: env.mysql_running == 'false' | ||
# run: | | ||
# sudo docker-compose --env-file .env -f docker-compose.dev.yml up -d database-mysql | ||
|
||
# - name: Stop and remove existing application container | ||
# run: | | ||
# sudo docker-compose -f docker-compose.dev.yml stop application | ||
# sudo docker-compose -f docker-compose.dev.yml rm -f application | ||
|
||
# - name: Run application Server container | ||
# run: | | ||
# sudo docker-compose --env-file .env -f docker-compose.dev.yml up -d application | ||
|
||
- name: Stop and remove existing application container | ||
run: | | ||
sudo docker-compose -f docker-compose.dev.yml down --rmi all | ||
- name: Run application Server container | ||
run: | | ||
sudo docker-compose -f docker-compose.dev.yml up -d |
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 |
---|---|---|
@@ -0,0 +1,140 @@ | ||
name: BE/CD - [PROD] Build & Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: be/release | ||
|
||
jobs: | ||
build: | ||
environment: prod | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: backend | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set timezone to Korea | ||
uses: szenius/set-timezone@v2.0 | ||
with: | ||
timezoneLinux: "Asia/Seoul" | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
cache-write-only: true | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew bootJar | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Get current date and time | ||
id: datetime | ||
run: | | ||
echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT" | ||
- name: Image build and push | ||
run: | | ||
docker build --build-arg PROFILE=prod -t ${{ secrets.DOCKER_REPO_NAME }}/cruru:prod-${{ steps.datetime.outputs.datetime }} --platform linux/arm64 . | ||
docker push ${{ secrets.DOCKER_REPO_NAME }}/cruru:prod-${{ steps.datetime.outputs.datetime }} | ||
- name: Upload docker-compose yaml script to artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docker-compose | ||
path: | | ||
${{ github.workspace }}/backend/docker-compose.prod.yml | ||
${{ github.workspace }}/backend/promtail-config.yml | ||
outputs: | ||
BUILD_VERSION: ${{ steps.datetime.outputs.datetime }} | ||
|
||
deploy: | ||
environment: prod | ||
strategy: | ||
max-parallel: 2 | ||
matrix: | ||
runners: [be-prod-a, be-prod-b] | ||
|
||
runs-on: [self-hosted, '${{ matrix.runners }}'] | ||
needs: build | ||
defaults: | ||
run: | ||
working-directory: backend | ||
steps: | ||
- name: Set docker-compose YAML script to runner | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docker-compose | ||
path: ${{ github.workspace }}/backend | ||
|
||
- name: Extract secrets as .env file | ||
run: | | ||
cat <<EOF > .env | ||
# Docker Hub info from Github Secrets | ||
DOCKER_REPO_NAME=${{ secrets.DOCKER_REPO_NAME }} | ||
DOCKER_IMAGE_VERSION_TAG=prod-${{ needs.build.outputs.BUILD_VERSION }} | ||
# DB Configuration secrets info from Github Secrets | ||
DB_PORT=${{ secrets.DB_PORT }} | ||
DB_IP_ADDRESS=${{ secrets.DB_IP_ADDRESS }} | ||
READ_DB_URL=${{ secrets.READ_DB_URL }} | ||
WRITE_DB_URL=${{ secrets.WRITE_DB_URL }} | ||
DB_USER=${{ secrets.DB_USER }} | ||
DB_PASSWORD=${{ secrets.DB_PASSWORD }} | ||
DDL_AUTO=${{ secrets.DDL_AUTO }} | ||
# DB server configuration secrets info from Github Secrets | ||
APP_IP_ADDRESS=${{ secrets.APP_IP_ADDRESS }} | ||
SERVER_BINDING_PORT=${{ secrets.SERVER_BINDING_PORT }} | ||
SERVER_PORT=${{ secrets.SERVER_PORT }} | ||
SUBNET=${{ secrets.SUBNET }} | ||
# Monitoring configuration server info from Github secrets | ||
MONITORING_INSTANCE_ADDR_LOKI_PORT=${{ secrets.MONITORING_INSTANCE_ADDR_LOKI_PORT }} | ||
MONITORING_BINDING_PORT=${{ secrets.MONITORING_BINDING_PORT }} | ||
MONITORING_PORT=${{ secrets.MONITORING_PORT }} | ||
MONITORING_BASE_PATH=${{ secrets.MONITORING_BASE_PATH }} | ||
# Apply configuration server info from Github secrets | ||
APPLY_POST_BASE_URL=${{ secrets.APPLY_POST_BASE_URL }} | ||
# Email Auth info | ||
EMAIL_USERNAME=${{ secrets.EMAIL_USERNAME }} | ||
EMAIL_PASSWORD=${{ secrets.EMAIL_PASSWORD }} | ||
# Security settings | ||
JWT_TOKEN_SECRET_KEY=${{ secrets.JWT_TOKEN_SECRET_KEY }} | ||
JWT_TOKEN_EXPIRE_CYCLE=${{ secrets.JWT_TOKEN_EXPIRE_CYCLE }} | ||
JWT_SIGN_ALGORITHM=${{ secrets.JWT_SIGN_ALGORITHM }} | ||
# Cookie settings | ||
COOKIE_ACCESS_TOKEN_KEY=${{ secrets.COOKIE_ACCESS_TOKEN_KEY }} | ||
COOKIE_HTTP_ONLY=${{ secrets.COOKIE_HTTP_ONLY }} | ||
COOKIE_SECURE=${{ secrets.COOKIE_SECURE }} | ||
COOKIE_DOMAIN=${{ secrets.COOKIE_DOMAIN }} | ||
COOKIE_PATH=${{ secrets.COOKIE_PATH }} | ||
COOKIE_SAME_SITE=${{ secrets.COOKIE_SAME_SITE }} | ||
COOKIE_MAX_AGE=${{ secrets.COOKIE_MAX_AGE }} | ||
EOF | ||
- name: Stop and remove existing containers | ||
run: | | ||
sudo docker-compose -f docker-compose.prod.yml down --rmi all | ||
- name: Deploy docker container | ||
run: | | ||
sudo docker-compose --env-file .env -f docker-compose.prod.yml up -d |
Oops, something went wrong.