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

Remove postgres 12 and install version 15 #128

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,5 @@ node-runner-cli/systemd.settings.yml

.DS_Store
node-runner-cli/out/
requirements.txt
requirements.txt
node-runner-cli/node-keystore.ks
29 changes: 29 additions & 0 deletions Readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,34 @@ positional arguments:

optional arguments:
-h, --help show this help message and exit
----

== Upgrading Postgres from 12 to 15
From gateway release 1.7.3, upgrading Postgres is required. Follow the steps below to upgrade Postgres from version 12 to 15:
shambupujar marked this conversation as resolved.
Show resolved Hide resolved

=== Shutdown the node, and gateway:
[source, bash]
----
./babylonnode docker stop
----

=== Install the new Postgres 15
This is part of cli docker install process. The ansible provision.yml is updated to take care of uninstalling the old version and installing the new version. This removes the existing data on gateway and will reingest. So if you running production gateway, suggestion is to setup new instance and switch over to new instance once it is all synced up.
[source, bash]
----
./babyonnode docker install
----

=== Check if node is running:
For more information on node monitoring and health, refer to the documentation at https://docs.radixdlt.com/docs/node-monitoring-health.

=== Check if the gateway is running:
For more information on ensuring the gateway is running, refer to the documentation at https://docs.radixdlt.com/docs/setup-with-cli#6-make-sure-the-gateway-is-running.


=== If gateway is reporting issues, it might need a restart. Try below commands
shambupujar marked this conversation as resolved.
Show resolved Hide resolved
[source, bash]
----
docker compose down data_aggregator gateway_api
docker compose up data_aggregator gateway_api -d
----
56 changes: 55 additions & 1 deletion node-runner-cli/ansible/project/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
setup_swap: false
setup_limits: false
postgres_local: false
postgresql_version: 12
postgresql_version: 15
postgresql_user: postgres
postgresql_db_name: radixdlt_ledger
tasks:
Expand Down Expand Up @@ -78,6 +78,12 @@
state: present
filename: pgdg

- name: Remove PostgreSQL 12 if installed
ansible.builtin.package:
name: postgresql-12
state: absent
ignore_errors: true

- name: install PostgreSQL
ansible.builtin.package:
name:
Expand All @@ -87,6 +93,54 @@
- acl
state: present

- name: Debug print command pg_lsclusters
command: pg_lsclusters
register: pg_lsclusters_output
changed_when: false

- name: Print pg_lsclusters output
debug:
var: pg_lsclusters_output.stdout_lines

- name: Remove PostgreSQL 12 cluster if exists
shell: |
pg_lsclusters | grep '12' && pg_dropcluster --stop 12 main
ignore_errors: true

- name: Check if PostgreSQL {{postgresql_version}} is listening on port 5432
shell: |
ss -ltn | grep ':5432'
register: postgres_port_check
changed_when: false
ignore_errors: true

- name: Stop PostgreSQL {{postgresql_version}} if it is running
service:
name: postgresql
state: stopped
when: postgres_port_check.stdout != ""

- name: Modify PostgreSQL {{postgresql_version}} to listen on port 5432
lineinfile:
path: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
regexp: '^#?port ='
line: 'port = 5432'
state: present

- name: Stop PostgreSQL service
service:
name: postgresql
state: stopped


- name: Reload systemd daemon
command: systemctl daemon-reload

- name: Start PostgreSQL {{postgresql_version}}
service:
name: postgresql
state: started

- name: Install psycopg2-binary python package
ansible.builtin.pip:
name: psycopg2-binary
Expand Down
Loading