From ffd341dd114cf7f3796b665b2610c4a9a6e530ad Mon Sep 17 00:00:00 2001 From: tkt <37575408+tktcorporation@users.noreply.github.com> Date: Sat, 5 Oct 2024 14:35:27 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20deploy=20shabeko=20to=20flyio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-tts2-to-fly.yml | 31 +++++++++++++++++++ .github/workflows/heroku-deploy.yml | 38 ++++++++++++------------ fly-tts-2.toml | 22 ++++++++++++++ fly.toml | 4 +++ 4 files changed, 76 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/deploy-tts2-to-fly.yml create mode 100644 fly-tts-2.toml diff --git a/.github/workflows/deploy-tts2-to-fly.yml b/.github/workflows/deploy-tts2-to-fly.yml new file mode 100644 index 0000000..d8b5913 --- /dev/null +++ b/.github/workflows/deploy-tts2-to-fly.yml @@ -0,0 +1,31 @@ +name: "FlyIoDeployTTS-2" + +on: + release: + types: [published] + +defaults: + run: + shell: bash + working-directory: ./ + +env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} +jobs: + deploy: + name: deploy + runs-on: ubuntu-latest + environment: + name: heroku_production + + steps: + - uses: actions/checkout@v4 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: | + flyctl secrets set -c fly-tts-2.toml \ + DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} \ + AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \ + AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ + AWS_REGION=${{ secrets.AWS_REGION }} \ + DISCORD_CMD_PREFIX=${{ secrets.DISCORD_CMD_PREFIX }} + - run: flyctl deploy --remote-only -c fly-tts-2.toml diff --git a/.github/workflows/heroku-deploy.yml b/.github/workflows/heroku-deploy.yml index 8f6cc40..edbac2e 100644 --- a/.github/workflows/heroku-deploy.yml +++ b/.github/workflows/heroku-deploy.yml @@ -23,22 +23,22 @@ jobs: - name: Install Heroku CLI run: curl https://cli-assets.heroku.com/install-ubuntu.sh | sh - - name: Set Env Vars on Heroku - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: heroku config:set DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DISCORD_CMD_PREFIX=${{ secrets.DISCORD_CMD_PREFIX }} AWS_REGION=${{ secrets.AWS_REGION }} AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} -a ${{ secrets.HEROKU_APP_NAME }} - - - name: Login to Heroku Container registry - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: heroku container:login - - - name: Build and push - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: cd ./docker && heroku container:push -a ${{ secrets.HEROKU_APP_NAME }} app --context-path ../ - - - name: Release - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: heroku container:release -a ${{ secrets.HEROKU_APP_NAME }} app + # - name: Set Env Vars on Heroku + # env: + # HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + # run: heroku config:set DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DISCORD_CMD_PREFIX=${{ secrets.DISCORD_CMD_PREFIX }} AWS_REGION=${{ secrets.AWS_REGION }} AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} -a ${{ secrets.HEROKU_APP_NAME }} + + # - name: Login to Heroku Container registry + # env: + # HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + # run: heroku container:login + + # - name: Build and push + # env: + # HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + # run: cd ./docker && heroku container:push -a ${{ secrets.HEROKU_APP_NAME }} app --context-path ../ + + # - name: Release + # env: + # HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} + # run: heroku container:release -a ${{ secrets.HEROKU_APP_NAME }} app diff --git a/fly-tts-2.toml b/fly-tts-2.toml new file mode 100644 index 0000000..eafec04 --- /dev/null +++ b/fly-tts-2.toml @@ -0,0 +1,22 @@ +app = "shabeko-discord-bot" +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[build] + dockerfile = "docker/Dockerfile" + +[env] + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[[services]] + http_checks = [] + processes = ["app"] + script_checks = [] + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" \ No newline at end of file diff --git a/fly.toml b/fly.toml index 6ec96b8..b3eacb0 100644 --- a/fly.toml +++ b/fly.toml @@ -22,3 +22,7 @@ processes = [] hard_limit = 25 soft_limit = 20 type = "connections" + +[scale] + min = 0 + max = 0 \ No newline at end of file