-
- Notifications
You must be signed in to change notification settings - Fork 209
Install pg_jsonschema v0.1.0 #254
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ansible task is a best effort but might have some issues. Is there a way to check it in CI without merging to develop?
What I usually do is spin up the latest image, SSH in, and attempt to install the extension using the steps outlined in the task.
Other than that, we'll just need to:
- Remove
ansible/tasks/postgres-extensions/.21-pg_jsonschema.yml.swp
and add*.swp
in.gitignore
. - Rename
21-pg_jsonschema.yml
and anything related to it name-wise to22-pg_jsonschema.yml
as 21-auto_explain.yml already exists. - Bump common.vars.pkr.hcl to the next version.
tags: | ||
- rust | ||
| ||
- name: install cargo-pgx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following error was returned upon running this step:
Error: 0: problem running initdb: "/usr/lib/postgresql/bin/initdb" "-D" "/root/.pgx/data-14" initdb: error: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
Would there be any implications if all the steps here aside from the downloading and installation of dependencies were to be performed by the postgres
Linux user (which I'm assuming should be owning the server process)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have tested running everything as the postgres
Linux user and it looks to be working. Only hitch is that we would have to temporarily grant the postgres
Linux user ownership of /usr/lib/postgresql/lib
to ensure cargo pgx install --release
is fully installed. Else, the following error would be returned:
Error: 0: failed copying `/tmp/pg_jsonschema/target/release/libpg_jsonschema.so` to `/usr/lib/postgresql/lib/pg_jsonschema.so` 1: Permission denied (os error 13) Location: /home/postgres/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgx-0.4.5/src/command/install.rs:234 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0: cargo_pgx::command::install::install_extension with pg_version=14.14 release=true test=false features=["pg14"] at /home/postgres/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgx-0.4.5/src/command/install.rs:84 1: cargo_pgx::command::install::execute at /home/postgres/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgx-0.4.5/src/command/install.rs:51
Should be okay since we're returning ownership to the root
Linux user afterward. @olirice which OS user do you use for these steps when following the installation in the pg_jsonschema readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The installation instructions in the readme are more for trying it vs a release so the OS user can be the user who ran cargo pgx init
when setting up the pgx
framework
tested running everything as the postgres Linux user and it looks to be working. Only hitch is that we would have to temporarily grant the postgres Linux user ownership of /usr/lib/postgresql/lib to ensure cargo pgx install --release is fully installed
Could you please please push that change to this branch? I'm not clear how to do it
Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com>
Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com>
@dragarcia thanks for the feedback! I made the changes you mentioned in all of the comments except the one that is still unresolved
do you run the actual ansible script for that, or copy/paste the commands? |
- ensure certain steps are run by the postgres Linux user - temporarily grant ownership for certain directories to the postgres Linux user
The latter. More precisely, I would first come up with the steps in the form of shell commands, run each of these steps to ensure that they're working as expected, then translate them into Ansible tasks. |
* install pg_jsonschema v0.1.0 * tabs to spaces * Update ansible/tasks/postgres-extensions/21-pg_jsonschema.yml Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com> * Update ansible/tasks/postgres-extensions/21-pg_jsonschema.yml Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com> * remove and ignore swp files * pg_jsonschema task 21 -> 22 * bump img version * remaining steps - ensure certain steps are run by the postgres Linux user - temporarily grant ownership for certain directories to the postgres Linux user Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com>
* install pg_jsonschema v0.1.0 * tabs to spaces * Update ansible/tasks/postgres-extensions/21-pg_jsonschema.yml Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com> * Update ansible/tasks/postgres-extensions/21-pg_jsonschema.yml Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com> * remove and ignore swp files * pg_jsonschema task 21 -> 22 * bump img version * remaining steps - ensure certain steps are run by the postgres Linux user - temporarily grant ownership for certain directories to the postgres Linux user Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com>
* install pg_jsonschema v0.1.0 * tabs to spaces * Update ansible/tasks/postgres-extensions/21-pg_jsonschema.yml Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com> * Update ansible/tasks/postgres-extensions/21-pg_jsonschema.yml Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com> * remove and ignore swp files * pg_jsonschema task 21 -> 22 * bump img version * remaining steps - ensure certain steps are run by the postgres Linux user - temporarily grant ownership for certain directories to the postgres Linux user Co-authored-by: dragarcia <Angelico.delosreyes@gmail.com>
Installs pg_jsonschema v0.1.0
The ansible task is a best effort but might have some issues. Is there a way to check it in CI without merging to develop?