Skip to content

Commit

Permalink
Merge pull request #438 from supabase/ew3_hard_deploy_2.0.0
Browse files Browse the repository at this point in the history
ew3 hard deploy 2.0.0
  • Loading branch information
abc3 authored Sep 2, 2024
2 parents 7ac1829 + c634c68 commit cf4cf0a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
echo "RELEASE_FROM=$(elixir ./deploy/upgrade/handler.exs upgrade_from ./deploy/upgrade/prod.config)" >> $GITHUB_ENV
echo "RELEASE_TO=$(elixir ./deploy/upgrade/handler.exs upgrade_to ./deploy/upgrade/prod.config)" >> $GITHUB_ENV
echo "NAME=$(elixir ./deploy/upgrade/handler.exs name ./deploy/upgrade/prod.config)" >> $GITHUB_ENV
echo "TYPE=$(elixir ./deploy/upgrade/handler.exs type ./deploy/upgrade/prod.config)" >> $GITHUB_ENV
- name: Setup Elixir
run: |
. ~/.asdf/asdf.sh
Expand All @@ -33,24 +34,28 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
toolchain: stable
- name: Get git tags
run: git fetch --tags origin
- name: Checkout RELEASE_FROM
if: env.TYPE == 'soft'
run: git checkout v${{ env.RELEASE_FROM }}
- name: Cache Mix
if: env.TYPE == 'soft'
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-mix-
- name: Install dependencies
if: env.TYPE == 'soft'
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
- name: Make old release
if: env.TYPE == 'soft'
run: mix release supavisor
- name: Checkout RELEASE_TO
run: git checkout v${{ env.RELEASE_TO }}
Expand All @@ -61,18 +66,23 @@ jobs:
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-mix-
- name: Clean up old release(s)
if: env.TYPE == 'soft'
run: |
rm -rf ./_build/${{ env.MIX_ENV }}/lib/supavisor
rm ./_build/${{ env.MIX_ENV }}/rel/supavisor/releases/COOKIE
rm ./_build/${{ env.MIX_ENV }}/supavisor-${{ env.RELEASE_FROM }}.tar.gz
- name: Install dependencies
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
- name: Clean up old release
run: |
rm -rf ./_build/${{ env.MIX_ENV }}/lib/supavisor
rm ./_build/${{ env.MIX_ENV }}/rel/supavisor/releases/COOKIE
rm ./_build/${{ env.MIX_ENV }}/supavisor-${{ env.RELEASE_FROM }}.tar.gz
- name: Make upgrade release
if: env.TYPE == 'soft'
run: RELEASE_COOKIE=${{ secrets.RELEASE_COOKIE_PROD }} UPGRADE_FROM=${{ env.RELEASE_FROM }} mix release supavisor
- name: Make hard ${{ env.RELEASE_TO }} release
if: env.TYPE == 'hard'
run: RELEASE_COOKIE=${{ secrets.RELEASE_COOKIE_PROD }} mix release supavisor
- name: Create tarball
run: cd _build/${{ env.MIX_ENV }} && mv supavisor-${{ env.RELEASE_TO }}.tar.gz "${{ env.NAME }}_$(date "+%s").tar.gz"
- name: configure aws credentials - production
Expand All @@ -82,4 +92,4 @@ jobs:
aws-region: "us-east-1"
- name: Deploy to S3
shell: bash
run: aws s3 sync ./_build/${{ env.MIX_ENV }} ${{ secrets.TARBALLS_PATH_PROD }} --exclude '*' --include '*tar.gz'
run: aws s3 sync ./_build/${{ env.MIX_ENV }} ${{ secrets.TARBALLS_PATH_PROD }} --exclude '*' --include '*tar.gz'
6 changes: 3 additions & 3 deletions deploy/upgrade/prod.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[
{upgrade_from, "1.1.48"},
{upgrade_to, "1.1.49"},
{upgrade_to, "2.0.0"},
% list() | [<<"all">>]
{regions, [<<"all">>]},
{regions, [<<"eu-west-3">>]},
% :soft | :hard
{type, soft}
{type, hard}
].
% supavisor_soft_all-1_1.1.13_1.1.39

0 comments on commit cf4cf0a

Please sign in to comment.