π£π Introducing recent MiniBolt & RaMiX UPDATES π
Some guides on MiniBolt / RaMiX have suffered some modifications and need additional instructions to migrate. Here is a summary:
π New installation/update instructions of [BTC RPC Explorer](this issue(https://github.com/janoside/btc-rpc-explorer/issues/668).
π New installation/update method of [Node + NPM](https://minibolt.minibolt.info/bonus-guides/system/nodejs-npm).
π New installation/update method of [PostgreSQL](https://minibolt.minibolt.info/bonus-guides/system/postgresql) ~ > Attention! If you installed PostgreSQL after 30/09/2024, you do not need to follow these steps related to PostgreSQL.
## Update Nodejs + NPM to the latest LTS version (using the new method)
> Guide related: [Node + NPM](https://minibolt.minibolt.info/bonus-guides/system/nodejs-npm)
> Context: The installation/upgrade section of this guide has suffered some modifications, so to upgrade to the latest LTS released version using the new installation method, you need to follow the next steps:
```
sudo systemctl stop thunderhub btcrpcexplorer
```
```
sudo apt update && sudo apt full-upgrade
```
```
cd /tmp
```
```
VERSION=22
```
```
curl -fsSL https://deb.nodesource.com/setup$VERSION.x -o nodesourcesetup.sh
```
```
sudo -E bash nodesource_setup.sh
```
```
sudo apt update && sudo apt full-upgrade
```
```
node -v
```
Example of expected output:
```
v22.12.0
```
```
npm -v
```
Example of expected output:
```
10.9.0
```
```
rm nodesource_setup.sh
```
```
sudo systemctl start thunderhub btcrpcexplorer
```
## Update BTC RPC Explorer to the latest version
> Guide related: [2.3 Blockchain explorer: BTC RPC Explorer](https://minibolt.minibolt.info/bitcoin/bitcoin/blockchain-explorer)
> Context: After [this notice]("Node Details"(this error(commit(https://github.com/janoside/btc-rpc-explorer/commit/01585b7825afe0eb3e8f6cf39e9e135a20c8c2dd), but an official version that includes this correction has not been officially released yet. To fix this, it is necessary to point to the current source code and not the one related to the last released version (3.4.0).
> Get instructions to get this by following these steps and fix the issue > [HERE](https://minibolt.minibolt.info/bitcoin/bitcoin/blockchain-explorer#upgrade) < ~
## Update PostgreSQL (server instance migration & others)
> Guide related: [PostgreSQL](https://minibolt.minibolt.info/bonus-guides/system/postgresql)
> Attention!! If you installed PostgreSQL after 30/09/2024, you don't need to do anything, and the next steps don't apply to your case.
> Context: With each major version jump of PostgreSQL, the update creates a new and dedicated cluster and folder with the number of each version. Also, the changes made between versions cause the need to migrate the database, that is, from one cluster to another, with a specific tool. This was unknown at the beginning, before creating the MiniBolt PostgreSQL installation guide, so a specific folder for the versions was not created. The [installation section](https://minibolt.minibolt.info/bonus-guides/system/postgresql#installation) was changed past 30/09/2024 to use this new method, but people who followed the PostgreSQL installation before that, need to do things to be in line with the MiniBolt guide.
Following the next steps, we are going to do the necessary migrations, the summary is the next:
1. Migrate the PostgreSQL database to a new location (a dedicated folder for each version).
2. Migrate from PostgreSQL server version 16 to 17.
Verification
If you are not sure whether you installed PostgreSQL before or after the mentioned date (30/09/2024), you can check as follows:
admin list the existing clusters:```
pg_lsclusters
```
Expected output if you installed PostgreSQL after 30/09/2024, (you don't need do anything):
```
Ver Cluster Port Status Owner Data directory Log file
17 main 5432 online postgres /data/postgresdb/17 /var/log/postgresql/postgresql-17-main.log
```
Expected output if you installed PostgreSQL before 30/09/2024, and performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade, (you need to follow the next steps):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb /var/log/postgresql/postgresql-16-main.log
17 main 5433 down postgres /var/lib/postgresql/17/main /var/log/postgresql/postgresql-17-main.log
```
Expected output if you have not performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (the PostgreSQL v17 release) (unlikely case) (you need to follow the next steps):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb /var/log/postgresql/postgresql-16-main.log
```
### Migrate the PostgreSQL database to the new location
> (Only if you installed PostgreSQL following the MiniBolt guide before 30/09/2024)
```
pg_lsclusters
```
~ > Expected output if you have not performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (PostgreSQL v17 release) (unlikely):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb /var/log/postgresql/postgresql-16-main.log
```
~ > Expected output if you have performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (PostgreSQL v17 release) (most likely):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb /var/log/postgresql/postgresql-16-main.log
17 main 5433 down postgres /var/lib/postgresql/17/main /var/log/postgresql/postgresql-17-main.log
```
~ > Check the current "Data directory" column value of the cluster 16 (/data/postgresdb) for the future, we have changed this to a dedicated folder for each version (/data/postgresdb/16, /data/postgresdb/17, /data/postgresdb/18, etc.)
```
sudo systemctl stop thunderhub scbackup btcpay lnd nbxplorer nostrelay cloudflared postgresql@16-main
```
> Ensure all services are successfully stopped by monitoring the logs of each service, especially lnd > journalctl -fu lnd.
```
journalctl -fu postgresql@16-main
```
Expected output:
```
minibolt systemd[1]: Stopping PostgreSQL Cluster 16-main...
minibolt systemd[1]: postgresql@16-main.service: Deactivated successfully.
minibolt systemd[1]: Stopped PostgreSQL Cluster 16-main.
```
~ > Press Ctrl + C to continue.
/data/postgresdb to move the data securely:```
sudo mkdir /tmp/postgresdb-temp
```
/data/postgresdb to this temporary directory:```
sudo rsync -av /data/postgresdb/ /tmp/postgresdb-temp/
```
Example of expected output:
```
pg_xact/
pg_xact/0000
sent 40,397,103 bytes received 18,619 bytes 80,831,444.00 bytes/sec
total size is 40,330,914 speedup is 1.00
```
~ > Wait until the prompt shows up again.
root temporary:```
sudo su
```
```
sudo rm -rf /data/postgresdb/*
```
admin user:```
exit
```
```
sudo mkdir /data/postgresdb/16
```
postgres:```
sudo chown postgres:postgres /data/postgresdb/16
```
```
sudo chmod 700 /data/postgresdb/16
```
/data/postgresdb/16 in a secure way since this directory is not inside the source directory:```
sudo rsync -av /tmp/postgresdb-temp/ /data/postgresdb/16/
```
Example of expected output:
```
pg_xact/
pg_xact/0000
sent 40,397,103 bytes received 18,619 bytes 80,831,444.00 bytes/sec
total size is 40,330,914 speedup is 1.00
```
~ > Wait until the prompt shows up again.
postgresql.conf) of the PostgreSQL to point to the new directory folder created:```
sudo nano +42 /etc/postgresql/16/main/postgresql.conf
```
```
data_directory = '/data/postgresdb/16'
```
```
sudo systemctl start postgresql@16-main
```
```
journalctl -fu postgresql@16-main
```
Expected output:
```
minibolt systemd[1]: Starting PostgreSQL Cluster 16-main...
minibolt systemd[1]: Started PostgreSQL Cluster 16-main.
```
~ > Press Ctrl + C to continue.
```
pg_lsclusters
```
~ > Expected output if you have not performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (unlikely):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
```
~ > Expected output if you have performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (most likely):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
17 main 5433 down postgres /var/lib/postgresql/17/main /var/log/postgresql/postgresql-17-main.log
```
~ > Check the new path on the "Data directory" column value of the cluster version 16, now (/data/postgresdb/16).
```
sudo systemctl start lnd nbxplorer btcpay thunderhub scb-backup nostr-relay cloudflared
```
> Check all work fine with the logs of each service, especially lnd > journalctl -fu lnd.
```
sudo systemctl stop thunderhub scbackup btcpay lnd nbxplorer nostrelay cloudflared
```
> Ensure all services are successfully stopped by monitoring the logs of each service, especially lnd > journalctl -fu lnd.
### Migrate from PostgreSQL server version 16 to 17
> (Only if you installed PostgreSQL following the MiniBolt guide before 30/09/2024)
> Context: If you fully updated your OS after 26/09/2024 (the PostgreSQL v17 launched), using sudo apt update && sudo apt full-upgrade, and you installed PostgreSQL before that date following [the PostgreSQL MiniBolt guide](https://minibolt.minibolt.info/bonus-guides/system/postgresql), it is likely that you now are using the old version (v16) of the PostgreSQL server instance.
To confirm that, follow the next steps:
Check the PostgreSQL server version in use
admin, enter the psql (PostgreSQL CLI):```
sudo -u postgres psql
```
```
SELECT version();
```
Expected output:
```
version
PostgreSQL 16.6 (Ubuntu 16.6-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
(1 row)
```
~ > Check the previous version is "PostgreSQL 16.6" (an outdated version of the PostgreSQL server), the latest version is PostgreSQL 17.2. π§β We are going to fix this in the next steps.
admin user bash prompt:```
\q
```
```
pg_lsclusters
```
~ > Expected output if you have not performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (unlikely):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
```
~ > Expected output if you have performed a full upgrade of the MiniBolt with sudo apt update && sudo apt full-upgrade since 26/09/2024 (most likely):
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5432 online postgres /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
17 main 5433 down postgres /var/lib/postgresql/17/main /var/log/postgresql/postgresql-17-main.log
```
Update PostgreSQL
If you haven't done so before, make sure to update the OS (PostgreSQL included to the latest version 17):
admin, fully update the OS with the package manager:```
sudo apt update && sudo apt full-upgrade
```
~ > Press "y" and enter or directly enter when the prompt asks you.
#### PostgreSQL server migration
```
sudo systemctl stop postgresql@16-main postgresql@17-main
```
```
sudo mkdir /data/postgresdb/17
```
```
sudo chown postgres:postgres /data/postgresdb/17
```
```
sudo chmod 700 /data/postgresdb/17
```
```
sudo -u postgres pg_dropcluster 17 main
```
```
sudo systemctl daemon-reload
```
```
sudo -u postgres pg_upgradecluster 16 main /data/postgresdb/17
```
~ > β This may take a lot of time depending on the existing database size (the nostr relay database especially) and your machine's performance; it is recommended to use [tmux](https://github.com/tmux/tmux). Wait until the prompt shows up again.
Example of expected output:
```
Restarting old cluster with restricted connections...
Notice: extra pg_ctl/postgres options given, bypassing systemctl for start operation
Creating new PostgreSQL cluster 17/main ...
/usr/lib/postgresql/17/bin/initdb -D /data/postgresdb/17 --auth-local peer --auth-host scram-sha-256 --no-instructions --encoding UTF8 --lc-collate enUS.UTF-8 --lc-ctype enUS.UTF-8 --locale-provider libc
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /data/postgresdb/17 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Warning: systemd does not know about the new cluster yet. Operations like "service postgresql start" will not handle it. To fix, run:
sudo systemctl daemon-reload
Copying old configuration files...
Copying old start.conf...
Copying old pg_ctl.conf...
Starting new cluster...
Notice: extra pg_ctl/postgres options given, bypassing systemctl for start operation
Running init phase upgrade hook scripts ...
Roles, databases, schemas, ACLs...
set_config
(1 row)
set_config
(1 row)
Fixing hardcoded library paths for stored procedures...
Upgrading database postgres...
Fixing hardcoded library paths for stored procedures...
Upgrading database template1...
Stopping target cluster...
Stopping old cluster...
Disabling automatic startup of old cluster...
Starting upgraded cluster on port 5432...
Warning: the cluster will not be running as a systemd service. Consider using systemctl:
sudo systemctl start postgresql@17-main
Running finish phase upgrade hook scripts ...
vacuumdb: processing database "postgres": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "template1": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "postgres": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "template1": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "postgres": Generating default (full) optimizer statistics
vacuumdb: processing database "template1": Generating default (full) optimizer statistics
Success. Please check that the upgraded cluster works. If it does,
you can remove the old cluster with
pg_dropcluster 16 main
Ver Cluster Port Status Owner Data directory Log file
16 main 5433 down postgres /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
Ver Cluster Port Status Owner Data directory Log file
17 main 5432 online postgres /data/postgresdb/17 /var/log/postgresql/postgresql-17-main.log
```
```
sudo systemctl daemon-reload
```
```
pg_lsclusters
```
Expected output:
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5433 down <unknown> /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
17 main 5432 online <unknown> /data/postgresdb/17 /var/log/postgresql/postgresql-17-main.log
```
~> Notes:
pg_ctlcluster tool, to then be able to run it and manage it with systemd:```
sudo pg_ctlcluster 17 main stop
```
```
pg_lsclusters
```
Expected output:
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5433 down <unknown> /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
17 main 5432 down <unknown> /data/postgresdb/17 /var/log/postgresql/postgresql-17-main.log
```
~> Note how the version 17 cluster has gone into status "down".
```
sudo systemctl start postgresql@17-main
```
systemd:```
journalctl -fu postgresql@17-main
```
Expected output:
```
minibolt systemd[1]: Starting PostgreSQL Cluster 17-main...
minibolt systemd[1]: Started PostgreSQL Cluster 17-main.
```
~ > Press Ctrl + C to continue.
```
pg_lsclusters
```
Expected output:
```
Ver Cluster Port Status Owner Data directory Log file
16 main 5433 down <unknown> /data/postgresdb/16 /var/log/postgresql/postgresql-16-main.log
17 main 5432 online <unknown> /data/postgresdb/17 /var/log/postgresql/postgresql-17-main.log
```
~> Note how the version 17 cluster has come back into the status "online".
```
sudo pg_dropcluster 16 main
```
```
pg_lsclusters
```
Expected output:
```
Ver Cluster Port Status Owner Data directory Log file
17 main 5432 online <unknown> /data/postgresdb/17 /var/log/postgresql/postgresql-17-main.log
```
~> Note how it no longer appears version 16 (old and disused) cluster.
Check the PostgreSQL server version in use
admin, enter the psql (PostgreSQL CLI):```
sudo -u postgres psql
```
```
SELECT version();
```
Example of expected output:
```
version
PostgreSQL 17.2 (Ubuntu 17.2-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
(1 row)
```
~ > Check the previous version in use is now PostgreSQL 17.2 (the latest and current version of the PostgreSQL server at this moment).
admin user bash prompt:```
\q
```
```
sudo systemctl start lnd nbxplorer btcpay thunderhub scb-backup nostr-relay cloudflared
```
> Check all works fine with the logs of each service, especially lnd > journalctl -fu lnd.
```
sudo rm -rf /tmp/postgresdb-temp
```
```
sudo apt autoremove
```
~ > Press "y" and ENTER when needed or ENTER directly when the prompts ask you.
β That's it! If you have any questions or issues, you can go to any RRSS available for the MiniBolt project > [HERE](https://minibolt.minibolt.info/#community) <
Only for MiniBolters! Enjoy it! π