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

PG16 Issues with Timescale Toolkit #47

Open
jon-sully opened this issue Dec 7, 2023 · 3 comments
Open

PG16 Issues with Timescale Toolkit #47

jon-sully opened this issue Dec 7, 2023 · 3 comments

Comments

@jon-sully
Copy link

Howdy! I've had a hell of a couple of days trying to figure out what all is going on here, and I don't know that I'd even say I have successfully but I at least wanted to post back some notes.

So 3727aa7 bumped the Postgres version for TimescaleDB itself up to 16. 5f635cd quickly followed since the extension gets compiled as .dylib now, not a .so, and I think those layers work fine — installing Timescale DB via Homebrew on a fresh Homebrew Postgres (16) works fine.

Things do not work when you try to install the Toolkit after that. For starters, the Toolkit formula references PG15 instead of 16 in multiple places:

And hard-codes for the .so file extension here.

Though perhaps more problematically, the post-install script for the toolkit itself (not this repo) still looks for .so here and here

All of essentially prevent a new install of the Toolkit from running / working at all. 🙁

@jon-sully
Copy link
Author

Oh, and I think the formula needs to target toolkit v1.18.0 now instead of 1.17.0 too

url "https://github.com/timescale/timescaledb-toolkit/archive/refs/tags/1.17.0.tar.gz"

@jon-sully
Copy link
Author

In case anybody needs to get timescale toolkit installed in the meantime, here's the absolutely insane way I went about it.

First, open up the Homebrew formula (should be /opt/homebrew/Library/Taps/timescale/homebrew-tap/timescaledb-toolkit.rb) and edit the url on line 4 and sha256 on line 5 to:

url "https://github.com/timescale/timescaledb-toolkit/archive/refs/tags/1.18.0.tar.gz"
sha256 "f876fd8bdd5516237378e9c7556fec13740f5c8021911b1a8ceb8b1bde4c9cac"

Next, run brew install --interactive timescaledb-toolkit. It will yield a new shell session.

Now we start manually running the commands that the formula would (essentially) do anyway, just with correct version numbers and such.

curl -L https://github.com/pgcentralfoundation/pgrx/archive/refs/tags/v0.10.2.tar.gz -o cargo-pgrx.tar.gz
# then
mkdir pgrx
# then 
tar -xzf cargo-pgrx.tar.gz -C pgrx
# then 
cargo install --locked --path pgrx/pgrx-0.10.2/cargo-pgrx
# then 
cargo pgrx init --pg16 pg_config
# then
cd extension
# then 
cargo pgrx package
# then 
cd ..

Then we have to open up the post-install script from the toolkit code itself and edit it. However you prefer, but for VS code it's open -a Visual\ Studio\ Code tools/post-install/src/main.rs

We'll edit line #119 from "so" to "dylib" and lines 192 and 193 both from ".so" to ".dylib". Then save and close the file. We'll now run that post-install script:

cargo run --bin post-install -- --dir target/release/timescaledb_toolkit-pg16

Now, since the brew shell wouldn't let me move the actual extension files into the PG directory (🙄), the next step is to get your current tmp file path:

pwd
#=> /private/tmp/timescaledb-toolkit-20231207-79814-3k8arq

Then open a new shell of your own (with your normal user access, not one spun up by Homebrew for you) separate from the brew shell. DO NOT close or exit the brew shell yet. If you do, Brew will automatically delete all files (clean up) the /tmp directory it gave you. We still need those files.

So, open up a new shell / console in a new tab / pane / etc. and let's manually copy the extension files from the /tmp subdirectory they were just built in, into our Homebrew Postgres installation. Your version numbers may vary (so double check) but there are three commands:

# cp <from> <to>
cp /private/tmp/timescaledb-toolkit-20231207-79814-3k8arq/timescaledb-toolkit-1.18.0/target/release/timescaledb_toolkit-pg16/opt/homebrew/opt/postgresql@16/lib/postgresql/timescaledb_toolkit-1.18.0.dylib /opt/homebrew/Cellar/postgresql@16/16.1_1/lib/postgresql/

cp /private/tmp/timescaledb-toolkit-20231207-79814-3k8arq/timescaledb-toolkit-1.18.0/target/release/timescaledb_toolkit-pg16/opt/homebrew/opt/postgresql@16/share/postgresql@16/extension/timescaledb_toolkit--1.18.0.sql /opt/homebrew/Cellar/postgresql@16/16.1_1/share/postgresql@16/extension

cp /private/tmp/timescaledb-toolkit-20231207-79814-3k8arq/timescaledb-toolkit-1.18.0/target/release/timescaledb_toolkit-pg16/opt/homebrew/opt/postgresql@16/share/postgresql@16/extension/timescaledb_toolkit.control /opt/homebrew/Cellar/postgresql@16/16.1_1/share/postgresql@16/extension

Then we can close the Homebrew console session (which will automatically clean up the /tmp directory) by firing exit (Homebrew will say nothing was installed; that is fine)

@jonatas
Copy link
Contributor

jonatas commented Jul 10, 2024

Hey @jon-sully, thanks for documenting all your efforts here. It can be very useful for upgrading the actual instructions.

Also, I can say I face the same as a Mac user and as an alternative I'm using the timescaledb-ha docker image that contains the toolkit on pg16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants