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

Add support for scripts during initialization #8337

Closed
wants to merge 1 commit into from

Conversation

vk496
Copy link

@vk496 vk496 commented Aug 12, 2021

This functionality was suggested by #387 (comment)
I saw @Caian PR #6577 after, so I publish my suggestion anyway

This patch will enable more complex init patterns during the IPFS first initialization. The scripts under /docker-prehook.d directory will be executed just after all env initialization and BEFORE running ipfs daemon. If there were no errors, it will execute the ipfs daemon. AFTER running ipfs daemon (10 seconds) it will execute all scripts under /docker-posthook.d and kill the main ipfs process if any script failed.

Btw, I'm not sure if the documentation of this functionality should go to the README.md or to https://github.com/ipfs/ipfs-docs/

@BigLep
Copy link
Contributor

BigLep commented Aug 27, 2021

@olizilla or @gmas : does the help from an infra regard? We wanted to check to see if this would be useful.

Also, is this approach preferred over #8326 ?

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @vk496 for poking at this!

If we remove posthook due to sleep 10 (see comment inline), this PR feels redundant.
Let's continue in @Caian's PR #6577 instead.

init_scripts /docker-prehook.d

# Post-hook init scripts
{ sleep 10; init_scripts /docker-posthook.d ; } &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate stage after sleeping for 10 seconds feels brittle. Could not be enough if my node runs on slow CI and takes longer time to init/start etc.

I feel we don't need a separate directory with posthooks executed after a hardcoded delay. If anything, we would be waiting for node to start (eg. by probing /api/v0/id on the API port etc).

@lidel lidel closed this Sep 3, 2021
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.

3 participants