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

[WIP] Add PostgreSQL service #126

Closed
wants to merge 1 commit into from

Conversation

flexibeast
Copy link
Contributor

Cf. #121.

Also, have you had a chance to look into using execline to derive PGDATA from PGROOT, as per this comment?

@mobinmob
Copy link
Owner

mobinmob commented Oct 17, 2021

Thank you!

Some suggestions:

  1. Please see if it is possible to do the redirection (2>&1) at the top of the script, so we can get all the messages in the per-service logger - that is the standard behaviour for execline scripts in @execute.
  2. echo works fine, I suggest giving a shot at 66-yeller ;)
  3. You can probably use execl-toc more, especially if you want to turn the @execute into an execline script in the future. Lines 34-36 can be:
execl-toc -f /etc/postgresql/postgresql.conf
  ln -sf /etc/postgresql/postgresql.conf "$PGDATA/postgresql.conf"

I like using execl-toc as an alternative to test a lot :P

When using 66-yeller and execl-toc in place of other tools, -v can be very useful in debugging scripts.

  1. I have been racking my brain for a simple and widely available way to avoid sourcing in order to obtain variables in both execline and shell scripts. shdotenv is not widely available, execl-envfile does not handle doublequotes (for now). execline's envfile does. Maybe you can use the latter?

Cf. #121.

Also, have you had a chance to look into using execline to derive PGDATA from PGROOT, as per this comment?

I have not looked into it yet :(

@flexibeast
Copy link
Contributor Author

Thanks for the feedback! i've now updated the PR:

  • Added exec 2>&1.
  • Replaced usages of echo with 66-yeller.
  • Used execl-toc in the place you suggested - i'd meant to add that already, oops!
  • Replaced the sourcing of /etc/default/postgresql with a call to envfile, and combined this with execline-style variable setting:
envfile /etc/default/postgresql
importas PGDATA PGROOT
export PGDATA ${PGDATA}/run

which certainly works when called from the command line (i.e. execlineb -c '...').

However, i've not yet tested all this in a QEMU VM - i've almost finished setting one up for this purpose, and will get back to you asap with the test outcome. :-)

@mobinmob
Copy link
Owner

mobinmob commented Oct 18, 2021

@flexibeast
I did some testing and I am pretty sure we should not try to make a service for postgresql, but seperate services for postgresql releases (postgres12, postgres13). The postgres template is quite old (last commit in 2016) and the newer templates have binaries and configuration files in versioned dirs.
The new runit services also do not have minor issues (such as calling su with conflicting switches).
Many thanks to @linuxergr for pointing out that different postgres versions have different services.

@flexibeast
Copy link
Contributor Author

@mobinmob: Ah, okay. Hm. So should i convert this PR to one for (say) postgres12?

@mobinmob
Copy link
Owner

mobinmob commented Oct 19, 2021

@mobinmob: Ah, okay. Hm. So should i convert this PR to one for (say) postgres12?

I think that makes sense :)
You can also use this PR for both 12&13 services if you want - the contents of @execute should be pretty close.

@mobinmob mobinmob deleted the branch mobinmob:devel February 6, 2022 18:24
@mobinmob mobinmob closed this Feb 6, 2022
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

Successfully merging this pull request may close these issues.

2 participants