Can't upgrade Elastic Beanstalk to the new Docker

Hi all,

We are running a metabase instance on Amazon Elastic Beanstalk.

It has been running for one year and we've only done 2 version upgrades since.

This morning for some reason the IP address of the instance changed a couple of times (it never did in months, only with the upgrades) and then before changing the rules of our database firewall once again, we decided to upgrade to 0.40.

Problem is that it didn't let us upgrade because of the Docker thing (I think): an ugly "deprecated platform" thing showed up:

Ok, no idea how to fix it, but after some minutes I found out I could upgrade to a newer docker or something. I tried that. Now the instance doesn't start.

I also tried to upgrade to 0.40... still, same issue.

So, I'm locked in a situation where our instance no longer starts up, so no idea what to do. Any help would be appreciated.

Thanks,

pablo

Hi @psantosl
What does "no longer starts up" mean? What do you see in the AWS logs?
Depending on how you setup Metabase initially, you'll need to decouple the RDS from EB to be able to upgrade to 0.40.0:
https://www.metabase.com/docs/latest/operations-guide/creating-RDS-database-on-AWS.html#decouple-your-rds-database-from-the-elastic-beanstalk-deployment

Hi!

If I click on "causes", I see this:

Ok, after trying to restart for yet another time, now it seems like 0.40 is installed, but on start up I don't see my data but a welcome screen :cry:

I'm starting to panic.

And the aws thing still shows "degraded"

@psantosl I don't know where version v0.40.0-1 is coming from - Metabase version is v0.40.0

Like I said initially, you have likely setup EB with a coupled RDS. You need to decouple it.
The data is stored in RDS - not in EB (unless you used H2).
Revert to your backup before you tried to do anything, decouple the RDS, and then upgrade.

Hi!

Thanks for your quick answer!

I don't know what "RDS or EB". Do you mean if we setup an external database or something? I don't think so, we just clicked "next/next" on whatever Elastic Beanstalk thing was available.

How can I decouple the RDS??

And no, I don't think I have any backup at all.

@psantosl
Rule number 1 when dealing with software: Always have backups.

I have no idea if you have lost everything, since I don't know how you setup your EB (Elastic Beanstalk) initially with or without RDS (Relational Database Service)
You will have to figure out if you did setup with RDS or not, but given that you have upgraded Metabase before, then we'll guess that you have.

I already linked to how to decouple RDS - pretty please, slow down, don't make mistakes, and read everything - but first, make sure you have a backup.

Yeah, yeah. I didn't expect 0.40 to do special stuff after reading the release notes quickly. I read them inside metabase in the part where it explains the new version thing, but I didn't see anything special, or I failed to see it.

I believe I might have a postgres for this, so maybe I'm lucky.

