-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
40 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 |
---|---|---|
|
@@ -153,43 +153,3 @@ jobs: | |
sudo docker pull ${{ secrets.DOCKER_REPO }}:develop-${{ github.run_number }} | ||
sudo docker-compose -f docker-compose.yml up -d | ||
sudo docker image prune -f | ||
deploy-monitor: | ||
runs-on: ubuntu-latest | ||
|
||
if: github.event_name == 'workflow_dispatch' | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
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: Copy docker-compose-monitor.yml into monitor instance | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.MONITOR_PUBLIC_DNS }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.PEM_KEY }} | ||
source: "docker/docker-compose-monitor.yml" | ||
target: "/home/${{ secrets.MONITOR_USERNAME }}/docker/docker-compose-monitor.yml" | ||
strip_components: 3 | ||
overwrite: true | ||
debug: true | ||
|
||
- name: Deploy to EC2 monitor server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.MONITOR_PUBLIC_DNS }} | ||
username: ${{ secrets.MONITOR_USERNAME }} | ||
key: ${{ secrets.MONITOR_PEM_KEY }} | ||
script: | | ||
cd /home/${{ secrets.MONITOR_USERNAME }} | ||
echo ${{ secrets.DOCKER_PASSWORD }} | sudo docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
sudo docker-compose -f docker-compose-monitor.yml up -d | ||
sudo docker image prune -f |
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,46 @@ | ||
name: Monitoring CI/CD Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy-monitor: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
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: Copy docker-compose-monitor.yml into monitor instance | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.MONITOR_PUBLIC_DNS }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.PEM_KEY }} | ||
source: "docker/docker-compose-monitor.yml" | ||
target: "/home/${{ secrets.USERNAME }}/docker/docker-compose-monitor.yml" | ||
strip_components: 3 | ||
overwrite: true | ||
debug: true | ||
|
||
- name: Deploy to EC2 monitor server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.MONITOR_PUBLIC_DNS }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.PEM_KEY }} | ||
script: | | ||
cd /home/${{ secrets.USERNAME }} | ||
echo ${{ secrets.DOCKER_PASSWORD }} | sudo docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
sudo docker-compose -f docker-compose-monitor.yml up -d | ||
sudo docker image prune -f |