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

how to use private git repository in cargo with gitlab crates-index #75

Closed
baoyachi opened this issue Jul 24, 2020 · 8 comments
Closed
Labels
C-question Category: Question

Comments

@baoyachi
Copy link
Contributor

I just read doc for alternate-registry.
but something was wrong. I just exec:cargo publish,but get failed message

➜  fuzz git:(master) ✗ cargo publish --registry=git-baoyachi --allow-dirty
    Updating `ssh://git@git.baoyachi.com/crates.git` index
warning: manifest has no description, license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
   Packaging fuzz v0.1.0 (/Users/baoyachi/git_project/fuzz)
   Verifying fuzz v0.1.0 (/Users/baoyachi/git_project/fuzz)
   Compiling fuzz v0.1.0 (/Users/baoyachi/git_project/fuzz/target/package/fuzz-0.1.0)
    Finished dev [unoptimized + debuginfo] target(s) in 1.14s
   Uploading fuzz v0.1.0 (/Users/baoyachi/git_project/fuzz)
error: failed to get a 200 OK response, got 404
headers:
	HTTP/2 404

	server: nginx

	date: Fri, 24 Jul 2020 03:38:10 GMT

	content-type: application/json; charset=utf-8

	content-length: 34

	x-request-id: xcvRDF0Ae15

	x-runtime: 0.018661



body:
{"status":404,"error":"Not Found"}
@jrb0001
Copy link

jrb0001 commented Jul 24, 2020

You need to put the URL to the git repo into .cargo/config and the config.json within that repo must contain the correct URLs to alexandrie. Everything just worked for me afterwards.

@Hirevo
Copy link
Owner

Hirevo commented Jul 25, 2020

Yeah, at first sight on the error output, I would suspect the cause of the error to be within the config.json file in your crate index.
Maybe it isn't pointing to the right endpoint.

@Hirevo Hirevo added the C-question Category: Question label Jul 25, 2020
@baoyachi
Copy link
Contributor Author

gitlab can do file storg ? not use database.

@Hirevo
Copy link
Owner

Hirevo commented Jul 25, 2020

A database is currently a requirement to have in Alexandrie, to serve as the source of truth in case of conflicts between the crate index and the crate storage (if they become out of sync) and/or for faster lookup of crate records.
If you want the least bothersome database option to setup, you can use the SQLite one, which is basically using a single file as your database.

The crate index is just expected to be a Git repository, so it can totally be hosted in GitLab without issues.

In the other hand, for the crate storage, we don't currently allow storing actual crate archives (the actual code of the crates) in a Git repository, because all of these archives can become quite large as a whole and I don't really see the benefit of versioning the crate storage (because the crate index, which is first consulted to lookup these archives, is already versioned).

@baoyachi
Copy link
Contributor Author

I'd like to be able to store crystals in a simple, lightweight way, but There was a problem with the configuration of that I'm here now config.json.I don't know how to solve it

@Hirevo
Copy link
Owner

Hirevo commented Jul 25, 2020

Your config.json file (living at the root of your crate index) should be of the following shape:

{
    "dl": "<link-to-your-instance-of-alexandrie>/api/v1/crates/{crate}/{version}/download",
    "api": "<link-to-your-instance-of-alexandrie>",
    "allowed-registries": [
        "https://github.com/rust-lang/crates.io-index",
        "<link-to-your-index-repository>"
    ]
}

where you should replace:

  • <link-to-your-instance-of-alexandrie>:
    This is the link to your live instance of Alexandrie.
    Using concrete examples:
    • for crates.io, this value is: https://crates.io.
    • for crates.polomack.eu (my own registry), this value is: https://crates.polomack.eu.
  • <link-to-your-index-repository>:
    This is the link to your crate index repository (the exact repository where this config.json file is living into).
    Using concrete examples:
    • for crates.io, this value is: https://github.com/rust-lang/crates.io-index.
    • for crates.polomack.eu, this value is: https://github.com/Hirevo/alexandrie-index.

Is that helpful ?
Also, have you managed to have an Alexandrie instance built and running, or have you encountered an issue on that front ?

@baoyachi
Copy link
Contributor Author

Your config.json file (living at the root of your crate index) should be of the following shape:

{
    "dl": "<link-to-your-instance-of-alexandrie>/api/v1/crates/{crate}/{version}/download",
    "api": "<link-to-your-instance-of-alexandrie>",
    "allowed-registries": [
        "https://github.com/rust-lang/crates.io-index",
        "<link-to-your-index-repository>"
    ]
}

where you should replace:

  • <link-to-your-instance-of-alexandrie>:
    This is the link to your live instance of Alexandrie.
    Using concrete examples:

    • for crates.io, this value is: https://crates.io.
    • for crates.polomack.eu (my own registry), this value is: https://crates.polomack.eu.
  • <link-to-your-index-repository>:
    This is the link to your crate index repository (the exact repository where this config.json file is living into).
    Using concrete examples:

    • for crates.io, this value is: https://github.com/rust-lang/crates.io-index.
    • for crates.polomack.eu, this value is: https://github.com/Hirevo/alexandrie-index.

Is that helpful ?
Also, have you managed to have an Alexandrie instance built and running, or have you encountered an issue on that front ?

Thanks to your help.
I just flow you step solved my problem.

But in the process, I found a few problems,related links are as follows

@Hirevo
Copy link
Owner

Hirevo commented Jul 31, 2020

Thanks for filing these additional issues (and even coming up for a PR to address one of them).
Since the original problem of this particular issue seems solved, I am going to close it.
Feel free to reopen it if it isn't the case.

@Hirevo Hirevo closed this as completed Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: Question
Projects
None yet
Development

No branches or pull requests

3 participants