Ok, it looks like we have a postgres database for this (I see the DB thing, not sure if this is related to metabase, but since we don't have anything else in this datacenter, it seems likely).

I'll try to follow the guide you sent me and see if I can connect the old metadata (postgres) to whatever the new 0.40 is doing.

@psantosl I am getting the exact same issue.. I had safely updated my stage environment to 0.39.2 without issue.. something changed in 0.40.0 i havent tried restarting the instance yet..

Problem is that I already killed the old instance trying to go to 0.40 ... ouch, ouch, ouch

@flamber this is what I get installing a new metabase from scratch with 0.40.0, going back to a clean setup following the instructions:

Any chances 0.40.0 is broken?

Fixed the thing by reinstalling and figuring out all the obscure instructions to setup a database setting env vars and all that.

0.40.0 doesn't work even starting from a clean machine with beanstalk.

I am having the same problem. I think 0.40 is broken.
I did an incremental upgrade and successfully upgraded from v0.37.8 to v0.39.0 to v0.39.4 but ut the upgrade to the latest version (v0.40.0) failed. my config was same as @psantosl where Metabase running on Beanstalk and docker and I have dedicated posgresSQL to store Metabase data as well.

looking at eb-activity.log. here is the error with v0.40:
[2021-07-12T20:57:08.737Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_Performance_Team_Metabase/Command 07-install_cloudwatch_agent] : Starting activity...
[2021-07-12T20:57:09.085Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_Performance_Team_Metabase/Command 07-install_cloudwatch_agent] : Activity execution failed, because: Loaded plugins: priorities, update-motd, upgrade-helper
No package amazon-cloudwatch-agent available.
Error: Nothing to do
(ElasticBeanstalk::ExternalInvocationError)

[2021-07-12T20:57:09.085Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_Performance_Team_Metabase/Command 07-install_cloudwatch_agent] : Activity failed.
[2021-07-12T20:57:09.085Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_Performance_Team_Metabase] : Activity failed.
[2021-07-12T20:57:09.085Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Activity failed.
[2021-07-12T20:57:09.143Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0/EbExtensionPostBuild] : Activity failed.
[2021-07-12T20:57:09.143Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5/AppDeployStage0] : Activity failed.
[2021-07-12T20:57:09.143Z] INFO [14849] - [Application update v0.40.0.metabase-aws-eb.zip@5] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed

Same problem here "No package amazon-cloudwatch-agent available". I am on 0.39.2 currently, noticed in the docker configs, this is a new config step not in 0.39.2

0.39.2 Container Commands
container_commands:
#customize_env:
#env:
#NGINX_FORCE_SSL: 1
#PAPERTRAIL_HOSTNAME: $HOSTNAME
#PAPERTRAIL_HOST: foobar.papertrailapp.com
#PAPERTRAIL_PORT: 12345
#PAPERTRAIL_FILES: /var/log/nginx/access.log /var/log/nginx/error.log
#command: true
#ignoreErrors: false

# do server_https first to avoid overwriting other config changes
01_server_https:
    command: ".ebextensions/metabase_config/metabase-setup.sh server_https"
    ignoreErrors: true

02_log_x_real_ip:
    command: ".ebextensions/metabase_config/metabase-setup.sh log_x_real_ip"
    ignoreErrors: true

03_install_papertrail:
    command: ".ebextensions/metabase_config/metabase-setup.sh install_papertrail"
    test: test $PAPERTRAIL_HOST
    ignoreErrors: true

04_try_papertrail:
    command: "/sbin/service remote_syslog restart"
    test: test -e /etc/log_files.yml
    ignoreErrors: true

05_try_nginx:
    command: "/sbin/service nginx restart"
    test: nginx -t
    ignoreErrors: false

0.40.0 Container Commands

container_commands:
# do server_https first to avoid overwriting other config changes
01_server_https:
command: ".ebextensions/metabase_config/metabase-setup.sh server_https"
ignoreErrors: true

02_log_x_real_ip:
    command: ".ebextensions/metabase_config/metabase-setup.sh log_x_real_ip"
    ignoreErrors: true

03_install_papertrail:
    command: ".ebextensions/metabase_config/metabase-setup.sh install_papertrail"
    test: test $PAPERTRAIL_HOST
    ignoreErrors: true

04_try_papertrail:
    command: "/sbin/service remote_syslog restart"
    test: test -e /etc/log_files.yml
    ignoreErrors: true

05_try_nginx:
    command: "/sbin/service nginx restart"
    test: nginx -t
    ignoreErrors: false

06-install_inspector:
    command: bash -x install -u false
    cwd: /tmp/

07-install_cloudwatch_agent:
    command: sudo yum install amazon-cloudwatch-agent -y

08-run_cloudwatch_agent:
    command: sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:.ebextensions/metabase_config/cloudwatch/config.json -s

09-persist_env_vars:
    command: /opt/elasticbeanstalk/bin/get-config environment | jq -r 'to_entries | .[] | "export \(.key)=\"\(.value)\""' > /etc/profile.d/sh.local

10_set_up_env_vars:
    command: ".ebextensions/metabase_config/metabase-setup.sh set_up_env_vars"
    ignoreErrors: true

Hi @kangli, this error is a bit strange and I'm wondering why AWS can't find it's own cloudwatch-agent package (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-EC2-Instance.html).

Nevertheless, you should be able to upgrade by downloading the Elastic Beanstalk deployment zip, opening it, deleting the steps 7 and 8 (where it searches for amazon-cloudwatch-agent package and runs it), zipping the file again and deploying. I'm investigating why this might be happening but it should be a very old Amazon Linux that is running and it doesn't find the package

Yes, we added the cloudwatch agent in the elastic beanstalk deployment so users could start monitoring RAM usage if they wish, seems like for old Elastic Beanstalk instances (ones that started a while ago and upgraded from there), AWS can't find it's own cloudwatch-agent package. Should be solved by starting a new Elastic Beanstalk deployment connecting to the old RDS (check how to decouple your RDS from the current Elastic Beanstalk here https://www.metabase.com/docs/latest/operations-guide/creating-RDS-database-on-AWS.html#decouple-your-rds-database-from-the-elastic-beanstalk-deployment)

For everyone watching this thread, the reason you can't upgrade is because you are using a deprecated Elastic Beanstalk platform which is based on Amazon Linux, the latest one is Amazon Linux 2 which you should move to ASAP.

The procedure should be straightforward:

  1. back up your database if you still haven't (try checking https://www.metabase.com/docs/latest/operations-guide/creating-RDS-database-on-AWS.html#decouple-your-rds-database-from-the-elastic-beanstalk-deployment so you deploy Metabase application database OUTSIDE Elastic Beanstalk)
  2. delete the current deprecated Elastic Beanstalk deployment (make sure you save all the environment variables you use to connect to the Application Database or they will be lost when you delete the deployment)
  3. start a new deployment connecting your new Metabase Elastic Beanstalk deployment with the old Application Database

I will try (I can't promise anything) to make an Elastic Beanstalk deployment that can work with old Amazon Linux Elastic Beanstalk platforms, but you should move from deprecated platforms for your own sake.

UPDATE: I did a custom deploy for upgrading deprecated platforms for .40 version (this will be reviewed, tested and if we consider that it's a good path forward we will merge it)

file is here: https://github.com/metabase/metabase/issues/17012