Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker upgrade database #4650

Merged
merged 3 commits into from
May 7, 2024
Merged

Docker upgrade database #4650

merged 3 commits into from
May 7, 2024

Conversation

dhaley
Copy link
Collaborator

@dhaley dhaley commented Apr 26, 2024

Any background context you want to provide?

The script ./docker/postgres_upgrade.sh will properly upgrade a database from pg12.7-(2.3.0) to pg14.11-(2.14.2). It works in conjunction with the "docker-compose.pgupgrade.yml" docker-compose file to temporarily run Timescale Postgres 13 and 14 images.

What's this PR do?

How should this be manually tested?

./docker/postgres_upgrade.sh --source-pg-conv-version 13 --source-ts-conv-version 2.11.2 --target-pg-test-version 14 --target-ts-test-version 2.11.0

What are the relevant tickets?

Screenshots (if appropriate)

@dhaley dhaley marked this pull request as draft April 26, 2024 22:00
Copy link

Label error. Requires at least 1 of: Feature, Bug, Enhancement, Maintenance, Documentation, Performance, Do not publish. Found:

Copy link

Label error. Requires at least 1 of: Feature, Bug, Enhancement, Maintenance, Documentation, Performance, Do not publish. Found:

1 similar comment
Copy link

Label error. Requires at least 1 of: Feature, Bug, Enhancement, Maintenance, Documentation, Performance, Do not publish. Found:

Comment on lines 15 to 17
POSTGRES_FULL_VERSION=$(docker-compose exec -T db-postgres psql --user=seed -d postgres -c 'SELECT version();' | sed -n 3p)
# Extract the version number using regex
POSTGRES_VERSION=$(echo "$POSTGRES_FULL_VERSION" | sed -n 's/.*PostgreSQL \([0-9]*\.[0-9]*\).*/\1/p')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be able to use:

POSTGRES_VERSION=$(docker-compose exec -T db-postgres psql --user=seed -d postgres -t -A -c 'SHOW server_version;')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Will change.

docker/postgres_upgrade.sh Outdated Show resolved Hide resolved
docker/postgres_upgrade.sh Show resolved Hide resolved
@axelstudios
Copy link
Member

Might also be worth using the --exit-on-error flag with pg_restore

@dhaley
Copy link
Collaborator Author

dhaley commented Apr 30, 2024

Might also be worth using the --exit-on-error flag with pg_restore

Will do.

Copy link

Label error. Requires at least 1 of: Feature, Bug, Enhancement, Maintenance, Documentation, Performance, Do not publish. Found:

2 similar comments
Copy link

Label error. Requires at least 1 of: Feature, Bug, Enhancement, Maintenance, Documentation, Performance, Do not publish. Found:

Copy link

Label error. Requires at least 1 of: Feature, Bug, Enhancement, Maintenance, Documentation, Performance, Do not publish. Found:

@dhaley dhaley added the Feature Add this label to new features. This will be reflected in the change log when generated. label Apr 30, 2024
@dhaley dhaley marked this pull request as ready for review April 30, 2024 16:37
@dhaley dhaley force-pushed the docker-upgrade-database branch 3 times, most recently from ce904da to 53bfdf1 Compare April 30, 2024 17:19
@dhaley dhaley requested a review from nllong May 1, 2024 14:50
Copy link
Member

@nllong nllong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks @dhaley!

@dhaley dhaley requested a review from kflemin May 6, 2024 21:06
@axelstudios axelstudios merged commit 9afbe03 into develop May 7, 2024
9 checks passed
@axelstudios axelstudios deleted the docker-upgrade-database branch May 7, 2024 15:45
perryr16 pushed a commit that referenced this pull request May 21, 2024
* Automate ugprading a database from 12 to 14.

* parameterize source conversion and target test database service versions.

---------

Co-authored-by: Damon Haley <damon.haley@nrel.gov>
kflemin added a commit that referenced this pull request Aug 8, 2024
* add django-2-f-a library

* 2fa base install

* import 2factor templates

* cleanup

* move two_factor to landing

* functional

* styles

* defining styles in two_factor _base

* styling and navigation

* link

* hide/show terms

* override login view to redirect user

* functional

* precommit

* styles

* lint

* update login test

* precommit

* redirect to login not landing_page

* 2fa handles redirect, not landing

* hide terms on auth and preserve url on seed home

* precommit

* conditionally show create act

* precommit

* Speed up ali tree (#4654)

* Speed up ali tree

* Fix Tests

* Docker upgrade database (#4650)

* Automate ugprading a database from 12 to 14.

* parameterize source conversion and target test database service versions.

---------

Co-authored-by: Damon Haley <damon.haley@nrel.gov>

* Postgres 16 upgrade documentation (#4651)

Added documentation for upgrading Postgres and TimescaleDB to the latest version

* Fix email (#4642)

* Fix email

* Fix

* Fix

* Fix package.json

* map from property_view_id not id

---------

Co-authored-by: Katherine Fleming <2205659+kflemin@users.noreply.github.com>
Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>
Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* conflicts

* Update portfolio summary (#4666)

* new stats table

* commitment sqft added to goal

* actions to  goal stats table

* stats table, actions dropdown

* stats, create goal_notes for newly uploaded properties

* add current cycle property ids to goal get

* actions dropdown and base for bulk goalnote edit

* bulk update goalnote

* bulk update historical note

* rename

* precommit

* permissions and tests

* lint

* permission refactor

* permission refactor

* lint

* phrasing

* small language update and added translations

---------

Co-authored-by: kflemin <2205659+kflemin@users.noreply.github.com>

* add org.require_2fa

* global require_2fa var but unable to skip wizard steps

* troubleshooting redirects to setup

* base for custom ui

* qrcode lib

* functional

* testing

* functional - need modal

* modal functional

* require 2 factor org setting

* precommit

* lint

* guard against no devices

* pharsing

* fix tests

* precommit

* styling and translations

* remove blanks

* precommit

* lint

* revert requirements

* hide resend email from profile

* minor tweeks

* precommit

* handle 500 api responses

* lint

* fix migration

* remove duplicate

---------

Co-authored-by: Hannah Eslinger <heslinge@nrel.gov>
Co-authored-by: Damon Haley <dhaley@users.noreply.github.com>
Co-authored-by: Damon Haley <damon.haley@nrel.gov>
Co-authored-by: Alex Swindler <alex.swindler@nrel.gov>
Co-authored-by: Katherine Fleming <2205659+kflemin@users.noreply.github.com>
Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>
Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>
Co-authored-by: Ross Perry <ross.perry@Rosss-MBP-2.home>
Co-authored-by: Ross Perry <ross.perry@192.168.1.4>
Co-authored-by: Ross Perry <ross.perry@rosss-mbp-2.lan>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Add this label to new features. This will be reflected in the change log when generated.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants