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!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