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

Distribute Lemmy via crates.io #1674

Merged
merged 2 commits into from
Aug 11, 2021
Merged

Distribute Lemmy via crates.io #1674

merged 2 commits into from
Aug 11, 2021

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Jul 24, 2021

This is a much better way to distribute Lemmy for native (dockerless) installation, as it avoids having to clone the git repository. I already pushed our code to crates.io/crates/lemmy_server. Note that the code there is not an actual RC, but simply the last commit on main (so it definitely shouldnt be used in production yet).

Assuming that you already have postgres and cargo installed and configured, installing Lemmy is as simple as:

cargo install lemmy_server --version 0.11.3-rc.5
mkdir -p lemmy/config
echo -e "{\n  hostname: example.com\n}" > config/config.hjson
lemmy_server

Todo:

  • Contact crates.io support to increase publishing rate limit (we have too many crates)
    • not necessary, the rate limit is high enough (i just uploaded too many crates and versions while testing)
  • Improve cargo-publish.sh script
  • Add more package metadata (authors, keywords, categories etc)
  • Run cargo-publish.sh in CI for releases
  • Rewrite documentation to use cargo install
  • Maybe get lemmy-ui published on npmjs.com
  • Try to get pictrs published on crates.io

@dessalines
Copy link
Member

Could you make this a draft PR until you think its ready to go.

@Nutomic Nutomic changed the title Distribute Lemmy via crates.io WIP: Distribute Lemmy via crates.io Jul 31, 2021
@Nutomic
Copy link
Member Author

Nutomic commented Jul 31, 2021

Dont think I can change that for an existing PR, but i marked it as wip.

@dessalines dessalines marked this pull request as draft July 31, 2021 13:35
@dessalines
Copy link
Member

Its a hard button to find, instead of being right above this box like the "Ready for review", they stuck it on the top right sidebar below reviewers. You won't see it now cause I converted it.

@Nutomic
Copy link
Member Author

Nutomic commented Aug 5, 2021

I gave this another try, turns out I only ran into the rate limit because I uploaded too many crates and versions during testing. This time it worked without problems in one go. So I suggest that you review the changes in Cargo.toml and scripts/cargo-publish.sh, and merge it if those look fine.

For the next minor release, we just need to cherry-pick this commit, and I will run the script after you make the release. Or we can integrate it directly into the release script if you dont mind waiting for every Lemmy crate to do a clean build. After doing this manually a few times, we can probably integrate it in CI.

I will continue by updating the docs.

Edit: or actually I can do the publishing via ci as part of this pr

@Nutomic Nutomic changed the title WIP: Distribute Lemmy via crates.io Distribute Lemmy via crates.io Aug 5, 2021
@Nutomic Nutomic marked this pull request as ready for review August 5, 2021 14:45
@Nutomic Nutomic marked this pull request as draft August 5, 2021 19:12
@dessalines
Copy link
Member

I'll wait for the publishing then, it does make sense for that to be done through the CI.

@Nutomic
Copy link
Member Author

Nutomic commented Aug 9, 2021

Okay I integrated it in deploy.sh and .drone.yml so it should be ready. I just dont know whats the best way to test it.

@Nutomic Nutomic marked this pull request as ready for review August 9, 2021 15:40
Comment on lines +23 to +35
# Update crate versions for crates.io
for crate in crates/*; do
pushd $crate
# update version of the crate itself (only first occurence)
# https://stackoverflow.com/a/9453461
sed -i "0,/version = \"$old_tag\"/s//version = \"$new_tag\"/g" Cargo.toml
# update version of lemmy dependencies
sed -i "s/{ version = \"=$old_tag\", path/{ version = \"=$new_tag\", path/g" Cargo.toml
popd
done
# same as above, for the main cargo.toml
sed -i "s/{ version = \"=$old_tag\", path/{ version = \"=$new_tag\", path/g" Cargo.toml
sed -i "s/version = \"$old_tag\"/version = \"$new_tag\"/g" Cargo.toml
Copy link
Member

Choose a reason for hiding this comment

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

Hope this works well.

Copy link
Member Author

Choose a reason for hiding this comment

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

We should definitely make an alpha/beta release to test it first.

Copy link
Member

Choose a reason for hiding this comment

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

Lets leave that for v0.12.0

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.

None yet

2 participants