Open n00rm opened 2 years ago
@n00rm First of all thanks for the feedback. I will try to reproduce the issue and have a look on this.
@n00rm please checkout the dev
branch and build a new docker image from the Dockerfile. It should work now. If you need any further assistance please let me know.
I also updated the README in the dev branch.
Hi @chris8838 and thanks for the quick reply and fix. On the dev branch the container is now starting up but I still struggle to get it to work. I defined the ENV Variables in the Dockerfile like this:
I'm aware that I disabled SSL Verify. I just want to test it. I created the custom fields and also the custom link like you described in the README file. But I still struggle to make it work.
This is the error output if I try to create a VM through Netprox via the custom link. VM name is test and I use the custom link button. And also the custom fields:
If I press the button I get redirected to netprox and get a Internal Server Error. Here is the debug log from the container:
root@ubuntu:~/netprox# docker run -p 5000:5000 netprox5
[2022-09-02 23:14:44 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2022-09-02 23:14:44 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2022-09-02 23:14:44 +0000] [1] [INFO] Using worker: sync
[2022-09-02 23:14:44 +0000] [8] [INFO] Booting worker with pid: 8
[2022-09-02 23:14:44 +0000] [9] [INFO] Booting worker with pid: 9
[2022-09-02 23:14:44 +0000] [10] [INFO] Booting worker with pid: 10
[2022-09-02 23:14:44 +0000] [11] [INFO] Booting worker with pid: 11
2022-09-02 23:14:45,131 - netprox_main - DEBUG - !Debug mode enabled, do not use this mode in production!
2022-09-02 23:14:45,131 - netprox_main - DEBUG - Flask loaded
2022-09-02 23:14:45,324 - netprox_main - DEBUG - !Debug mode enabled, do not use this mode in production!
2022-09-02 23:14:45,329 - netprox_main - DEBUG - Flask loaded
2022-09-02 23:14:45,370 - netprox_main - DEBUG - !Debug mode enabled, do not use this mode in production!
2022-09-02 23:14:45,370 - netprox_main - DEBUG - Flask loaded
2022-09-02 23:14:45,387 - netprox_main - DEBUG - !Debug mode enabled, do not use this mode in production!
2022-09-02 23:14:45,388 - netprox_main - DEBUG - Flask loaded
2022-09-02 23:14:51,476 - netprox_main - DEBUG - Received the following Header:
Host: XXX.XXX.XXX.XXX:5000
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5
Cookie: csrftoken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; sessionid=XXXXXXXXXXXXXXXXXXXXXXXXX
Dnt: 1
Sec-Gpc: 1
[2022-09-02 23:14:51 +0000] [10] [ERROR] Error handling request /webhook/create-vm-button?id=1
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2091, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/NetProx/netprox/main.py", line 160, in button
vm_id=netbox_vm_vmid,
File "/NetProx/netprox/classes/Core.py", line 65, in __init__
verify_ssl=ssl_verify,
File "/usr/local/lib/python3.7/site-packages/proxmoxer/core.py", line 154, in __init__
self._backend = importlib.import_module('.backends.%s' % backend, 'proxmoxer').Backend(host, service=service, **kwargs)
File "/usr/local/lib/python3.7/site-packages/proxmoxer/backends/https.py", line 222, in __init__
host, host_port = host.split(':')
ValueError: too many values to unpack (expected 2)
I hope this output helps to debug this issue.
One thing I still have problems to understand are the webhooks in netbox. Do I have to set them up or is it enough to just have the custom link?! A step by step installation/setup guide would be really helpful. I can assist you if I fully understand how it works. Thanks in advance!
@n00rm thanks for the feedback I will have a look on it. Yes a step-by-step guild is a good idea and is already in planning. One thing I want to mention is that I would recommend not to change the ENV variables in the Dockerfile. There are just placeholders. I would suggest to create a separate file e.g. env.list and put all your variables in there. Example of the content from a env.list file:
NETBOX_URL=https://netbox.myhome.org
PROXMOX_USER=admin
...
After you created the file you can start the container with the command docker run --env-file env.list -p 5000:5000 netprox5
.
This has the advantage that you don't need to build the container image all the time you need to change on of your ENV variables.
Can you send me the config of your Costume Link
configuration?
Hi, sorry for the late reply. Here is my custom link:
I only redacted the IP everything else is done like described in the instructions.
I have a feeling that I miss understood the webhook thingy. As stated in the instructions
"In order to let Netbox create a VM for you it is recommanded to create a Custome link that will trigger the webhook."
Which webhook? Can you clarify which webhook is sent where and maybe add a picture to better understand the communication. Do I have to create a webhook in netbox or is the custom link + custom fields enough? For my understanding this is how it works:
Here are my custom fields:
Thanks for your support! I'm thinking about to help with the documentation if I can get it to run 😅
Hi, I had a quick look into it and it may has something to do with the SSL verification for Proxmox. Do you use a self-signed certificate in Proxmox or a signed one?
To your question regarding the functionality: netprox basically provides and HTTP endpoint for the costume link in Netbox. So whenever you press the button you actually do a get request to an HTTP endpoint netprox provides.
Hi I tried to setup netprox but could not get it to run. I built a docker image from the provided Dockerfile. So far so got. When I try to start the image as a container I get a error message. I'm not really sure if I forgot something but I would really like to test out the software. Thanks in advance!
Error Output: