w4 / gitlab-cargo-shim

🦀 Say goodbye to your Git dependencies, host a Cargo registry using the GitLab package repository
Do What The F*ck You Want To Public License
81 stars 8 forks source link

Documentation on setup #40

Open MarcoStb1993 opened 1 year ago

MarcoStb1993 commented 1 year ago

First of all, thanks for making this publicly available!

Unfortunately, I have very limited experience with the GitLab package registry but would like to use gitlab-cargo-shim to deploy multiple Rust crates to a repository to serve as a private crates.io replacement.

I have the following questions which would probably be helpful for newcomers like me to use this project:

  1. How do I setup your code and use it? Do I have to deploy the provided docker on the server-side and adjust it to provide a config? The available documentation directly jumps on how to use it but skips the setup.
  2. Which commands could I use to test it out manually first instead of using a CI pipeline directly?
w4 commented 1 year ago

Hi @MarcoStb1993,

This application should be run on a server with access to your GitLab instance, in a place which can be accessed by your clients.

Using the registry locally is as simple as the README makes it out to be, you just need to the reference to the server hosting gitlab-cargo-shim to your .cargo/config.toml and you can start declaring dependencies against it.

Let me know how you get on

Thanks

xulai1001 commented 6 months ago

The README is indeed quite unclear, and the Dockerfile won't work due to file permission issues. (is "nobody" user broken?)

Say, in .cargo/config.toml, the actual registry index string would be: index = "ssh://gitlab-ci-token:$GITLAB-CI-TOKEN@{shim server address}/{gitlab-project-path}" The use of "sed" and "gitlab-cargo-shim.local" placeholders are bewildering.

Besides, it would be helpful to showcase the "config.json" file provided by the index within the shim server. The contents of this file may explain how cargo APIs are actually invoked, or where to find actual ".crate" files.

xulai1001 commented 6 months ago

Another question about "admin token" configuration in the shim config.toml file. If an admin token with "sudo" and "impersonation" privileges are given, is it possible to "shorten" the index address to: index = "ssh://{shim server address}/{gitlab project path} and expect the impersonation token to do the actual job?

Unfortunately, I was using a Gitlab-like platform, which could only grant "project token read/write" and "package registry r/w" privileges to a user token, not "sudo". I could only use a personal CI token instead.