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

Atomic Data #15

Open
fricklerhandwerk opened this issue Jul 13, 2023 · 13 comments
Open

Atomic Data #15

fricklerhandwerk opened this issue Jul 13, 2023 · 13 comments
Assignees
Labels
NGI0 Entrust Funded through NGI Zero Entrust package Create a Nix package service Create a NixOS service module

Comments

@fricklerhandwerk
Copy link
Collaborator

fricklerhandwerk commented Jul 13, 2023

Atomic Data is a modular specification for sharing, modifying and modeling graph data. It combines the ease of use of JSON, the connectivity of RDF (linked data) and the reliability of type-safety.

This project is actively developed, and the lead is interested in collaboration. We will figure out the best way to approach this, and it may involve some sort of onboarding if an upstream Nix setup is desired.

@fricklerhandwerk fricklerhandwerk added package Create a Nix package service Create a NixOS service module NGI0 Entrust Funded through NGI Zero Entrust labels Jul 13, 2023
@joepio
Copy link

joepio commented Jul 17, 2023

Hi! Awesome that you want to help out :)

I'll first make sure both Atomic-Server and Atomic-Data-Browser codebases are combined into one monorepo.

@fricklerhandwerk
Copy link
Collaborator Author

We can start with packaging the Rust backend, and then continue with the Typescript frontend when it's merged. Then testing both components in integration as well as building a module to run the service on NixOS would be possible.

@joepio
Copy link

joepio commented Jul 31, 2023

It's merged! It's now one monorepo. Check the dockerfile for how it's currently built. Let me know if I can help in any way!

Thank you :)

@albertchae
Copy link
Contributor

@ngi-nix/moss is claiming this. We will ask you about any questions we have about the project as we learn more about it @joepio !

@albertchae
Copy link
Contributor

Brainstorming a plan of action (not necessarily in order):

albertchae added a commit to ngi-nix/atomic-server that referenced this issue Oct 5, 2023
This should help with some of the tools we are trying to use to package
this for Summer of Nix as part of ngi-nix/ngipkgs#15

One unclear thing is that https://github.com/atomicdata-dev/atomic-server/releases/tag/v0.34.3
is tagged in git as 0.34.3 but the title of the release is 0.34.5. Not
sure if that is a typo, but we went with the git tag.

Co-authored-by: Jason Odoom <jasonodoom@gmail.com>
Co-authored-by: Anish Lakhwara <anish+git@lakhwara.com>
Co-authored-by: Dominic Mills <dominic.millz27@gmail.com>
Co-authored-by: Albert Chae <albertchae@users.noreply.github.com>
Co-authored-by: Jack Leightcap <jack@leightcap.com>
@albertchae
Copy link
Contributor

Summarizing where we are right now:
https://github.com/atomicdata-dev/atomic-server has 5 components

  • lib is a Rust library so will be compiled from source by components that need it, so it doesn't need to be packaged separately
  • server and cli have been packaged in Init: {atomic-server, atomic-cli} at 0.34.5 #62
  • We are currently working on browser (and desktop depends on this via tauri).

