From b167c678d5c956ba4ebc1fe18ff03366049033a5 Mon Sep 17 00:00:00 2001 From: mclub4 Date: Thu, 2 May 2024 01:53:39 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#115-CICD=20=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=EC=9C=BC=EB=A1=9C=20Slack=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 40 +++++++++++++++---- back-chat/Dockerfile | 1 + back-chat/Gemfile | 2 - back-chat/Gemfile.lock | 15 ------- back-chat/config/environments/production.rb | 2 +- back-chat/docker-compose.yml | 1 - .../domain/speech/service/SpeechService.java | 2 - 7 files changed, 35 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 792f8c4076..aa8726ed9e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,8 @@ name: Deploy Server on: push: branches: - - feautre/be/#115-CICD + - develop-back + - main permissions: contents: read @@ -36,8 +37,10 @@ jobs: echo REDIS_PORT=${{ secrets.REDIS_PORT }} >> .env echo S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} >> .env echo S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} >> .env + echo S3_SECRET_KEY=${{ secrets.SECRET_KEY_BASE }} >> .env + echo S3_SECRET_KEY=${{ secrets.SERVER_NAME }} >> .env - - name: Login to DockerHub + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -70,22 +73,28 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - - name: Copy docker-compose.yaml to EC2 + - name: Copy .env to EC2 uses: appleboy/scp-action@master with: host: ${{ secrets.AWS_HOST }} username: ubuntu key: ${{ secrets.AWS_KEY }} - source: "/github/workspace/back/docker-compose.yml" + password: ${{ secrets.AWS_FINGERPRINT }} + source: "/github/workspace/.env" target: "/home/ubuntu/capstone" - - name: Copy .env to EC2 + deploy: + runs-on : ubuntu-latest + + steps: + - name: Copy docker-compose.yaml to EC2 uses: appleboy/scp-action@master with: host: ${{ secrets.AWS_HOST }} username: ubuntu key: ${{ secrets.AWS_KEY }} - source: "/github/workspace/.env" + password: ${{ secrets.AWS_FINGERPRINT }} + source: "/github/workspace/back/docker-compose.yml" target: "/home/ubuntu/capstone" - name: executing remote ssh commands using password @@ -104,4 +113,21 @@ jobs: sudo docker pull ${{ secrets.DOCKER_REPO }}/ruby:latest sudo docker-compose -f capstone/docker-compose.yml up -d - sudo docker image prune -f \ No newline at end of file + sudo docker image prune -f + + + slack-send: + runs-on: ubuntu-latest + + steps: + - name: action-slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + author_name: PetBuddy Github + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: always() + + \ No newline at end of file diff --git a/back-chat/Dockerfile b/back-chat/Dockerfile index 05f5c57b3f..a6e2c40c42 100644 --- a/back-chat/Dockerfile +++ b/back-chat/Dockerfile @@ -13,3 +13,4 @@ ENV RAILS_ENV=production COPY . ./ +ENTRYPOINT ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"] diff --git a/back-chat/Gemfile b/back-chat/Gemfile index 17202719b2..6860eadbb0 100644 --- a/back-chat/Gemfile +++ b/back-chat/Gemfile @@ -40,6 +40,4 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] -gem 'dotenv-rails' - gem 'jwt' \ No newline at end of file diff --git a/back-chat/Gemfile.lock b/back-chat/Gemfile.lock index 15ddb640ea..ca4089e21a 100644 --- a/back-chat/Gemfile.lock +++ b/back-chat/Gemfile.lock @@ -60,22 +60,14 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - amq-protocol (2.3.2) base64 (0.2.0) bootsnap (1.18.3) msgpack (~> 1.2) builder (3.2.4) - bunny (2.22.0) - amq-protocol (~> 2.3, >= 2.3.1) - sorted_set (~> 1, >= 1.0.2) byebug (11.1.3) concurrent-ruby (1.2.3) crass (1.0.6) date (3.3.4) - dotenv (3.1.0) - dotenv-rails (3.1.0) - dotenv (= 3.1.0) - railties (>= 6.1) erubi (1.12.0) ffi (1.16.3) globalid (1.2.1) @@ -151,11 +143,6 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rbtree (0.4.6) - set (1.1.0) - sorted_set (1.0.3) - rbtree - set (~> 1.0) spring (4.2.1) sprockets (4.2.1) concurrent-ruby (~> 1.0) @@ -178,9 +165,7 @@ PLATFORMS DEPENDENCIES bootsnap (>= 1.4.4) - bunny byebug - dotenv-rails jwt listen (~> 3.3) mysql2 (~> 0.5) diff --git a/back-chat/config/environments/production.rb b/back-chat/config/environments/production.rb index 3bfc23fd8c..c1ebbc6482 100644 --- a/back-chat/config/environments/production.rb +++ b/back-chat/config/environments/production.rb @@ -17,7 +17,7 @@ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true + config.secret_key_base = ENV["SECRET_KEY_BASE"] # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. diff --git a/back-chat/docker-compose.yml b/back-chat/docker-compose.yml index 157540ab14..23f8c677d8 100644 --- a/back-chat/docker-compose.yml +++ b/back-chat/docker-compose.yml @@ -14,5 +14,4 @@ services: TZ : "Asia/Seoul" ports: - "3000:3000" - command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"] diff --git a/back/src/main/java/com/example/capstone/domain/speech/service/SpeechService.java b/back/src/main/java/com/example/capstone/domain/speech/service/SpeechService.java index ffa735c22e..6618ca344f 100644 --- a/back/src/main/java/com/example/capstone/domain/speech/service/SpeechService.java +++ b/back/src/main/java/com/example/capstone/domain/speech/service/SpeechService.java @@ -37,8 +37,6 @@ public class SpeechService { @Async public CompletableFuture> pronunciation(String compareText, MultipartFile file) throws InterruptedException, ExecutionException, IOException { SpeechConfig speechConfig = SpeechConfig.fromSubscription(speechKey, speechRegion); - speechConfig.setProperty(PropertyId.Speech_LogFilename, "/container/path/to/logs/speech_sdk.log"); - System.out.println(file); WavStream wavStream = new WavStream(file.getInputStream()); PullAudioInputStream inputStream = PullAudioInputStream.createPullStream(wavStream, wavStream.getFormat());