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

Reentrant script #35

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Reentrant script #35

wants to merge 6 commits into from

Conversation

jericson
Copy link

@jericson jericson commented Nov 9, 2022

If you run the script once, it starts PostgreSQL so that the second time you run it the script fails. The solutions is to use restart rather than start. That way it will ensure the sever is started whether or not it's already running. (One possible downside is if you don't want PostgreSQL to go down because you've installed Discourse. In that case, you probably shouldn't be using this script.)

There's also a prompt to reinstall Ruby that means you must reinstall or the scrip will just stop. Add the -s option skips installation if rbenv sees that version is already installed.

Finally, I changed from start to restart for the Redis server too. It doesn't fail if Redis is already running, but if you happen to update Redis, that update won't go into effect until you restart the server.

When running the script multiple times (because, say, ruby won't install properly), it will fail to start Postgres if it's already started. I believe this version of the command works whether Postgres has been started in the past or not.
Restart rather than start Postgres
If you already have the designated version of Ruby, just skip this step. Without this option, you must wait for Ruby to be needlessly reinstalled each time you run the script. No real risk to skipping unless you have a screwed up install in the first place.
Skip if Ruby version already installed
Doesn't throw an error if Redis is already started, but doesn't update to the latest Redis if it's just been installed. (See: discourse/prometheus_exporter#250)
Restart rather than start Redis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant