-
Notifications
You must be signed in to change notification settings - Fork 4
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
Replacing docker-compose with Nix for development #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flow is pretty good!
I'd mention and link to https://nixos.asia/en/flake-parts in some capacity.
en/replacing-docker-compose.md
Outdated
### Redis | ||
|
||
Redis and its clustered version are pretty straightforward: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand this to say what this provides? How does the redis cluster operate? How many nodes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en/replacing-docker-compose.md
Outdated
|
||
Ever since I first started using [[nix]], I have enjoyed the [[why-dev|simplicity of setup]]: `nix develop`, make the code change and see it work. That's all well and good, but when your project keeps growing, you need to depend on external services like databases, message brokers, etc. And then a quick search will tell you that [docker](https://www.docker.com/) is the way to go. You include it, [add one more step](https://github.com/nammayatri/nammayatri/tree/f056bb994fbf9adefa454319032ca35c34ea65bc/Backend#other-tools) in the setup guide, increasing the barrier to entry for new contributors. Not to forget, eating up all my system resources on my not so powerful, company provided, macOS[^native-macos]. | ||
|
||
This, along with the fact that we can provide one command to do a lot of **cool things** (which you will see, as you continue to read), made us want to replace [docker-compose](https://docs.docker.com/compose/) with Nix in [Nammayatri](https://github.com/nammayatri/nammayatri) (to keep it simple, I will refer to it as NY from now on). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A brief intro to what NY project is (perhaps as a [!note]
) is useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en/replacing-docker-compose.md
Outdated
Here's the screen grab of the devShell and the commands to run loadtest and the entire backend: | ||
:::{.center} | ||
![[ny-devshell.png]] | ||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People unfamiliar with mission-control may not be able to relate to this. So maybe we should just mention the nix run
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en/replacing-docker-compose.md
Outdated
|
||
By not depending on docker anymore, we can now run the entire NY backend with one command and its all defined in a [single place](https://github.com/nammayatri/nammayatri/blob/ccab8da607cfd8d4e9f7d28b55b83e22eec1af9b/Backend/nix/services/nammayatri.nix). | ||
|
||
That is not all, we can also reuse this to do much more, like defining [loadtest](https://github.com/nammayatri/nammayatri/blob/ccab8da607cfd8d4e9f7d28b55b83e22eec1af9b/Backend/load-test/default.nix) config and run it in CI/local, again, with one command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it in scope for this blog post to expand on the loadtest? In particular, emphasizing on how users can share services-flake modules, and then build on top of them. Here, we take the module to run entire NY stack, and then extend it to add a bunch of load-test processes, before bringing the whole thing end (as the load-test ends).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good idea to mention load-test because it is one of the things we are able to do as a result of adding services-flake. If that complicates things, I can probably remove it and talk about it in another post explaining how you can reuse services, courtesy of flake-parts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add a sentence or two introducing the users about it, and then dedicate another post on it as you see fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied the second half from your comment to expand on load-test
One more thing: At the end of the post, I'd also include link to our Zulip for people wanting to 'comment' on the post. (Though perhaps eventually we should include a after-note template for it; let me think about this) |
copied srid's suggestion for load-test from his comment: #28 (comment)
Preview: