Giter Site home page Giter Site logo

Comments (8)

ironiq avatar ironiq commented on June 12, 2024 1

Actually i tested it on CentOS7 with rh-python38 and Netbox 3.4.1. This setup works, i did the same thing what @tyler-8 mentioned in his opening comment. Unfortunately i cannot test other setup.

from ansible-role-netbox.

lae avatar lae commented on June 12, 2024

So I believe there was a reason why we used uwsgi from package repositories instead of within the virtualenv, but I can't quite remember why. I think it might have had something to do with compilation, possibly? Maybe missing features or maybe just the actual amount of time it takes to install uwsgi (faster to keep a single version externally than build it every time a new netbox release comes out).

which doesn't have any awareness of the venv as currently written.

This isn't exactly true. I'm pretty sure uwsgi itself is aware of the virtualenv and drops into it, per the uwsgi.ini.j2 template. (also /usr/bin/env is not intended to be in anyway related to virtualenvs)

Where exactly are you trying to gain more flexibility? Inside the virtualenv?

from ansible-role-netbox.

tyler-8 avatar tyler-8 commented on June 12, 2024

reason why we used uwsgi from package repositories instead of within the virtualenv

It's still being installed via pip, just not in a venv.

faster to keep a single version externally than build it every time a new netbox release comes out

This seems like a negligible difference compared to the overall install process, uwsgi doesn't take a notably longer time to build than most other non-wheel packages I don't think.

This isn't exactly true. I'm pretty sure uwsgi itself is aware of the virtualenv and drops into it ... Where exactly are you trying to gain more flexibility? Inside the virtualenv?

What kicked off this exploration was I was testing with new Python versions installed via pyenv. I install pyenv and a new Python version before calling this role, then pointed netbox_python_binary to the new binary and was getting errors from uwsgi not being able to find Django installed (even though it was installed in the new venv. I then realized that uwsgi was still pointing to a version installed in /usr/local/bin/ and built with the older version of Python.

from ansible-role-netbox.

tyler-8 avatar tyler-8 commented on June 12, 2024

I should also mention that I was getting errors from this task

- name: Ensure Postgres database exists (via TCP)

because psycopg2 wasn't being re-installed under the new version of Python. Not entirely sure why that was happening even on subsequent runs because it definitely was installed yet but the task completed without doing anything.

from ansible-role-netbox.

lae avatar lae commented on June 12, 2024

Just to not let this stagnate, I still haven't remembered the exact reasoning behind using uwsgi outside of the virtualenv (if not for one of the guesses I provided before). I just remember that I did indeed originally try to stick to running everything inside the virtualenv, so I must have ran into some sort of obstacle with uwsgi that made me decide to use it outside.

If you can manage to get a functional changeset to the role to run uwsgi inside the venv, I guess I can consider adopting it, but then I guess consideration also needs to be made for existing NetBox installations (do we uninstall uwsgi? etc).

from ansible-role-netbox.

tyler-8 avatar tyler-8 commented on June 12, 2024

I'll say this, I've done a local fork of this playbook that uses a virtualenv-installed version of uwsgi this past week without any issues. It makes the most sense to me, however I could write an update that leaves it up to the user I suppose.

You'd have two options then:

  1. Use the default behavior
  2. Use a uwsgi binary installed into the venv

from ansible-role-netbox.

ironiq avatar ironiq commented on June 12, 2024

Just a thougth for the uwsgi in venv: if you plan to support RHEL7/CentOS7 and Netbox3, the uwsgi from the distro will not work. I have a running Netbox 3.4.1 on CentOS7 and had to install uwsgi in venv, because otherwise it did not work correctly (python 3.6 vs. python 3.8 in venv).

from ansible-role-netbox.

lae avatar lae commented on June 12, 2024

btw if someone can test the venv uwsgi setup on all technically supported distros and confirm that it works fine, I think I wouldn't mind making it the default for a major release and including update notes to suggest manually removing the non-venv install.

from ansible-role-netbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.