mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-06 08:56:45 -05:00
[GH-ISSUE #1287] Pangctl and API trouble #1838
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jackrosenberg on GitHub (Aug 16, 2025).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/1287
I am in the proccess of making an automated test for pangolin (NixOS) and am running into some trouble.
pangctl set-admin-credentials --email "admin@example.test" --password "Password123!"results in:
Which seems pretty clear,
userdoes not exist. However, runningsqlite3 /var/lib/pangolin/config/db/db.sqlite.tablesgives:I think this causes the following command (to create an Org thru the API), to fail as well. The error message is a little vague however, so it could be anything.
VPS: (finished: must succeed: curl -H 'Authorization: Bearer fbon8g22m7uf8q2.mwpnq3r5ul3h5w25fskwmkvqe4eysha54admqqci' -H 'Content-Type: application/json' -H 'accept: */*' -X PUT -d '{"name":"test","orgId":"test","subnet":"100.90.128.0/24"}' --url http://localhost:3004/v1/org, in 0.19 seconds)VPS: {"data":null,"success":false,"error":true,"message":"An error occurred","status":500,"stack":null}Am i doing something wrong here?
@oschwartz10612 commented on GitHub (Aug 16, 2025):
It feels like it is not running the migrations before you run the cli
command. But
It does seem to be doing that?
What is your order of operations? I suppose you are running Pangolin
container then running the cli command or are you running the cli
command before properly starting the container. Wondering if that could
be the cause?
@jackrosenberg commented on GitHub (Aug 16, 2025):
The cli command only runs after the pangolin service is online. I checked the
__drizzle_migrationstable as well, and it wasn't empty, which leads me to believe the migrating were run@jackrosenberg commented on GitHub (Aug 17, 2025):
This may also be part of the issue, since I only get this while running in the testing VM...
@oschwartz10612 commented on GitHub (Aug 31, 2025):
Sorry for the delay? Is this at all different on 1.9.2 - we do have the
setup token thing now.
@SigmaSquadron commented on GitHub (Aug 31, 2025):
The setup token still requires you to open an HTML page and log-in interactively. We're setting up automated OS-level tests for the entire Pangolin stack, which means we need some way to interact with Pangolin without using a web browser. API keys are perfect for that, but we cannot generate them without first logging in.
@jackrosenberg commented on GitHub (Aug 31, 2025):
We've gone through a couple iterations now, and are still running into some problems. The general flow is this:
On the VPS:
On the privateHost
Step 4 is failing.
A 400 is quite ambiguous, do you have any idea where this error is coming from @oschwartz10612 ?
@jackrosenberg commented on GitHub (Aug 31, 2025):
I tested this with my existing pangolin install, and it connects. This leads me to believe that somewhere along the way we are missing database inserts/ something similar. Could you provide me a flow of either database inserts or api calls that are needed for everything to work?
@oschwartz10612 commented on GitHub (Sep 1, 2025):
Yeah I get it! Setup token makes this harder. Maybe we can get a PR
together to create the admin user in the cli with a different command?
On the site thing: are you creating the newt? There needs to be an entry
in the newt table with the hashed secret which is kind of hard to do in
pure sqlite.
How are you with TS? Ill accept any PRs you want into the CLI to create
sites and newts and stuff if you would like. I can also help with them
if you would like. I think we would want to have a create newt one
because you need to do that hash step before its inserted into the db.
Loving all of the work you are doing on this. Once you get it to work if
you want to make some sort of test suite in a github action we could run
as a integration test that would be the coolest thing! :}
@jackrosenberg commented on GitHub (Sep 1, 2025):
Yea honestly this sounds like the best approach.
I'm inserting the API key, and adding permissions to it via sql, then creating an org and site via the API.
Hahah damn, i got around that hash step by just using my actual (old) admin API key ;). I agree doing it the proper way is more elegant. I'll try and cook something up :)
Thanks :) @SigmaSquadron too! You guys are making some very cool software.
Sure! I'll need to do some homework to see exactly how NixOS does that, but the tests are all yours if you want them! Link to the current NixOS PR, the testing flow is somewhat explained there. (nixos/tests/pangolin.nix)
@oschwartz10612 commented on GitHub (Sep 1, 2025):
Hum this should be hashing it into the DB I think then. The API route
does this as a mater of creating the newt. I just wanted to make sure
you were not just creating them with sql. I would expect the hashing to
not be a problem here... You should see what looks like a crypto hash of
the secret in the newt table.
Thinking about it more - 400 is a bad request error. Pangolin probably
does not like something. Try newt in debug mode if not already it MAY
print out the actual error from pangolin - if not this is a long
standing issue I have needed to fix to get it to actually tell you the
response. Are there any logs in pangolin about why 400?
Love it great @SigmaSquadron! Yeah the plan is to follow something like
Grafana's model as much as possible.
@jackrosenberg commented on GitHub (Sep 1, 2025):
The following yields:
$ sqlite3 /var/lib/pangolin/config/db/db.sqlite 'select * from orgs; select * from newt; select * from sites'These are the logs from pangolin, nothing else on the rest of the stack:
@jackrosenberg commented on GitHub (Sep 5, 2025):
Additionally,
"pangctl set-admin-credentials --email \"admin@example.test\" --password \"Password123!\"")results in:
@jackrosenberg commented on GitHub (Sep 9, 2025):
@oschwartz10612 do you have any idea what could be causing this?
@github-actions[bot] commented on GitHub (Sep 24, 2025):
This issue has been automatically marked as stale due to 14 days of inactivity. It will be closed in 14 days if no further activity occurs.
@miloschwartz commented on GitHub (Sep 27, 2025):
I'm jumping in late here, but maybe the CLI command is running before the migrations are complete? If you set up Pangolin manually, start it, and wait for the info logs to print that it's fully online, then run the CLI command does it work?
@github-actions[bot] commented on GitHub (Oct 12, 2025):
This issue has been automatically marked as stale due to 14 days of inactivity. It will be closed in 14 days if no further activity occurs.
@github-actions[bot] commented on GitHub (Oct 26, 2025):
This issue has been automatically closed due to inactivity. If you believe this is still relevant, please open a new issue with up-to-date information.