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
Devshell #759
Devshell #759
Conversation
Not in favor of this. It brings in another (non-systemd) service management framework which seems brittle and painful to maintain. |
I dunno, is there an easy way to run the various hydra components + postgres under systemd for a dev-only environment, without reconfiguring the whole system? I don't know of one. I'm pretty excited about this PR -- being able to enter the shell and run |
@edolstra I'll agree that it isn't perfect that this adds a dependency on an (already packaged) Ruby program. However:
I generally go by "perfection is the enemy of good". This isn't perfect but I think it is as good as it gets in terms of providing a really easy and convenient way of working with hydra. This also seems like a very relevant factor in attracting contributors and encouragement to work on Hydra. I am more than happy to demo it you if you want. it's quite nice, i promise ;) |
FWIW: I am happy to remove This isn't about introducing some novel way of running Hydra. This is strictly about improving the development workflow experience by providing an easy way to run hydra from your workspace without requiring any additional setup. I explored different ways (as did others, see the PRs i mentioned above) but this seems like the best solution to me. |
I've checked this PR out and it looks pretty good. I find Hydra pretty annoying to run, and "okay time to look at a bug in Hydra" always starts with a sigh and "okay ... where did I put my notes about how to dev Hydra?" If we create a |
I'm curious if there was inspiration from https://github.com/samueldr/hydra-in-a-bag or if it was only concurrent evolution of the same idea. In any case, it's great to see this in the upstream project, rather than a side-project. EDIT: and psst, yes, if there is anything useful, do feel inspired and take it! |
@samueldr hah, cool. Now that you mention it, i do remember this project! I was chatting with @andir and we explored some options that didn't lead anywhere. However graham had mentioned in passing that he once tried to use I do think i once tried your |
FWIW I wouldn't have a problem nixifying our solution in the same way that @samueldr chose. I think we have some improvements in the way how we wait for the database and that we don't have a separate DB initialization step. But all that could be adjusted. could be done. could also be done in a follow-up PR. But in any case only once if we can reach an agreement that this is desirable. |
Now that I have had some time to read through the discussion more in details, here's my thoughts. This is not a way to run a production or production-like Hydra instance. This is a way to compartmentalize a development instance of Hydra in a trivial manner, where its state is all self-contained. (In this approach the state is hidden in an hidden directory, which I think is probably a minor issue. Showing the state directory front and center would probably be better in exposing it to the user.) Now, I believe that this kind of self-contained and self-starting development environment is the basic courtesy we should give to anyone wanting to contribute to the Hydra project. Anything more complex to setup, requiring either a different host (server, vm) or a reconfiguration of the host system is a non-starter. It is too much friction to just fix a thing. Even more, this is a good way to get a test instance running to quickly just try something in Hydra. Assuming that this ends up being undesirable inside the Hydra project, I guess an -in-a-bag kind of setup at nix-community could do, but this reduces its discoverability. |
Yes please. For the use case of incremental development |
In theory it would be possible to use |
runHyda automatically starts hydra and postgres: ``` $ nix-shell -A runHydra ``` The shell receives hydra from the working copy as buildInput. Running hydra, queue-runner, evaluator and postgres is managed by foreman (https://github.com/ddollar/foreman) and configured in `Procfile`.
This adds a `devShell` which unlike `runHydra` doesn't start hydra automatically and doesn't receive hydra as build input. It is better suited for interactive development cycles: ``` $ nix-shell -A devShell $ ./bootstrap $ configurePhase $ make $ # hack hack hack $ foreman start # test test test <C-c> $ # hack hack hack ```
Use custom ports so hydra and postgres can run in environments where the default ports are in use already.
Add sections about using `runHydra` and `foreman`
Using `pg_ctl status` is more reliable than relying checking an open port via netcat.
Co-authored-by: Graham Christensen <graham@grahamc.com>
Execute hydra-dev-server instead of hydra-server Co-authored-by: Graham Christensen <graham@grahamc.com>
- scripts -> foreman - drop runHydra - drop devShell - move postgresql to buildInputs
- drop any mention of runHydra - link foreman and mention Procfile
@edolstra alright..
I could imagine to encapsulate everything with Nix in the same way that @samueldr does it with hydra-in-a-bag but I would prefer to try that separately and if it turns out well offer a follow-up PR for you/everyone to look at. |
Thanks @gilligan! |
Maybe I missed that announcement, but does Hydra work on anything that is not Linux + systemd? If yes, could you please add some docs on how to do it? |
It might work but it's not supported. |
overview
This PR adds a foreman based setup to easily start hydra from the working copy.
motivation
The goal of this PR is to make it dead simple to run Hydra from the working copy. This makes for a much better development and testing experience. It doesn't require any additional permissions, virtualization or networking.
foreman start
: this can be executed in the nix-shell when you don't want to make us of incremental builds viamake
. It uses all hydra binaries from the working copy.details
foreman
which can be used to start all required hydra services and postgresqlProcfile