Comments (9)
Oh! I must have missed that when looking for "hooks" in the issue tracker :)
@andir probably because it's a PR, not an issue :)
from morph.
see also #84
from morph.
see also #84
Oh! I must have missed that when looking for "hooks" in the issue tracker :)
from morph.
Hi there,
Thanks for the suggestion. The request is not entirely new to us, but we've talked about experimenting with HTTP based hooks first, since the security implications are easier to reason about from the morph side of things.
That aside, could you expand a bit on your suggestions? For instance..
- Do you imagine these hooks being run on the local host or the remote host? Or should that be configurable?
- What should happen when a hook fails for some reason?
- Should morph support multiple scripts per hook, and if so, what about ordering of them?
Hooks would be awesome to implement, but it can also get pretty hairy if we try to do everything at once. I think it might be worth just throwing something together as a start (maybe even only or two hook points), and add it to master behind some --experimental
flags, so that we can iterate on it without making people think that it's a done feature.
from morph.
Oh! I must have missed that when looking for "hooks" in the issue tracker :)
Don't worry, the draft is really rough, and it has pretty much gathered dust since nixcon. :-(
from morph.
Thanks for the suggestion. The request is not entirely new to us, but we've talked about experimenting with HTTP based hooks first, since the security implications are easier to reason about from the morph side of things.
That is probably a valid concern but I fear it will end up becoming too big of a monster for most/many users. I do not know what the distribution of morph users currently looks like (how many machines, private, single/multi-admin, β¦). In my personal circle of friends we are mostly a few people that run hobbyist projects using morph. Having to run a webserver locally just to get some hooks done might not be feasible.
Edit: Remember the thing that many people probably like about morph (besides not being legacy python codeβ¦) is that it is stateless and lightweight. That would no longer be the case if you have to run a webserver to get some hooks going.
If you are talking about web hook that also means that we need the full range of:
- specifying the HTTP verb
- specifying arbitrary headers (potentially depending on some secret, local session file, β¦)
- specify some way to describe the payload. You probably do not want to send the same content over and over again. So this will probably get us into templating hell.
All of that could probably avoided when just inventing our own protocol to send events to some foreign system.
That aside, could you expand a bit on your suggestions? For instance..
* Do you imagine these hooks being run on the local host or the remote host? Or should that be configurable?
I would currently only support local commands. Remote commands are more properly encapsulated in systemd (one-shot) services on the remote target. We shouldn't try to reinvent the activation scripts.
* What should happen when a hook fails for some reason?
I would fail (or even better rollback) the deployment. If a build fails, no harm is done. Execute a build failed hook (or similar), if set.
* Should morph support multiple scripts per hook, and if so, what about ordering of them?
My initial idea would be to have the same mechnasim as in nixpkgs and allow people to mkForce
an option to remove prior values if they intend to set a new set of complete hooks (of a specific kind).
e.g. { server.deployment.hooks.postBuild = mkForce [ ./script.sh ]; }
if you only want script.sh
to run after the build.
Hooks would be awesome to implement, but it can also get pretty hairy if we try to do everything at once. I think it might be worth just throwing something together as a start (maybe even only or two hook points), and add it to master behind some
--experimental
flags, so that we can iterate on it without making people think that it's a done feature.
Agreed, I would only start small. Maybe we need to figure out how we can cut the morph deployments into more logical phases
and then follow the intuition one gathers from stdenv
where there is post$Phase
, pre$Phase
etc.. hooks.
from morph.
Maybe we need to figure out how we can cut the morph deployments into more logical
phases
and then follow the intuition one gathers fromstdenv
where there ispost$Phase
,pre$Phase
etc.. hooks.
We've been thinking about "morph 2.x" for some time, basically turning morph from nested if-then-else spaghetti, to features made from composable primitives. Maybe those two are related?
(not actually ignoring the rest you wrote, but I wanted to reply to this specifically)
from morph.
Maybe we need to figure out how we can cut the morph deployments into more logical
phases
and then follow the intuition one gathers fromstdenv
where there ispost$Phase
,pre$Phase
etc.. hooks.We've been thinking about "morph 2.x" for some time, basically turning morph from nested if-then-else spaghetti, to features made from composable primitives. Maybe those two are related?
(not actually ignoring the rest you wrote, but I wanted to reply to this specifically)
I thik so. A fast paced development and actually getting rid of some legacy rather then trying to stick with some old design forever sounds good.
from morph.
I'm also looking into more tightly integrating morph into our deployment's workflow, and this seems what could work for us.
Our need is to just keep track of what and when the different phases of the deployments happens and orchestrate some small setup/clean-up of the systems.
Is there still some interest to move forward this solution, or better ideas have come up in the meantime?
from morph.
Related Issues (20)
- How to configure non-native target? HOT 1
- Document what names are not possible as machine names.
- Deployment is slow HOT 2
- Morph requires experimental nix-commands to be enabled HOT 5
- Push nodes into their own attrset
- A Question on morph and nix.autoUpgrade HOT 8
- set targetHost at runtime
- add `?compress=true` to ssh store urls
- Require Nix 2.4? HOT 2
- warning: The extraArgs argument to eval-config.nix is deprecated HOT 1
- Check for target host disk space before copying
- Maintaining a per-host gc-root
- Issues with repairing broken path in server HOT 6
- How to use repl to inspect configs? HOT 2
- (option to) use `nix build` instead of `nix-build` HOT 1
- Support alternative sudo authentication methods
- Enhance README with an example and instructions? HOT 1
- Error when building system, caused by extraModuleSources
- Connection fails when deploying, but works outside of morph HOT 1
- `bash: make-build: command not found` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from morph.