Skip to content

Instantly share code, notes, and snippets.

@daninfpj
Created April 17, 2024 16:25
Show Gist options
  • Save daninfpj/2e3cde17d0f49eb85b6c8d54dc5a2266 to your computer and use it in GitHub Desktop.
Save daninfpj/2e3cde17d0f49eb85b6c8d54dc5a2266 to your computer and use it in GitHub Desktop.
Metabase Elastic Beanstalk upgrade
#!/bin/bash
# Usage:
# ./upgrade.sh $image_tag [$aws_profile]
# ./upgrade.sh 0.49.3 profile
export AWS_PAGER=""
image_tag=$1
aws_profile=${2:-'default'}
# Set an S3 bucket in your account
s3_bucket="elasticbeanstalk-us-east-1-xxxxx"
# Your Elastic Beanstalk Application
application_name="Metabase"
# Your Elastic Beanstalk Environment
environment_name="Metabase-env"
curl -o metabase-aws-eb.zip https://downloads.metabase.com/v0.47.2/metabase-aws-eb.zip
unzip metabase-aws-eb.zip -d metabase-eb
sed -i '' "s|\"Name\" : \"metabase/metabase:v[0-9]*\.[0-9]*\.[0-9]*\"|\"Name\" : \"metabase/metabase:v$image_tag\"|" metabase-eb/Dockerrun.aws.json
cd metabase-eb
zip -r ../metabase-$image_tag.zip .
cd ..
rm -rf metabase-eb
rm -rf metabase-aws-eb.zip
aws s3 cp metabase-$image_tag.zip s3://$s3_bucket/ --profile $aws_profile
aws elasticbeanstalk create-application-version --application-name "$application_name" \
--version-label $image_tag --source-bundle S3Bucket=$s3_bucket,S3Key=metabase-$image_tag.zip --profile $aws_profile
aws elasticbeanstalk update-environment --application-name "$application_name" \
--environment-name "$environment_name" --version-label $image_tag --profile $aws_profile
rm -f metabase-$image_tag.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment