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

RFC: Bringing back the monorepo for rust services and main app #207

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

neilkakkar
Copy link
Contributor

@neilkakkar neilkakkar commented May 28, 2024

Looking for alignment on how to do this, and help on doing some of these changes

@neilkakkar neilkakkar marked this pull request as ready for review May 28, 2024 12:06
@neilkakkar neilkakkar changed the title RFC: Bringing back the monorepo RFC: Bringing back the monorepo for rust services and main app May 28, 2024
@neilkakkar neilkakkar requested review from benjackwhite and a team May 28, 2024 12:07
Copy link
Contributor

Choose a reason for hiding this comment

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

Only want to say big 👍 there are always downsides to a monorepo but in our current upsides the benefits far out way the cons (and we can always reverse it later).


Effectively, nothing should change for anyone developing on `hog-rs` currently, and people developing on main `posthog` repo should get more options to hook things up.

1. [ ] Introduce a `rust/` top-level folder that has all rust services
Copy link
Contributor

Choose a reason for hiding this comment

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

If we go with a rust top level it should make the whole "only run the CI for this code" quite straightforward.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also one thought - you could do this in the hog-rs repo first to test out that it works as expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

For a True Monorepo™ it would also be great to put everything which is not rust//plugin-server//plugin-transpiler/ under web/ – since it doesn't make sense that the plugin server and such are under the Django server in the hierarchy. Architecturally, they're all on the same level. (This is scope creep)


I'm not 100% sure yet how we want to migrate things over, or over what timeline.

Given hog-rs deploys happen manually right now, it seems de-risked enough to do it in one fell-swoop to minimise keeping-code-in-two-places-in-sync-pains. So I'd propose:
Copy link
Member

@Gilbert09 Gilbert09 May 28, 2024

Choose a reason for hiding this comment

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

All sounds good, except this. TIL we have to deploy hog-rs manually. If this was embedded within posthog/posthog then I would have assumed that deployments were automatic with the rest of the codebase. With hog-rs being a separate repo, I would have intentionally sought out how it got deployed

Copy link
Member

Choose a reason for hiding this comment

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

This is also likely a non-issue considering who edits hog-rs code at the moment - e.g. typically pipeline team who are already aware of this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct - eventually this will be automated, but for now it's good enough for hog-rs editors 👍

Given hog-rs deploys happen manually right now, it seems de-risked enough to do it in one fell-swoop to minimise keeping-code-in-two-places-in-sync-pains. So I'd propose:

1. [ ] Once we get alignment on the design above, we create a branch where we copy over current code, and try implementing the above things. If we need to merge to test (possible with CI shiz), copy over everything but the docker image build workflow.
2. [ ] Once the branch/folder is ready with the minimal required things, copy over all new code into the branch, merge, and stop CI in hog-rs. This does mean all existing PRs would need to move over as well.
Copy link

@bretthoerner bretthoerner May 28, 2024

Choose a reason for hiding this comment

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

Maybe you already planned to do this, but it would be nice to pull in the actual git repo so that we have accurate history, rather than just copying the code over and adding it.

I think the steps are roughly like:

  1. In posthog, git remote add the hog-rs repo
  2. Checkout the main branch from hog-rs
  3. Move everything into a rust dir and commit that, so that the only thing in the directory is rust
  4. Check out a posthog branch
  5. git merge the-hog-rs-branch --allow-unrelated-histories should in theory do a merge commit that just drops the rust directory into place, but with all of our history

(I riffed these notes and could be wrong, but I did do this when I merged our 2 rust repos into one. I can help if there are issues with the list above.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice, thanks!

@neilkakkar
Copy link
Contributor Author

not all the things have been done, but monorepo is here now, so merging this, we can incrementally improve the rest of the things when we want/need to!

@neilkakkar neilkakkar merged commit 2b2d96e into main Jun 20, 2024
@neilkakkar neilkakkar deleted the neilkakkar-patch-3 branch June 20, 2024 16:34
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.

6 participants