-
Notifications
You must be signed in to change notification settings - Fork 58
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
How does Peril trigger an installation event? #362
Comments
I think you're running Peril entirely via the JSON repo settings, instead of in mongo - which means the installation should only be null during the setup call on launch. As to get all schedulable installations should just return your singleton installation. This is likely a concurrency issue, which should get solved this week. TBH, I'd wait it out on using this feature for maybe a week or two, it's next up on my list for pretty drastic refactoring - #363 #361 because I want to avoid keeping every installation's scheduler settings in memory. That said, I am interested in how often you were planning to schedule something, in #361 I spec'd out a few of the examples that I think I wanted but I'd love to know If that covers your cases too |
@orta I have a MongoDB setup in the Heroku instance, and the startup shows me that everything is running:
I can't figure out where the installation is actually intended to be created, but it seems like I either did something out of sequence or the installation event never fires. I'll add our use cases to #361 as well. Thanks! |
OK - yeah, so those installation create/updates get triggered right at the beginning of setup You can go to something like: http://github.com/organizations/gatsbyjs/settings/apps/ - find peril, find you installation of peril the app uninstall and re-install it the page should look something like this: That will trigger the right web hooks from GH to create the installation. I think I should add some better logs for that. Is it possible that your MongoDB instance is empty for installations completely? |
@orta Yeah, there's nothing in the DB. I'll do the uninstall/reinstall here, but maybe this would make a good check going forward, because I think what happened is I set up Peril, installed it for Gatsby, then realized scheduling was possible and added the MongoDB add-on. I imagine that'll be fairly common for people as they try out, then expand their Peril setup. I'm not exactly sure how this would work, but in pseudo-code, something like:
I'm making a lot of assumptions about how that could work, so take that with a grain of salt. 😄 |
Hah - yeah, I'm in this weird state where I can start making a single peril instance for everyone to use any one of these days, I just need to feel like my ideas are all complete - so hopefully all that faff can be managed by me. Agree though - that's a pretty easy check I'll add - kinda surprised you got this far without it, but I guess if you aren't using the separate docker-based runner it doesn't need to do a lot of the harder installation stuff |
Our installation is currently just running a few rules, but I do see occasional crashes that probably roll up to having that data missing. I'll let you know if I keep seeing those after this uninstall/reinstall. |
I don't think so, I refactored that a few months back and maybe it's possible that installation events are getting through into the danger runner - likely a case I didn't cover, it should still make the installation in mongo as that's before that code |
My mLab instance is still showing no collections except an empty |
The event it hooks up with is called |
OK, looks like Peril should be ignoring |
Ah, okay — both were fired and I got distracted by the 404. There's an installation event as well. Now I'm seeing a different error:
Presumably this is happening here? peril/source/github/events/create_installation.ts Lines 17 to 22 in d981dd7
I'm pushing up some logging to figure out if I'm right. |
I think so - yeah, I think #365 might fix that crash. It returns right after the calls |
My logging is coming back confusing.
This says the installation already exists, but it's missing the repos and other details, plus I can't find it in the MongoDB. I've verified that the MongoDB ID in the logs matches up with what I'm looking at, so I don't know what's going on over here. |
The changes in #365 fixed the crash. Still trying to figure out why my installation isn't in Mongo, but says it already exists. |
I think it's possible/likely that You can remove that, re-trigger the integration, then edit the JSON for the installation in Mongo to have a settings URL - but all of that feels bike-sheddy. It's an interesting problem, and I don't want crashes, but I'm reasonably sure that it's off-topic I still feel like the original problem lays in the async-ness of the launch setup between grabbing the JSON and storing it in-memory and the scheduler starting up. I'll fix this, but it'll be part of #361 which is a bit more involved but will work across my staging/prod builds and self-hosted The reasonable quick hack is just to throw a 5 second setInterval before launching the scheduler check :D |
Does that mean that if you have a MongoDB instance you can't configure the rules/tasks using a Peril settings file in GitHub? I'm happy to hold off scheduler stuff if this is on your roadmap, but to be clear, the workflow I'm hoping we can follow is:
Am I correct that this currently won't work due to the requirement of Thanks for all your help today! |
Nope, I think this isn't working because:
Just dodgy hacky code - the rest of it was just answering your questions and trying to not make peril crash. That setup should work (if you change |
Hi, team!
I'm trying to use the
scheduler
feature, but when I log theinstallations
variable here:peril/source/scheduler/startRepeatedTaskScheduler.ts
Lines 11 to 26 in ecd41ac
I get
[ null ]
, which I'm assuming means an installation was never created.Looking at how installations are created, I see this:
peril/source/plugins/installationLifeCycle.ts
Lines 16 to 22 in 2591f3d
But I'm not super clear on how to send the
created
action to get an installation created. Did I miss a step somewhere, or is there a doc that explains how to manually trigger an installation creation?It would also be great to get an idea of the general lifecycle: should the installation be checked/created on every Peril run, or only during a very specific phase?
Thanks for all your help!
The text was updated successfully, but these errors were encountered: