onelson / estuary

33 stars 8 forks source link

GitLab and estuary on the same server #31

Closed soulflyman closed 2 years ago

soulflyman commented 2 years ago

Hi, I tried to install estuary on the same server where I already have GitLab installed and running. Estuary installed and runs without any error message. But when I run cargo login --registry estuary in my rust project folder, I get an error: error: no index found for registry: 'estuary' And yes, I added the registries and publish options to my cargo.toml.

Which port is used to access my index at http://rust-crates.dom.local/git/index ? When I enter the URL in a browser, GitLab is displayed because GitLab listens to port 80. Calling http://rust-crates.dom.local:7878/ from the browser does work and shows me a nearly blank estuary page.

So is there anything I can do to get it running besides my GitLab instance, or do I have to set up a new virtual machine for estuary only?

//soulflyman

onelson commented 2 years ago

The git index is served over HTTP on the same port as the Estuary UI, so if you're running Estuary with the port 7878.

So, for your specific case, I think your cargo registry config should look like:

[registries]
estuary = { index = "http://rust-crates.dom.local:7878/git/index" }

Does that make sense?

I'll take another look at the guidance in the readme to see if I can make this more clear.

soulflyman commented 2 years ago

Hm, I also tried adding the port to the registries URL, but with no success.

$ curl -i http://rust-crates.dom.local:7878/git/index
HTTP/1.1 404 Not Found
content-length: 0
date: Wed, 24 Aug 2022 07:24:39 GMT
$ curl -i http://rust-crates.dom.local:7878
HTTP/1.1 200 OK
content-length: 239
content-type: text/html; charset=utf-8
date: Wed, 24 Aug 2022 07:26:44 GMT

<!doctype html>
<html lang="en">
<head>
    <title>Estuary</title>
</head>
<body>
<h1>Estuary</h1>
<h3>

    25 Most Recent Publishes:

</h3>
<ul>

</ul>

<p>
    <a href="?all=true">Show All Publishes</a>
</p>

</body>
</html>

So if the registries URL .../git/index is just called by HTTP, then the curl command should work and not print a 404.

Here is a list of the commands I use to start estuary for testing, but all gave me a 404:

$ estuary --base-url http://rust-crates.dom.local --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/

$ estuary --base-url http://rust-crates.dom.local --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/ --http-host 192.168.1.222

$ estuary --base-url http://rust-crates.dom.local:7878 --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/

$ estuary --base-url http://rust-crates.dom.local:7878 --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/ --http-host 192.168.1.222

$ estuary --base-url rust-crates.dom.local --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/

$ estuary --base-url rust-crates.dom.local --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/ --http-host 192.168.1.222

$ estuary --base-url rust-crates.dom.local:7878 --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/

$ estuary --base-url rust-crates.dom.local:7878 --crate-dir /mnt/nas/estuary/crates/ --index-dir /mnt/nas/estuary/index/ --http-host 192.168.1.222

Since it should listen on Port 7878 by default, I don't think anymore that this is related to GitLab. But I don't know how to test or debug it any further

My Cargo.toml looks like this:

[package]
name = "private-test-lib"
version = "0.0.9999"
edition = "2021"
publish = ["estuary"]

[registries]
estuary = { index = "http://rust-crates.dom.local:7878/git/index" }

[dependencies]
chrono = "0.4"
toml = "0.5"
serde =  { version = "1.0", features = ["derive"] }
lettre = "0.9"
lettre_email = "0.9"
gethostname = "0.2"
winreg = "0.10"
native-tls = "0.2"
lazy_static = "1.4"
dirs = "4.0"
config = "0.13"
$ tree /mnt/nas/estuary
/mnt/nas/estuary
├── crates
└── index
    └── config.json

2 directories, 1 file
$ cat index/config.json
{
  "dl":"http://rust-crates.dom.local/api/v1/crates/{crate}/{version}/download",
  "api":"http://rust-crates.dom.local"
}
onelson commented 2 years ago

Before digging any deeper, could you instead try making your GET request to http://rust-crates.dom.local:7878/git/index/info/refs?service=git-upload-pack (instead of just http://rust-crates.dom.local:7878/git/index).

There's no handler configured for /git/index itself so I'd expect it to be a 404 for you.

Edit: I also notice your index/config.json contains URLs without the port number, but I think that file will be updated automatically if you start Estuary with the port number correctly set in the --base-url flag.

soulflyman commented 2 years ago

Ok, I think we narrow it down...

Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: " to save to a file.


But cargo login still shows an error:
```console
$ cargo login --registry estuary
error: no index found for registry: `estuary`
onelson commented 2 years ago

Something I noticed in your Cargo.toml was you had:

[registries]
estuary = { index = "http://rust-crates.dom.local:7878/git/index" }

Typically this information goes inside a .cargo/config file, not your package's Cargo.toml.

I notice I get the same message as you do when I try to login to a registry which hasn't been configured:

$ cargo login --registry foo
error: no index found for registry: `foo`
soulflyman commented 2 years ago

Thank you very much, [registries] was indeed in the wrong file. This solved my problems and I have successfully published a crate on my local estuary instance.

Thank you again for your patience and the excellent support.