From cb66ec99afb9d437f2cd04a4d34f53cf7d852117 Mon Sep 17 00:00:00 2001 From: k4mien Date: Tue, 23 Jan 2024 00:07:31 +0100 Subject: [PATCH] test ssh into ec2 --- .github/workflows/deploy.yml | 38 +++++++++++------- task-definition.json | 77 ------------------------------------ 2 files changed, 24 insertions(+), 91 deletions(-) delete mode 100644 task-definition.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a884fc0..ed20453 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,6 +8,19 @@ on: branches: [ dev, main ] jobs: + lint: + name: Linting + + permissions: + contents: read + statuses: write + + # FIXME: customize uri to point to your own reusable linter repository + uses: k4mien/super-linter-bf/.github/workflows/reusable-super-linter.yaml@main + + with: + filter-regex-include: src/.* + deploy: name: Deployment runs-on: ubuntu-latest @@ -38,18 +51,15 @@ jobs: docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT - - name: Fill in the new image ID in the Amazon ECS task definition - id: task-def - uses: aws-actions/amazon-ecs-render-task-definition@v1 - with: - task-definition: task-definition.json - container-name: discordjs - image: ${{ steps.build-image.outputs.image }} - - - name: Deploy Amazon ECS task definition - uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + - name: SSH into EC2 instance and deploy + uses: appleboy/ssh-action@v1.0.3 with: - task-definition: ${{ steps.task-def.outputs.task-definition }} - service: discord-bot-lavalink - cluster: discord-bot-lavalink - wait-for-service-stability: true \ No newline at end of file + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_SSH_KEY }} +# script: | +# sudo docker pull ${{ secrets.DOCKER_REPO_URL }}/dummy-server:latest +# sudo docker stop my-node-app || true +# sudo docker rm my-node-app || true +# sudo docker run -d -p 3000:3000 --name my-node-app ${{ secrets.DOCKER_REPO_URL }}/dummy-server:latest + script: whoami \ No newline at end of file diff --git a/task-definition.json b/task-definition.json deleted file mode 100644 index 724b05b..0000000 --- a/task-definition.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "family": "discord-bot", - "containerDefinitions": [ - { - "name": "lavalink", - "image": "ghcr.io/lavalink-devs/lavalink:4", - "cpu": 0, - "portMappings": [ - { - "name": "lavalink-2333-tcp", - "containerPort": 2333, - "hostPort": 2333, - "protocol": "tcp", - "appProtocol": "http" - }, - { - "containerPort": 2333, - "hostPort": 2333, - "protocol": "udp" - } - ], - "essential": true, - "environment": [ - { - "name": "_JAVA_OPTIONS", - "value": "-Xmx4G" - } - ], - "environmentFiles": [], - "mountPoints": [], - "volumesFrom": [], - "workingDirectory": "/opt/Lavalink", - "ulimits": [], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-create-group": "true", - "awslogs-group": "/ecs/discord-bot", - "awslogs-region": "eu-central-1", - "awslogs-stream-prefix": "ecs" - }, - "secretOptions": [] - } - }, - { - "name": "discordjs", - "image": "730519783440.dkr.ecr.eu-central-1.amazonaws.com/myrepo:67b2c9363dbb5ce51ddae15ec8694fa0ac134e68", - "cpu": 0, - "portMappings": [], - "essential": true, - "environment": [], - "environmentFiles": [], - "mountPoints": [], - "volumesFrom": [] - } - ], - "executionRoleArn": "arn:aws:iam::730519783440:role/ecsTaskExecutionRole", - "networkMode": "awsvpc", - "volumes": [ - { - "name": "config", - "efsVolumeConfiguration": { - "fileSystemId": "fs-037fccb1630640d38", - "rootDirectory": "/" - } - } - ], - "requiresCompatibilities": [ - "EC2" - ], - "cpu": "1024", - "memory": "3072", - "runtimePlatform": { - "cpuArchitecture": "X86_64", - "operatingSystemFamily": "LINUX" - } -} \ No newline at end of file