The current challenge with browser is that dependencies are packaged via pnpm, which has poor support for Nix at the moment (https://github.com/nix-community/pnpm2nix is old and outdated, at minimum we need to use this fork for compatibility with the latest version of pnpm nix-community/pnpm2nix#26). One of the issues with pnpm2nix is that it expects a version key in package.json. We have had trouble trying to patch this while building in Nix, so we have submitted a PR to add this in atomicdata-dev/atomic-server#673

Another approach we are exploring is converting pnpm-lock.yaml into an equivalent package-lock.json (npm) or yarn.lock.

@joepio we also noticed there is a bun.lockb checked in. Is bun an "officially" supported way to install dependencies for browser too and is it kept in sync with pnpm-lock.yaml? Because according to https://bun.sh/docs/install/lockfile, we can have bun additionally export a yarn.lock using bun install --yarn, which could be easier than using the pnpm-lock-export tool.

joepio pushed a commit to atomicdata-dev/atomic-server that referenced this issue Oct 6, 2023
This should help with some of the tools we are trying to use to package
this for Summer of Nix as part of ngi-nix/ngipkgs#15

One unclear thing is that https://github.com/atomicdata-dev/atomic-server/releases/tag/v0.34.3
is tagged in git as 0.34.3 but the title of the release is 0.34.5. Not
sure if that is a typo, but we went with the git tag.

Co-authored-by: Jason Odoom <jasonodoom@gmail.com>
Co-authored-by: Anish Lakhwara <anish+git@lakhwara.com>
Co-authored-by: Dominic Mills <dominic.millz27@gmail.com>
Co-authored-by: Albert Chae <albertchae@users.noreply.github.com>
Co-authored-by: Jack Leightcap <jack@leightcap.com>
@albertchae
Copy link
Contributor

@joepio another question, for running browser, do we only need the artifacts in data-browser/dist or do we need to copy over various node_modules as well? I couldn't tell if dependencies were getting bundled into the artifacts of data-browser/dist, but based on the Dockerfile of the current monorepo AND the build script from the old repo, it looks like that's all we need.

@joepio
Copy link

joepio commented Oct 8, 2023

@joepio another question, for running browser, do we only need the artifacts in data-browser/dist or do we need to copy over various node_modules as well?

yes! Only the dist folder is needed to compile atomic-server

Is bun an "officially" supported way to install dependencies for browser too and is it kept in sync with pnpm-lock.yaml?

Hmm... No, not yet, but as soon as Bun Test supports the features I need (e.g .toHaveBeenCalledWith) I'll probably migrate. I don't expect this to take very long. So I don't know if it makes more sense for you to assume the bun scenario.

Also, perhaps interesting - I spent some time last weekend setting up an earthfile. Could be useful inspiration?

@jleightcap
Copy link
Collaborator

jleightcap commented Oct 12, 2023

Summarizing some recent progress:

  • we managed to compile the pnpm lockfiles into a yarn.lock we have committed.
  • we can verify that Nix pulls in these dependencies in an "offline cache"
  • when building the three sub-components in turn (lib > react > data-browser), we've noticed that the yarn.lock we've generated is not the union of all required packages.
  • the top-level package.json does not contain all dependencies declared in lib package.json (e.g. whatwg-fetch, cross-fetch).
  • the first error hit is the tsc binary not being in scope, which means we're successfully working around not having a pnpm builder.
  • however, we believe that we need to generate a lockfile per-subdependency, not just a single lockfile from the main package.json.

@fricklerhandwerk
Copy link
Collaborator Author

@joepio is migrating to Bun still an option for you? This would likely make it easier on our end to finish packaging, otherwise we'll have to make a detour of creating tooling to deal with pnpm.

@joepio
Copy link

joepio commented Jan 16, 2024

@fricklerhandwerk Hmm looks like bun now has support for the testing methods so maybe it can replce pnpm! I'll work on it today.

Related

@joepio
Copy link

joepio commented Jan 16, 2024

WIP PR

@albertchae
Copy link
Contributor

Reviving this issue!

Recap

@ngi-nix/moss picked this up towards the end of Summer of Nix 2023 and we were not able to finish packaging it by the end of the program. Sorry for not posting a final status update at the end.

We were still stuck on figuring out how to get pnpm + nix working. We wanted to consider bun as an alternative but it looks like it was rejected in the upstream project atomicdata-dev/atomic-server#806

Now

@Chickensoupwithrice and I picked this issue back up as part of our extension work.

First we updated the existing packaging to the latest releases from the upstream project
#162
#163

There seems to have been more activity with getting pnpm to work with nix and we should be able to use it directly instead of transforming it to npm or yarn as we were investigating before .

nix-community/pnpm2nix#26 (comment) leads us to

We decided to explore using https://github.com/nzbr/pnpm2nix-nzbr. We are making good progress so far and hope to report more soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NGI0 Entrust Funded through NGI Zero Entrust package Create a Nix package service Create a NixOS service module
Projects
Status: mobilized
Development

No branches or pull requests

7 participants