How / Where do I upgrade my instance's PostgreSQL Version?

1

Hello! I am trying to deploy a rails 7 app to elastic beanstalk, but my deploy keeps failing. In the logs I see: An error occurred while installing pg (1.3.5), and Bundler cannot continue (installing the postgres gem is failing) I SSHed onto my instance and ran bundle manually, and see Your PostgreSQL is too old. Either install an older version of this gem or upgrade your database to at least PostgreSQL-9.3.

In my .elasticbeanstalk.packages.config file I have:

packages:
  yum:
    postgresql14-devel: []

But this seems to have no effect on the version of Postgres on my instance.

Creating an RDS instance associated to my beanstalk environment with any version of PostgreSQL does not seem to solve the problem.

postgres -V is not a command on my beanstalk instance

if I ssh onto my instance and cat usr/bin/pg_config I think it may be set to version 9.2, but this file doesn't look to me like something I should be editing via SSH and I don't see any references to manipulating how it gets generated.

Any assistance would be greatly appreciated!

Update1:

.elasticbeanstalk.packages.config should be within .ebextensions instead. I made this change, still had this error.

Found another thread on stack overflow that described the packages.config file to look like

packages:
    yum:
        amazon-linux-extras: []

commands:
    01_postgres_activate:
        command: sudo amazon-linux-extras enable postgresql10
    02_postgres_install:
        command: sudo yum install -y postgresql-devel

I updated the file, still had no luck. I terminated and rebuild my app to try again, and manually ran sudo amazon-linux-extras enable postgresql10 and sudo yum install -y postgresql-devel via ssh, which finally let me successfully bundle install. Still working on making this work via EB deploy instead of manually messing with the boxes.

Update 2:

After making the above changes and creating a new application + environment I am able to consistently get past the above issue.

已提问 2 年前754 查看次数
1 回答
1
已接受的回答

Figured this out, the steps I took were:

  1. .elasticbeanstalk.packages.config should be within .ebextensions instead o felasticbeanstalk
  2. packages.config updated to :
packages:
    yum:
        amazon-linux-extras: []

commands:
    01_postgres_activate:
        command: sudo amazon-linux-extras enable postgresql10
    02_postgres_install:
        command: sudo yum install -y postgresql-devel
  1. created new application & new environment to 100% verify the above steps work on a fresh instance.
已回答 2 年前
  • This solved my issue. Thank you!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则