-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Upgrading Firefox Sync Server to Syncstorage-rs #5939
Comments
@th0ma7, I was reading the Wiki page Using wheels to distribute Python packages but was not clear on whether this project needed wheels or not. Given my research above, what are your thoughts? |
@mreid-tt my last try to build syncstorage-rs is almost 2 years ago (with version 0.10.2) The challenge will be to have python, rust and go available at the same time to build the package. (I recently got similar issues when trying to build homeassistant with prebuilt python and prebuilt ffmpeg - or some time ago I was trying to create a package that needs native/nodejs and native/go to build and AFAICR it was tricky to set the PATH for those tools to be accessible...) Hopefully a syncserver-rs package will not only be available for x64, because there you can use the docker solution. |
@hgy59, thanks for the feedback. This is an area I'm not familiar with at all so I was seeking advice on how to start. I gather that the combination of Rust and Python is not something we cater for but was hoping we could use this as a test case to maybe support it.
I believe it should be available on whichever platforms support Python and Rust. For the proof of concept in Ubuntu that was done on an ARM CPU as shown below:
|
This combination is working, at least to build wheels that depend on rust (like cryptography). |
Hey @hgy59, I've been exploring examples in the Wiki and our packages regarding building with Rust in spksrc, but haven't found many useful ones. Reflecting on my manual build experience, I'd like to share my thoughts on what a potential package approach could entail. I'd appreciate your feedback to ensure I'm heading in the right direction.
|
I am a little bit confused about the order of your list 😄 (namely the first point).
those are installer functions that can be used in service-setup.sh (in service_postinst).
It looks like this is a regular dependency (rust crate) of syncserver-rs and must not be built separately (included in the next point).
The regular usecase is to build a cross/syncserver-rs package with
To find the pure-python and crossenv requirement, I have created a script (generate_requirements.sh). I normally use it in homeassistant (with some hundreds of requirements) like this, with a file consolidated requirements_all.txt as source:
This will temp. create a virtual env with native/python311 and generate three files:
This script (attached below) saved me a lot of time, before I did this within the venv of the installed packages under DSM...
Just some of my experiance... |
@mreid-tt |
@hgy59 I believe you've pretty much covered it all. I do agree to disagree with you relatively to Relatively to your script, it is rather nice and we would benefit from having it within the spksrc framework directly. Perhaps under a Personnally I'm used to manually look https://pypi.org/ and searching for the package needed under the download section you'll find wether it provides But @mreid-tt including wheels requires a few trials and errors. Having a non-x86_64 NAS helps fully testing things as it usually won't find any pre-built correspondance online, thus defaulting at using the local file for installation (whereas x86_64 will always download online version). I've made a few shortcuts to help re-building just the wheel portions such as |
@hgy59, @th0ma7 thanks for the advice. I must admit that some of this is over my head but I'm happy to continue learning. I've made an initial update PR #5942 to incorporate some of these ideas. The first build failed but I didn't expect it to work right out the box. Do let me know if you have any thoughts on my PR. |
@mreid-tt regarding the (python) requirements, forgot to mension that in spk/python311/Makefile and spk/python311/src/requirements-crossenv.txt you find commented instructions for dedicated wheels.
and related definitions in Makefile:
for cryptography you have to find a solution, since only newer version with rust build is documented. So And you have to add all requirements (that are indirect dependencies), not only the python modules that are in the requirements files of syncstorage-rs source code. while looking at python311 now, I am unsure, whether mysqclient is already delivered with the python311 package or not (@th0ma7 is it?). |
@mreid-tt another hint. If you replace and define some variables, you can benefit of the latest improvements by @th0ma7 to depend on prebuilt python in spk/python311. If you build spk/python311 for each arch you develop, then you must not rebuild python after a make clean in spk/ffsync. This is a huge speed up of development cycle. You find related code in the Makefile of tvheadend, homeassistant and other packages. |
@hgy59 you'll notice in the
Indeed thnx for bringing that up (brain is still stuck in covid glue...) - I believe @hgy59 explained it well, but just to be clear, @mreid-tt in order to use optimally you must build python311 (i.e. For it to work properly, in your project you'll also need to define which python package you're referring to with:
Then later when calling A really simple example with no dependencies as being python only is |
@hgy59 what's the issue are you referring to with |
reading the requirements.txt, it tells that a rather old This will probably not work with cross/cryptography or needs a different version... and there are some ENV variables ( |
Humm, interesting one indeed. Digging into the py310 crossenv file history we got stuck to version 3.3.2 of cryptography a hell of a long time until we sorted out rust builds. So indeed version 3.4.8 may be a little challenging although I believe it only needs setting up the following environment variables in your Makefile like all other build <40 used to:
Question really is, is it even compatible with py311 in the first place? |
@hgy59, @th0ma7, thank you both for your detailed feedback. It will take me a bit to go through this as I am not very familiar with these type of builds (but I do want to learn). Meanwhile, I've observed a common trend in the builds currently encountering failures, primarily stemming from the following error:
Looking online i found this rust-lang/cargo#7599 (comment), which suggests that to way to address this is:
The challenge is that I don't think we currently have a way to pass arguments to the build. Looking at the codebase I see this example: Line 20 in 146723d
The problem is that within the spksrc/mk/spksrc.cross-rust.mk Lines 52 to 53 in 146723d
This suggests to me that without the ability to set a path in the build configuration, the |
First things that comes to mind, you do have a few options, you could first play with the actual mk files and temporary hard-code your changes and/or you can augment existing variables when applicable (using |
@th0ma7, thanks for the recommendation. I opted to first explore the route of using Line 21 in 146723d
Trying this syntax of a comma-separated string however didn't work. Looking at the documentation for Environment variables Cargo reads we note that:
So that example would not work. Moreover, based on the build.rustflags documentation the use of extra flags is mutually exclusive of other sources. I found this to be the case that the For this I added a handler to process the The rust compilation however did not complete as it is now complaining of:
I suspect that the fixes above for python will likely contribute to resolving this compile error. I'll work on this some more tomorrow. |
You may be missing the
|
@hgy59, so I broke up the requirements into 'pure' and 'crossenv' using manual lookups at https://pypi.org/. One project (pyfxa) didn't have any build distributions (so I assumed 'pure') and another (sqlalchemy) had both (so I left it in 'pure' and 'crossenv'). Let me now if the Makefile is correct for their reference. Regarding adding these also to the
@th0ma7, so I added this to both the EDIT: Further discussion on the implementation will be continued under the PR #5942. |
Background
When looking at the Firefox Sync Server source repo, I see it is no longer maintained and has since been rewritten in Rust under a new repo Syncstorage-rs.
I am considering that given the significant changes this could be a new package (subject to discussion).
Manual deployment test
I've documented a complete install from scratch in Ubuntu 22.04 as a proof of concept. I will need assistance in translating some of these ideas to a SynoCommunity package.
Prerequisite 1 - MySQL
Prerequisite 2 - Rust
Install dependencies
Source: https://github.com/mozilla-services/syncstorage-rs#system-requirements
Install Python virtual environment
Install diesel
Clone and build
Setup Python virtual environment
Initialize the Database
Run initial database migrations
Add sync endpoint to database
Add syncserver node
Setup syncserver config file
Run the server
Configure Firefox
identity.sync.tokenserver.uri
to http://localhost:8000/1.0/sync/1.5References
Main source: https://artemis.sh/2023/03/27/firefox-syncstorage-rs.html
Additional: https://gitlab.com/agile-penguin/syncstorage-rs_rhel/-/blob/main/HowTo_syncstorage_rhel_EN.md
The text was updated successfully, but these errors were encountered: