Skip to content

Commit

Permalink
feat: #115-CICD 결과 자동으로 Slack 전송
Browse files Browse the repository at this point in the history
  • Loading branch information
mclub4 committed May 1, 2024
1 parent 8403907 commit b167c67
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 28 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Deploy Server
on:
push:
branches:
- feautre/be/#115-CICD
- develop-back
- main
permissions:
contents: read

Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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
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()


1 change: 1 addition & 0 deletions back-chat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ ENV RAILS_ENV=production

COPY . ./

ENTRYPOINT ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]
2 changes: 0 additions & 2 deletions back-chat/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
15 changes: 0 additions & 15 deletions back-chat/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -178,9 +165,7 @@ PLATFORMS

DEPENDENCIES
bootsnap (>= 1.4.4)
bunny
byebug
dotenv-rails
jwt
listen (~> 3.3)
mysql2 (~> 0.5)
Expand Down
2 changes: 1 addition & 1 deletion back-chat/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion back-chat/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ services:
TZ : "Asia/Seoul"
ports:
- "3000:3000"
command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public class SpeechService {
@Async
public CompletableFuture<Map<String, Object>> 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());
Expand Down

0 comments on commit b167c67

Please sign in to comment.