feat: 레디스 연결 #158
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
#name: Bottles ELK Deploy Workflow | |
# | |
#on: | |
# push: | |
# branches: | |
# - develop | |
# | |
#jobs: | |
# deploy: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# | |
# - name: Setup JDK 17 | |
# uses: actions/setup-java@v3 | |
# with: | |
# distribution: 'corretto' | |
# java-version: '17' | |
# | |
# - name: Cache Gradle | |
# uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.gradle/caches | |
# ~/.gradle/wrapper | |
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
# restore-keys: | | |
# ${{ runner.os }}-gradle- | |
# | |
# - name: Grant execute permission for gradlew | |
# run: chmod +x gradlew | |
# shell: bash | |
# | |
# - name: Build with gradle | |
# run: ./gradlew clean build | |
# shell: bash | |
# | |
# - name: Get Github Actions IP | |
# id: ip | |
# uses: haythem/[email protected] | |
# | |
# - name: Configure AWS Credentials | |
# uses: aws-actions/configure-aws-credentials@v1 | |
# with: | |
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# aws-region: ap-northeast-2 | |
# | |
# - name: Add Github Actions IP to Security group | |
# run: | | |
# aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | |
# | |
# - name: Transfer file using SCP | |
# env: | |
# SERVER_HOST: ${{ secrets.ELK_SERVER_HOST }} | |
# SERVER_USER_NAME: ${{ secrets.ELK_SERVER_USER_NAME }} | |
# SERVER_PRIVATE_KEY: ${{ secrets.ELK_SERVER_PRIVATE_KEY }} | |
# run: | | |
# printf "%s" "$SERVER_PRIVATE_KEY" > private_key.pem | |
# chmod 600 private_key.pem | |
# scp -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i private_key.pem ./elk/docker-compose.yml $SERVER_USER_NAME@$SERVER_HOST:/home/$SERVER_USER_NAME/docker | |
# scp -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i private_key.pem ./elk/kibana/kibana.yml $SERVER_USER_NAME@$SERVER_HOST:/home/$SERVER_USER_NAME/elk/kibana | |
# scp -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i private_key.pem ./elk/logstash/pipeline/logstash.conf $SERVER_USER_NAME@$SERVER_HOST:/home/$SERVER_USER_NAME/elk/logstash | |
# scp -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no -i private_key.pem ./elk/logstash/logstash.yml $SERVER_USER_NAME@$SERVER_HOST:/home/$SERVER_USER_NAME/elk/logstash | |
# rm private_key.pem | |
# | |
# - name: Deploy to server | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.ELK_SERVER_HOST }} | |
# username: ${{ secrets.ELK_SERVER_USER_NAME }} | |
# key: ${{ secrets.ELK_SERVER_PRIVATE_KEY }} | |
# script: | | |
# if [ -f /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh ]; then | |
# rm /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh | |
# fi | |
# | |
# echo "export ELASTIC_USERNAME=${{ secrets.ELASTIC_USERNAME }}" > /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh | |
# echo "export ELASTIC_PASSWORD=${{ secrets.ELASTIC_PASSWORD }}" >> /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh | |
# echo "export LOGSTASH_PORT=${{ secrets.LOGSTASH_PORT }}" >> /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh | |
# echo "export KIBANA_PORT=${{ secrets.KIBANA_PORT }}" >> /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh | |
# | |
# sed 's/^export //' /home/${{ secrets.ELK_SERVER_USER_NAME }}/deploy/env_vars.sh > /home/${{ secrets.ELK_SERVER_USER_NAME }}/docker/.env | |
# | |
# - name: Remove Github Actions IP From Security Group | |
# run: | | |
# aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 |