diff --git a/.gitignore b/.gitignore index 44d42c9f..cc68bc56 100644 --- a/.gitignore +++ b/.gitignore @@ -140,4 +140,5 @@ node-runner-cli/systemd.settings.yml .DS_Store node-runner-cli/out/ -requirements.txt \ No newline at end of file +requirements.txt +node-runner-cli/node-keystore.ks diff --git a/Readme.adoc b/Readme.adoc index 2ec7842c..1412153b 100644 --- a/Readme.adoc +++ b/Readme.adoc @@ -109,5 +109,37 @@ positional arguments: optional arguments: -h, --help show this help message and exit +---- + +== Upgrading Postgres from 12 to 15 +From gateway release 1.7.0, upgrading Postgres is required. Follow the steps below to upgrade Postgres from version 12 to 15: +=== 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. + + +=== Gateway still reporting issues +Both gateway_api and data_aggregator might need a restart. Try below commands +[source, bash] +---- +docker compose down data_aggregator gateway_api +docker compose up data_aggregator gateway_api -d ---- diff --git a/node-runner-cli/ansible/project/provision.yml b/node-runner-cli/ansible/project/provision.yml index 3e6f9056..004d8d3b 100644 --- a/node-runner-cli/ansible/project/provision.yml +++ b/node-runner-cli/ansible/project/provision.yml @@ -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: @@ -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: @@ -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