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

curl on signed key for a repo as per repo instructions results in a 404 Not Found. #22

Closed
radhaksri opened this issue Aug 12, 2024 · 14 comments

Comments

@radhaksri
Copy link

radhaksri commented Aug 12, 2024

Steps to reproduce:

  1. Launch openrepo as per https://github.com/openkilt/openrepo#getting-started:
wget https://raw.githubusercontent.com/openkilt/openrepo/master/docker-compose.yml`
docker compose up -d
  1. Open the web ui, create a signed key, login with admin/ admin, setup a repository and associate the repo with the signed key.
  2. From the repo instructions, try this curl command

curl http://127.0.0.1:7376/test-repo/public.gpg

  1. The curl command results in a 404 Not Found.
@radhaksri
Copy link
Author

@matthill , @denisgolius, @k0ste , @inistor : Any pointers about how I can fix / workaround this?

@inistor
Copy link
Contributor

inistor commented Aug 12, 2024

If you access https://127.0.0.1:7376/cfg/repo/test-repo from a browser, do you get the GUI?
Could you please post the docker logs for all containers?
docker compose logs > allcontainers.log from the folder containing docker-compose.yaml

@radhaksri
Copy link
Author

Repeated the exercise and collected logs/ screenshots:

all_containers_launch.log
all_containers_test.log

all_containers_launch.log : logs right after a clean docker compose up -d. No login, no test repo/ signing key created.
all_containers_test.log: logs collected after logging in with admin/ admin, creating a test signingkey, creating a repo and trying to do a curl.

Screenshots:

Screenshot 2024-08-12 092253
Screenshot 2024-08-12 092308
Screenshot 2024-08-12 092424
Screenshot 2024-08-12 092439

p.s: 192.168.56.102 is the IP address of my dev VM.

@inistor
Copy link
Contributor

inistor commented Aug 12, 2024

There's a problem with your DB container, apparently:

From the init log:

django-1  | psycopg2.OperationalError: connection to server at "db" (172.18.0.2), port 5432 failed: Connection refused
django-1  | 	Is the server running on that host and accepting TCP/IP connections?

From the launch log:

db-1      | initdb: warning: enabling "trust" authentication for local connections
django-1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django-1  | psycopg2.OperationalError: connection to server at "db" (172.18.0.2), port 5432 failed: Connection refused
django-1  | 	Is the server running on that host and accepting TCP/IP connections?

In the docker-compose.yaml, there's a DB container which should be running. For some reason, it's not running (or it's not accessible by the other containers).

I still don't understand how you were able to access the GUI - the logs you sent pretty much only include DB errors

@inistor
Copy link
Contributor

inistor commented Aug 12, 2024

Actually, I might be wrong and that's before the DB starts; however, I don't see the logs of the nginx container

@inistor
Copy link
Contributor

inistor commented Aug 12, 2024

If you can acces the GUI, please check the build status.
Click on the link with the icon: image

The worker container should be generating the repository structure in the required form, based what you created in the GUI; from there, the nginx container should serve it directly; you can clearly reach the nginx container, however the repository structure is not generated; also, have you uploaded any packages?

@radhaksri
Copy link
Author

Noticed those errors in django container - I think the django container was trying to do operations much before the db container is up and running. I think the db container should have a healthcheck that establishes that the db is up and running, which the django container can rely upon properly. Something like this - https://github.com/peter-evans/docker-compose-healthcheck - maybe?

There's a problem with your DB container, apparently:

From the init log:

django-1  | psycopg2.OperationalError: connection to server at "db" (172.18.0.2), port 5432 failed: Connection refused
django-1  | 	Is the server running on that host and accepting TCP/IP connections?

From the launch log:

db-1      | initdb: warning: enabling "trust" authentication for local connections
django-1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django-1  | psycopg2.OperationalError: connection to server at "db" (172.18.0.2), port 5432 failed: Connection refused
django-1  | 	Is the server running on that host and accepting TCP/IP connections?

In the docker-compose.yaml, there's a DB container which should be running. For some reason, it's not running (or it's not accessible by the other containers).

I still don't understand how you were able to access the GUI - the logs you sent pretty much only include DB errors

@radhaksri
Copy link
Author

radhaksri commented Aug 12, 2024

No, I do not have any packages uploaded at the moment. Will try the same after doing so, and report what I see. I can access the web ui, btw.

If you can acces the GUI, please check the build status. Click on the link with the icon: image

The worker container should be generating the repository structure in the required form, based what you created in the GUI; from there, the nginx container should serve it directly; you can clearly reach the nginx container, however the repository structure is not generated; also, have you uploaded any packages?

@radhaksri
Copy link
Author

I think uploading a package fixed it. I see statements in the build output that is writing the gpg key to the directory.

Screenshots of the build log:

Screenshot 2024-08-12 104301
Screenshot 2024-08-12 104316

@inistor
Copy link
Contributor

inistor commented Aug 12, 2024

Great. Sorry for the confusion with the DB connection, I was mislead by the logs.

@radhaksri
Copy link
Author

A question though: Shouldn't the gpg key be accessible irrespective of the repo being empty? A probable enhancement?

@radhaksri
Copy link
Author

Thanks for the help here, @inistor !

@radhaksri
Copy link
Author

Created a PR #23 to address this issue.

Noticed those errors in django container - I think the django container was trying to do operations much before the db container is up and running. I think the db container should have a healthcheck that establishes that the db is up and running, which the django container can rely upon properly. Something like this - https://github.com/peter-evans/docker-compose-healthcheck - maybe?

There's a problem with your DB container, apparently:
From the init log:

django-1  | psycopg2.OperationalError: connection to server at "db" (172.18.0.2), port 5432 failed: Connection refused
django-1  | 	Is the server running on that host and accepting TCP/IP connections?

From the launch log:

db-1      | initdb: warning: enabling "trust" authentication for local connections
django-1  |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django-1  | psycopg2.OperationalError: connection to server at "db" (172.18.0.2), port 5432 failed: Connection refused
django-1  | 	Is the server running on that host and accepting TCP/IP connections?

In the docker-compose.yaml, there's a DB container which should be running. For some reason, it's not running (or it's not accessible by the other containers).
I still don't understand how you were able to access the GUI - the logs you sent pretty much only include DB errors

@radhaksri
Copy link
Author

Created an enhancement request: #24 to track this. Will close this issue here.

A question though: Shouldn't the gpg key be accessible irrespective of the repo being empty? A probable enhancement?

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

No branches or pull requests

2 participants