Package: argus-server
ArgusArgus is a platform for aggregating incidents across network management systems, and
sending notifications to users. Users create notification profiles that define which
incidents they subscribe to. SeeArgus docsfor more details.This repository hosts the backend built with Django. There is also aREACT SPA frontend.See also the thePython client library.InstallationThere are several ways to install Argus.PrerequisitesRequirementsPython 3.8+Django 3.2 or 4.2pipOptional requirementsRedisis recommended if you are going to run the frontend.
Redis backs the websockets, in order to push realtime updates to the frontend.Argus-frontendPostgreSQLDocker and docker-compose to run Argus in DockerOptional: Dataporten registrationDataporten authentication is supported by Argus and can be used to log into
Argus-frontend.
Refer to theDataportensection of the documentation to learn
about Dataporten registration, and how to set it up with Argus.Install Argus using pipYou can also install Argus withpipvia PyPI. The package name isargus-server:$pipinstallargus-serverIf you are using the PyPI package in production, please note: The filerequirements.txtcontains the pinned versions of dependencies that the
release was tested on. The fileconstraints.txtis for controlling versions
of sub-dependencies so as to not poison the pyproject.toml.To update the dependency lock-files, usetox:$pipinstalltox$tox-eupgrade-deps---UTo upgrade a single dependency, replace the-Uflag with-P PACKAGENAME.To install from the lock-file use pip:$pipinstall-cconstraints.txt--upgrade-rrequirements.txtNow change and adaptArgus' settingsaccording to your needs.Run the initial Argus setup, and make note of the admin password that is generated:$pythonmanage.pyinitial_setup******************************************************************************Created Argus superuser "admin" with password "2S0qJbjVEew0GunL".Please change the password via the admin interface.******************************************************************************Then run the Argus API server:$pythonmanage.pyrunserverSetup Argus using Docker ComposeDownload the source code first.$gitclonehttps://github.com/Uninett/Argus.git$cdArgusRunning Argus with docker-compose is as simple as$docker-composeupRun the initial Argus setup, and make note of the admin password that is generated:$docker-composeexecapidjango-admininitial_setup******************************************************************************Created Argus superuser "admin" with password "ns6bfoKquW12koIP".Please change the password via the admin interface.******************************************************************************You will find Argus running athttp://localhost:8000/.Settings in ArgusSite-specific settings can either be set using environment variables, using asettings.pyfile, or a combination of both.For more information on both methods and a list of the settings, consult the
documentation section onsite-specific settings.Running Argus in developmentStep 1: InstallationYou can use docker-compose to conveniently setup a complete dev environment for Argus,
including PostgreSQL. Instructionsare provided above.To do a manual install instead, follow these steps.Download the source code first.$gitclonehttps://github.com/Uninett/Argus.git$cdArgusWe recommend using virtualenv or virtaulenvwrapper to create
a place to stash Argus' dependencies.Create and activate a Python virtual environment.$python-mvenvvenv$sourcevenv/bin/activateInstall Argus' requirements into the virtual env.$pipinstall-rrequirements-django32.txt$pipinstall-rrequirements/dev.txtStep 2: Setting environment variables and Django settingsCopy thecmd.sh-templatetocmd.shand make it executable$cpcmd.sh-templatecmd.sh$chmodu+xcmd.shNow set the environment variables in the file using an editor.Required settings incmd.shareDATABASE_URL,DJANGO_SETTINGS_MODULEandSECRET_KEY.TheDATAPORTENvariables are optional. Refer to the dataporten section ofsetting site-specific settingsfor details.DJANGO_SETTINGS_MODULEcan be set toargus.site.settings.dev.If you need more complex settings than environment variables andcmd.shcan provide,
we recommend having alocalsettings.pyin the same directory asmanage.pywith any
overrides.Refer to thedevelopment notesfor further details and
useful hints on managing Argus in development mode.Step 3: Run Argus in developmentAfterwards, run the initial Argus setup and start the server.$pythonmanage.pyinitial_setup$pythonmanage.pyrunserverYou will find Argus running athttp://localhost:8000/.Code styleArgus uses black as a source code formatter. Black will automatically install
with thedev requirements.A pre-commit hook will format new code automatically before committing.
To enable this pre-commit hook, run$pre-commitinstallRunning testsGiven that Argus is installed and configured as described above,
this command is the most basic option to run the tests.$pythonmanage.pytestIf you have installedtox, the following command will
test Argus code against several Django versions, several Python versions, and
automatically compute code coverage.$toxAnHTML coverage reportwill be generated.
Refer to thetox.inifile for further options.Using towncrier to automatically produce the changelogBefore opening a PRTo be able to automatically produce the changelog for a release a file for each
pull request (also called news fragment) needs to be added to the folderchangelog.d/.
The name of the file consists of three parts seperated by a period:The identifier, either the issue number this pull request is refering to or if
there is no related issue a+followed by a unique short description.The type of the change, we usecritical,added,changedandfixed.The file suffix, e.g..md, towncrier does not care which suffix a fragment has.So an example for a file name linked to an issue would be214.added.mdor for a file
without corresponding issue+fixed-pagination-bug.fixed.md.This file can either be created manually with a file name as specified above and the
changelog text as content or one can use towncrier to create such a file as following:$towncriercreate-c"Changelog content"214.added.mdWhen opening a PR there will be a check to make sure that a news fragment is added, it
will fail if it is missing.Before a releaseTo add all content from thechangelog.d/folder to the changelog file simply run$towncrierbuild--version{version}This will also delete all files inchangelog.d/.To preview what the addition to the changelog file would look like add the flag--draft.A few other helpful flags:date DATE- set the date of the release, default is todaykeep- keep all news fragmentsMore information abouttowncrier.