Commit Graph

24 Commits

Author SHA1 Message Date
matze 558021d2ee __netbox: reorder generated code for shorter transition
Now, the venv and pip things are done before the program files are
replaced, which should minimize the outage where the application is not
available.
2020-10-17 11:08:11 +02:00
matze 144cae3b79 __netbox: use __pyenv and remove obsolete netbox stop
Now, the python venv is now created via `pyvenv` or `python3 -m venv`
instead of the legacy `virtualenv`. For this, not all python processes
from the venv need to be stopped.

Migration from previous versions of this type may be difficult, but
solvable if the venv will be recreated.
2020-10-17 10:16:25 +02:00
matze 32c95ccb22 __netbox: don't call `pip3 uninstall` if nothing available
To avoid an error from pip, it will be checked if there are packages to
uninstall. This is better than just doing `|| true`.
2020-10-11 16:50:22 +02:00
matze 3b780c4794 __netbox: fixup small bugs and venv process killing
Changed flag (force to ignore a non-existant directory), typo and
swapped arguments are done. Also, the process to stop all processes from
the virtal environment has changed: Now, it stops all potential services
and ignore errors (because a service doesn't exist).

After that, it sends a kill signal to all processes and then gracefully
wait since there is no option to do that with systemd.
2020-10-08 19:54:48 +02:00
matze 0b3bc14530 __netbox: adjusted command flags
Mostly added -q to the pip calls. Also forced the temp directory removal.
2020-10-06 17:29:31 +02:00
matze 8f1b56026c __netbox: force link creation for config files
This adds the force flag to `ln` to avoid aborts cause the link already
exists and so forth. It also adds robustness to the execution.
2020-10-05 19:02:05 +02:00
matze 0c85b2d3fd __netbox: uninstall not anymore required packages
This code tries to remove packages not needed anymore. As it presumably
not removing dependencies, it's not that perfect pice of script.
2020-10-05 18:26:47 +02:00
matze 050812305b __netbox: add mange.py calls recommended from upstream
Calls where added because there are used upstream in the
`upgrade.sh`-Script, too.

Upgrade-Script:
  https://github.com/netbox-community/netbox/blob/develop/upgrade.sh
2020-09-28 20:04:22 +02:00
matze b55186544f __netbox: adding seperate /opt/netbox/cdist/ directory
Adding a place to keep all configuration stuff for cdist seperated from
the installation directory. For safety reasons.
2020-09-28 19:49:29 +02:00
matze dd167f075d __netbox*: fix service restart order
Cause of corrupt databases if the services are restarted incorrectly,
the order and dependencies are adjusted. Now, the `netbox-rq` service
will be included in restarts of `netbox` and required for the WSGI
servers that it must running.

For these changes, the restart command of `__netbox` was adjusted. The
other ones where edited too, to use the same command.

All services now require redis and postgresql to be started before them
to prevent any start order issues.

If someone asked for what the RQ worker is required, see here:
 https://netbox.readthedocs.io/en/stable/additional-features/webhooks/#webhook-processing
2020-09-09 19:08:46 +02:00
matze b10f6b71d0 __netbox: avoid useless generated code-remote
Because `set -e` got printed all the time, the type __netbox always had
some generated code for the remote side. This line was removed because
this is already done by cdist when executing the code-remote script.

Rather, the exit-on-error option was set to some scirpts (two ..).
2020-09-05 22:34:14 +02:00
matze 314a0d4d8e __netbox: kill all running venv processes
To avoid aborts because of the python venv could not be updated by
killing all processes that uses the venv.

It will be done all times to prevent any error, because it could not be
reliably detected if the type installs or updates NetBox.
2020-09-05 13:53:05 +02:00
matze 9d8b3ebe74 __netbox: add wrapper service to manage the wsgi services
The wrapper service will "control" the services added from the
__netbox_* types to provide a general interface. This is more dynamic
than the alias approach used previously. Through this, it is possible
to handle multiple wsgi services for netbox - if this works ..

See as a reference:
  http://alesnosek.com/blog/2016/12/04/controlling-a-multi-service-application-with-systemd/
2020-09-01 10:02:08 +02:00
matze 1ef4420c53 __netbox_uwsgi: new type to handle uwsgi for netbox 2020-08-27 19:46:09 +02:00
matze e0a1b4f663 __netbox_gunicorn: extract gunicorn setup from __netbox
Because someone *want* to use something other than just gunicorn, it was
extracted to a own type. Because gunicorn is a bit deep in the netbox
installation process, it's a bit harder to isolate it.

`__netbox_uwsgi` will come, too.
2020-08-26 20:08:37 +02:00
matze eaf639790b __netbox: remove ldap pip3 package if not required 2020-08-26 17:39:19 +02:00
matze 584e0bbda8 __netbox: fix netbox version save
The cdist directory needs to be created to write there. This is done
directly after the new tarball is installed.
2020-08-22 22:24:17 +02:00
matze ce47cec2e7 __netbox: silence curl progress bar
.. but still showing errors if any.
2020-08-22 21:50:54 +02:00
matze ae7ffac6bb __netbox: force virtualenv to be python3
Set a flag to be sure it is python3. Else, you may get an ugly error if
python2 is not installed (and netbox requires python3.6 at minimum).
2020-08-22 21:29:30 +02:00
matze 855843ea34 __netbox: small code and config handling improvements
fixed codestyle and detection if config files need to be copied.
2020-08-22 09:19:12 +02:00
matze efab6ac23e __netbox: add version memorisation
This saves the installed version and checks if a new version must be
installed. If no update required, it updates the configuration files
if required.
2020-08-16 15:18:47 +02:00
fnux 47584d6da6 __netbox: use __systemd_unit, do not recreate existing directory 2020-08-12 08:58:29 +02:00
fnux ab2c826cc3 __netbox: add minimal LDAP support 2020-07-21 07:46:45 +02:00
fnux 70047d10b1 Initial __netbox type 2020-07-20 17:20:33 +02:00