Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge NCPA v3 into master #1016

Merged
merged 178 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
53a9343
Update for linux builds
jomann09 Jul 12, 2016
11cbcb8
Major changes to NCPA for version 3
jomann09 Jan 9, 2017
b5b0b46
Add new single log file
jomann09 Jan 9, 2017
0abefc3
More changes to build scripts for Python 3
jomann09 Jan 9, 2017
5408ed7
Add python interpreter executable for using bundled python to run scr…
jomann09 Jan 10, 2017
0d327ae
Give interpreter different name depending on Windows or Linux
jomann09 Jan 10, 2017
5280cdd
Update for linux builds
jomann09 Jan 11, 2017
52e8eed
Merge branch 'dev-v3' of https://github.com/NagiosEnterprises/ncpa in…
jomann09 Jan 11, 2017
2526f4e
Updates for build on Linux
jomann09 Jan 13, 2017
4f4bc4f
Merge branch 'dev-v3' of https://github.com/NagiosEnterprises/ncpa in…
jomann09 Jan 13, 2017
9d64424
No multiprocessing for now
jomann09 Jan 13, 2017
f55aa5e
Fix some Python 3 incompatibilities
jomann09 Feb 9, 2017
8a67994
Merge master into dev-v3 (updated to 2.1.5 codebase for 3)
jomann09 May 25, 2018
ad54197
Update python version in travis
jomann09 May 25, 2018
09e27b8
Fixes for Python 3.6 and windows counters memory leak fix
jomann09 May 25, 2018
9cfdaf8
Fix merge conflicts for dev-v3
jomann09 May 25, 2018
1ac0e5e
Cleanup for Python 3.6 and make sure it runs
jomann09 May 25, 2018
fe32955
Updates to work with Python 3
jomann09 Aug 23, 2018
8e08b94
Move some things around
jomann09 Aug 25, 2018
a24589a
Update changelog
jomann09 Aug 25, 2018
d693566
Update with exception/upate
jomann09 Sep 29, 2018
eb3aea9
Method iteritems doesn't exist anymore
jomann09 Oct 17, 2018
26d8775
Merge remote-tracking branch 'remotes/origin/master' into dev-v3
jomann09 Oct 21, 2018
374d49b
Build scripts for python 3
jomann09 Oct 22, 2018
e981ec8
Updates for python 3
jomann09 Oct 22, 2018
ff5d43b
Replace missing file from merge
jomann09 Oct 22, 2018
67c6a7c
Update server for v3 and python 3
jomann09 Oct 22, 2018
5386293
Update python version. Remove unnecessary imports/packages.
jomann09 Oct 15, 2019
403cc8a
Merge maint into dev-v3
jomann09 Oct 15, 2019
c31d696
Update the way the server runs. Fix the log tail websocket in debug m…
jomann09 Oct 15, 2019
62b30e3
Fix merge leftover junk
jomann09 Oct 15, 2019
fdbcf4b
Fixed tests to work properly. Fixed issues with importing.
jomann09 Oct 16, 2019
4a03213
Fix path location for agent in test
jomann09 Oct 16, 2019
3db4260
Fix windowslogs with pywin32 instead of pypiwin32 and fixed tests on …
jomann09 Oct 16, 2019
34ec2bc
Fix regex to use raw string
jomann09 Oct 16, 2019
af78d91
Remove environment file that is not used. Fixed config loading from c…
jomann09 Oct 18, 2019
c2df54f
Test setup python build workflow
jomann09 Jan 19, 2021
7e01d3d
Do pytest
jomann09 Jan 19, 2021
f9117e7
Testing directory structure
jomann09 Jan 19, 2021
d8cf71e
Fix wrong name for requires
jomann09 Jan 19, 2021
373f7d3
Update to add build base
jomann09 Jan 19, 2021
ae2677f
Clean up python and add build base
jomann09 Jan 19, 2021
7e4fd62
Add working directory
jomann09 Jan 19, 2021
2d4ed61
Platform specific changes
jomann09 Jan 19, 2021
f1f8f6b
Update for build process
jomann09 Jan 20, 2021
5216c87
Update locations for OSX install scripts
jomann09 Jan 20, 2021
fa0a8ae
Update build process for Windows. Update winservice.
jomann09 Jan 21, 2021
e06d65f
Test and build on 3.7 only right now
jomann09 Jan 21, 2021
b521ce9
Fix tests and fix Windows builds running properly
jomann09 Jan 21, 2021
c49dd6f
Fix issue with build
jomann09 Jan 21, 2021
33016b8
Add session secret key
jomann09 Jan 21, 2021
7c48e48
Set __INTERNAL__ in the server module
jomann09 Jan 21, 2021
2f2a74e
Add monkey patch before loading certs
jomann09 Jan 21, 2021
30bf956
Update docs a bit for ncpa 3 build/contrib
jomann09 Sep 17, 2021
7495e7a
Fix threading and replaced with true multiprocessing
jomann09 Sep 17, 2021
43015fd
Empty log
jomann09 Sep 27, 2021
7766c6c
Changed the date format in the changelog #838
Dec 19, 2021
80546f9
Changelog updated.
Dec 19, 2021
fe4fdad
improved eventlogs fetching
gittethis Mar 14, 2022
529b56b
Update psapi.py
gittethis Mar 22, 2022
886e7f6
Merge pull request #856 from gittethis/master
ne-svandahm Apr 5, 2022
8f05702
Merge branch 'maint' into dev-v3
ne-svandahm May 24, 2022
70680f4
typo
ne-svandahm May 24, 2022
af8a020
fix import errors
ne-svandahm May 26, 2022
933aca7
Merge pull request #840 from ccztux/issue-838
ne-svandahm Jun 14, 2022
2a31b10
Merge branch 'maint' into dev-v3
ne-svandahm Jun 14, 2022
e1a21ef
Cleanup some build things for NCPA 3
Aug 29, 2022
f364a54
Cleanup some build things for NCPA 3
jomann09 Aug 29, 2022
24da83e
Merge branch 'dev-v3' of https://github.com/NagiosEnterprises/ncpa in…
jomann09 Aug 29, 2022
79e3904
minor non-functional change to trigger build process
phreditorNG Oct 31, 2022
b9a5c51
Dev v3 beta01 (#955) (#956)
phreditorNG Jun 27, 2023
c5cd0b7
Dev v3 (#971)
phreditorNG Aug 25, 2023
8631189
Minor change to eliminate merge conflictUpdated MacOS to use the mach…
phreditorNG Sep 18, 2023
09c556c
Updates to help for NCPA v3.
HunnyPuns Sep 30, 2023
919b13b
Fixed a grammatical errar, less wishywashy language around restarting…
HunnyPuns Sep 30, 2023
54ed1ba
Fixes #980 - Delta graph wasn't loading properly if the pickle was ye…
ne-bbahn Oct 3, 2023
bcfaa3f
update service description
ne-bbahn Oct 3, 2023
a932880
Update index.html
ne-bbahn Oct 4, 2023
c24ced2
added space
ne-bbahn Oct 4, 2023
40a5933
rename process to service
ne-bbahn Oct 4, 2023
f2bab20
Merge pull request #984 from HunnyPuns/dev-v3
ne-bbahn Oct 4, 2023
e2a4376
updating NSIS installer to use the NCPA icon
ne-bbahn Oct 9, 2023
012ad5a
adding prereq installation script
ne-bbahn Oct 9, 2023
4e757a4
adding build_ncpa.py
ne-bbahn Oct 9, 2023
e9b7afa
adding full install script
ne-bbahn Oct 9, 2023
08c0ad6
removing old build file (basically moved to build/windows/build_ncpa.py)
ne-bbahn Oct 9, 2023
a73b6ba
moving logging into the correct locations
ne-bbahn Oct 9, 2023
1e9bf2d
Update build.sh
aransom90 Oct 9, 2023
d93f09f
Merge pull request #992 from NagiosEnterprises/aransom-zlib-fix
ne-bbahn Oct 9, 2023
9c27898
fixing color issue that I missed when updating from my previous scrip…
ne-bbahn Oct 10, 2023
a4060e4
adding error handling
ne-bbahn Oct 10, 2023
cab94c7
adding test for pending-reboot
ne-bbahn Oct 10, 2023
106f9e4
checking pending
ne-bbahn Oct 10, 2023
0297a46
choco exit on reboot detected
ne-bbahn Oct 10, 2023
5da7905
updating echo to be more clear
ne-bbahn Oct 10, 2023
49a37fe
removing choco profile adding - not necessary and shows errors on fir…
ne-bbahn Oct 10, 2023
88249a0
Merge pull request #985 from NagiosEnterprises/bb_980_graphloading
ne-bbahn Oct 16, 2023
08abe78
Merge pull request #995 from NagiosEnterprises/bb_978_logginglocation
ne-bbahn Oct 16, 2023
b54a3d0
Merge pull request #986 from NagiosEnterprises/bb_977_servicedescription
ne-bbahn Oct 16, 2023
676b799
fixing path vulnerability
ne-bbahn Oct 27, 2023
1b373ac
Merge pull request #1003 from NagiosEnterprises/bb_fixpathvulnerability
ne-bbahn Oct 27, 2023
a56ca1b
fixing missed display name setting
ne-bbahn Oct 30, 2023
139457f
fixing comment
ne-bbahn Oct 30, 2023
5f930e7
fixing malformed plist
ne-bbahn Nov 1, 2023
4df162f
trying to fix echo into .bash_profile
ne-bbahn Nov 2, 2023
7f3c263
sudoing mkdirs
ne-bbahn Nov 2, 2023
0158cea
sudoing the touch for prereq.installed
ne-bbahn Nov 2, 2023
bd47a51
sudoing python freezing
ne-bbahn Nov 2, 2023
bc14fe8
more sudoing!
ne-bbahn Nov 2, 2023
2de571c
missed a sudo
ne-bbahn Nov 2, 2023
fc2c8f6
escalating echo perms
ne-bbahn Nov 2, 2023
6b7c1af
should be the rest of the sudos
ne-bbahn Nov 2, 2023
b592cee
should be the rest of the sudos
ne-bbahn Nov 2, 2023
7d0387a
sudoing the htiutil
ne-bbahn Nov 2, 2023
36579de
sudoing install_name_tool for mac. (TEST THIS)
ne-bbahn Nov 2, 2023
d686e44
Merge pull request #1007 from NagiosEnterprises/bb_macbuildperms
ne-bbahn Nov 2, 2023
551792a
replacing > & >> with sudo tee for perms
ne-bbahn Nov 3, 2023
5350544
Merge branch 'bb_fixmacbuild' of https://github.com/NagiosEnterprises…
ne-bbahn Nov 3, 2023
ae27c38
updating macos setup >> to tee -a
ne-bbahn Nov 3, 2023
43ce824
update path to include stuff necessary
ne-bbahn Nov 3, 2023
6a0f61a
fixing perms
ne-bbahn Nov 3, 2023
9e787c7
matching python versions
ne-bbahn Nov 3, 2023
c470f27
update CL
ne-bbahn Nov 7, 2023
3548480
fixing windows build version and compatibility so we have consistent …
ne-bbahn Nov 7, 2023
862c399
adding exception for method not being defined
ne-bbahn Nov 8, 2023
e939b23
Merge pull request #990 from NagiosEnterprises/bb_buildwin
ne-bbahn Nov 8, 2023
4e051ae
Merge pull request #1005 from NagiosEnterprises/bb_fixmacbuild
ne-bbahn Nov 8, 2023
4f8b21d
fixing issue that was breaking API calls on Windows NCPA instances
ne-bbahn Nov 8, 2023
a80aeb3
Merge pull request #1009 from NagiosEnterprises/bb_fixWindowsAPI
ne-bbahn Nov 8, 2023
ed1d789
Merge branch 'dev-v3' into bb_fixplugintimeout
ne-bbahn Nov 8, 2023
355126c
Update CHANGES.rst
Nov 8, 2023
198c914
Update CHANGES.rst
Nov 8, 2023
b4c1205
fixing python version install from revert to python 3.11 for another …
ne-bbahn Nov 8, 2023
9eb44ec
Merge pull request #1011 from NagiosEnterprises/bb_WindowsOSSLFixFrom…
ne-bbahn Nov 8, 2023
a785d52
Merge pull request #1010 from NagiosEnterprises/bb_fixplugintimeout
ne-bbahn Nov 8, 2023
69e3f69
Update BUILDING.rst
ne-bbahn Nov 8, 2023
879286e
Update BUILDING.rst
ne-bbahn Nov 8, 2023
b110718
Update BUILDING.rst
ne-bbahn Nov 8, 2023
90996df
Update BUILDING.rst
ne-bbahn Nov 8, 2023
d9627a4
Update BUILDING.rst
ne-bbahn Nov 9, 2023
1bfbd37
Fixing execution of plugins that lack file extensions
ne-bbahn Nov 9, 2023
7cc6cdd
Merge pull request #1014 from NagiosEnterprises/bb_fixPluginsWOExtens…
ne-bbahn Nov 9, 2023
6e64bee
make it always install Python 3.11.6... Windows 10 Pro has a python.e…
ne-bbahn Nov 9, 2023
8eb5e03
hard-coding python directory installation since Windows 10 pro alread…
ne-bbahn Nov 9, 2023
44e4ad6
comment explaining why hard-coded now
ne-bbahn Nov 9, 2023
1de2393
Update BUILDING.rst
ne-bbahn Nov 10, 2023
7ccec23
Merge pull request #1015 from NagiosEnterprises/bb_fixingWindowsInsta…
ne-bbahn Nov 10, 2023
5f03c67
Merge branch 'master' into dev-v3
Nov 10, 2023
2b33c4e
Py3 strings are already unicode, fixing error output in logs
ne-bbahn Nov 13, 2023
53fc6e5
Update package.sh
ne-bbahn Nov 13, 2023
4a9f1a4
Merge pull request #1018 from NagiosEnterprises/bb_renameBeta02toRelease
ne-bbahn Nov 13, 2023
e27b355
Merge pull request #1017 from NagiosEnterprises/bb_fixunicodeerror
ne-bbahn Nov 13, 2023
e5183d5
unpin dependencies
Nov 13, 2023
4a13d40
Merge branch 'dev-v3' of github.com:NagiosEnterprises/ncpa into dev-v3
Nov 13, 2023
aedb3ad
Update BUILDING.rst
ne-bbahn Nov 13, 2023
eb6f915
Update BUILDING.rst
ne-bbahn Nov 13, 2023
95764ad
updating spec from beta02 to release
ne-bbahn Nov 13, 2023
10a5eb5
Update BUILDING.rst
ne-bbahn Nov 13, 2023
194c3da
updating text for release to "latest"
ne-bbahn Nov 13, 2023
e5d1cb5
updating release to latest in BUILDING.rst
ne-bbahn Nov 13, 2023
e3463c8
reverting my old change to the graph to fix other graphs
ne-bbahn Nov 13, 2023
79435fb
Merge pull request #1020 from NagiosEnterprises/bb_fixrevertgraphs
ne-bbahn Nov 13, 2023
08a17ab
removing duplicate code
ne-bbahn Nov 13, 2023
37e9845
updating readme current version to 3.0.0
ne-bbahn Nov 13, 2023
70273fa
Merge pull request #1019 from NagiosEnterprises/bb_revertingTextChang…
ne-bbahn Nov 13, 2023
0d2b0bb
reverting merge from master changes
ne-bbahn Nov 13, 2023
af6179d
Merge pull request #1021 from NagiosEnterprises/bb_fullrevertserverpy…
ne-bbahn Nov 13, 2023
d7476ab
reimplementing security fix from master merge
ne-bbahn Nov 13, 2023
ff40186
Merge pull request #1022 from NagiosEnterprises/bb_fullrevertserverpy…
ne-bbahn Nov 13, 2023
732fbef
Update Ubuntu install instructions
ne-bbahn Nov 14, 2023
30d2274
Update BUILDING.rst version info
ne-bbahn Nov 15, 2023
c1fece8
Update README.rst with new version info
ne-bbahn Nov 15, 2023
faae6b4
Update LICENSE.rst year
ne-bbahn Nov 15, 2023
ae5c910
Update README.rst removed beta text
ne-bbahn Nov 15, 2023
02f3c29
Update README.rst
ne-bbahn Nov 15, 2023
6d8e373
Update README.rst
ne-bbahn Nov 15, 2023
c40f20d
Update README.rst
ne-bbahn Nov 15, 2023
00d2048
Update README.rst grouping distros better
ne-bbahn Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on:
push:
branches: [ 'dev-v3' ]

jobs:

build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# os: [ubuntu-latest, macos-latest]
# os: [ubuntu-20.04]
os: [macos-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Check system platform
run: python -c "import sys; print(sys.platform)"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade -r build/resources/require.txt
- name: Install OS-specific dependencies
if: runner.os == 'Windows'
run: python -m pip install pypiwin32 cx_Logging
- name: Build the NCPA binaries
run: |
python setup.py build_exe
pwd
../build/build_github.sh
working-directory: agent
- name: Upload ${{ matrix.os }} artifact
uses: actions/upload-artifact@v2
with:
name: NCPA-3.0.0-${{ matrix.os }}
path: build/ncpa_3.0.0-*.*
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

on:
push:
branches: [ 'dev-v3' ]

jobs:

test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install --upgrade -r build/resources/require.txt
- name: Run Tests
run: pytest
28 changes: 24 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,35 @@
*.cfg
.idea/
.vagrant
.coverage
.cover
.cache/
agent/build/*
.vscode/
docs/_build
*.exe
agent/plugins/*
ncpa.db
prereqs.installed
.python-version
.DS_Store
launch.json

agent/build
agent/plugins/*
# agent/var/log/*
agent/var/run/*.pid

build/resources/*.tgz
build/resources/Python*/*
build/resources/openssl/*
build/bin
build/include
build/lib
build/ncpa.spec
build/ncpa
build/ncpa-3*/
build/ncpa-3*/
build/NCPA-INSTALL-*/
build/*.deb
build/*.rpm
build/*.dmg
build/NCPA-*
build/share
build/NCPA-INSTALL-*/*
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

235 changes: 38 additions & 197 deletions BUILDING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ This document contains instructions for:

* `Building on MacOS <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#building-on-macos>`_

*WARNING*: DO THIS ON A DEDICATED VM OR A NON-PRODUCTION SYSTEM!

THE BUILD SCRIPT WILL MAKE CHANGES TO THE SYSTEM THAT MAY BE INCOMPATIBLE WITH OTHER SOFTWARE

Building on Windows
===================
Expand All @@ -19,237 +22,75 @@ must be executed by cmd.exe. For this reason, any Windows commands
listed in this document will be written with cmd.exe compatibility
in mind.*

**Prerequisites for Windows** (Installing some of these prerequisites requires admin rights)
-------------------------

* `Git for Windows <https://git-scm.com/download/win>`_
* Python 2.7.16 (32-Bit) (`Download <https://www.python.org/downloads/release/python-2716/>`_)
* `OpenSSL for Windows (32-bit) <https://slproweb.com/download/Win32OpenSSL-1_1_1d.exe>`_
* `Microsoft Visual C++ Compiler for Python 2.7 <https://web.archive.org/web/20160309215513/https://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
* `Microsoft Visual C++ 2010 runtime (32-bit) <https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe>`_
* `NSIS 3 <http://nsis.sourceforge.net/Download>`_

**Python Packages**

* pip (installed by default in Python 2.7 for Windows)
* cx_Freeze (patched)
* cx_Logging (http://cx-logging.sourceforge.net/)
* pywin32 (https://github.com/mhammond/pywin32/releases/download/b228/pywin32-228.win32-py2.7.exe)

(pywin32 provides a bunch OS checking stuff that is not available via pip.)

There are more Python packages that need to be installed too but they are installed when you run the build.sh script for the first time. A full list of required packages is available in *ncpa/build/resources/requires.txt*.

Configure the Windows Build Environment
-------------------------------

Install Prerequisites
~~~~~~~~~~~~~~~~~~~~~

* Python

1. Download and install Python 2.7.16. (`see prerequisites <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#prerequisites>`_)
2. Execute the installer as usual. It's important that the
installation path is not changed from the default of
C:\\python27 as cx_Freeze can have difficulty finding
Python resources if it's installed at a custom path.

* OpenSSL

1. Download and install the OpenSSL package. (`see prerequisites <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#prerequisites>`_)
2. Be sure to make a not of the installation directory while installing.

* Microsoft Visual C++ Compiler for Python 2.7

1. Download and run the installer. (`see prerequisites <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#prerequisites>`_)

Running the installer without administrator privileges will
cause the files to be installed to::

%LOCALAPPDATA%\Programs\Common\Microsoft\Visual C++ for Python\9.0

* Microsoft Visual C++ 2010 runtime (32-bit)

1. Download and run the installer. (`see prerequisites <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#prerequisites>`_)

* NSIS

1. Download and run the installer. (`see prerequisites <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#prerequisites>`_)

* pywin32

1. Download and run the installer (`see prerequisites <https://github.com/NagiosEnterprises/ncpa/blob/master/BUILDING.rst#prerequisites>`_)

If the installer says python isn't in the registry, then the installer doesn't match your python (which should be 2.7.16 32-bit).

* pip

* Pip is installed by default in Python 2.7.16 but should be updated before continuing::

"%pydir%" -m pip install --upgrade pip

Set Environment Variables
~~~~~~~~~~~~~~~~~~~~~~~~~
Two variables must be set for the win_build_setup.bat script to run properly:

* **pydir**: The root directory of your Python installation.

This should be:

C:\Python27

* **openssldir**: The root directory of your OpenSSL installation.

This should be:

C:\Program Files (x86)\OpenSSL-Win32

Set these variables by entering::

set pydir=C:\Python27
set openssldir=C:\Program Files (x86)\OpenSSL-Win32

Install the Last Modules
~~~~~~~~~~~~~~~~~~~~~~~~
*Note: The current Windows build should be run on a Windows machine without Python installed.*

* Install the full list of python modules
Install the Prerequisites/Build NCPA
------------------------------------

"%pydir%\python" -m pip install --upgrade -r build/resources/require.txt
From a command prompt with Administrative priveleges run::

* cx_Logging (http://cx-logging.sourceforge.net/)
cd /path/to/ncpa/build/
build_windows.bat

* Install the python 2.7 version of cx_Logging for Windows via the .msi
This will use Chocolatey to install various prerequisites for building NCPA and then build NCPA. If you have not yet built NCPA 3 on your machine, the script will likely tell you that a reboot is required/pending. This means that you need to restart your machine and then rerun the script and it will continue the installation/build processes. This may happen several times during the installation process.

* cx_Freeze (patched)

* Install cx_Freeze via pip:

pip install cx_Freeze==4.3.4

* Then, copy our patch into the package:

ncpa\build\resources\cx_Freeze-4.3.4.tar.gz
copy "ncpa\build\resources\cx_Freeze-4.3.4.tar\cx_Freeze-4.3.4\cx_Freeze\freezer.py" C:\Python27\Lib\site-packages\cx_Freeze\freezer.py

Build NCPA
~~~~~~~~~~

Run the build script::

"%pydir%\python" build\build_windows.py
This will create a file called ``ncpa-<version>.exe`` in the ``build`` directory.
This is the installer for NCPA and can be used to install NCPA on a Windows system.


Building on Linux
=================

Building on CentOS 7 is the easiest way to get a working package for all Linux distributions except the SuSE variants which seem to build most easily on openSuSE 15 Leap, and SLES 15. For Ubuntu/Debian, you will need copy the generated .rpm to an Ubuntu system (20.04 recommended) with alien installed and run alien to create a .deb file that will work on all of the supported distributions.

That said, in most cases (CentOS 9 being a notable exception), building on the distribution that is targeted, e.g. building on Ubuntu 20.04 to deploy on Ubuntu 20.04, will work, but the resulting package will not be as portable.

The CentOS 7 build flow (for all non-SuSE linux)
-------------------------------------------------
**Clone the git repo on a CentOS 7 machine** (*It must have wget and git installed*)::

cd ~
git clone https://github.com/NagiosEnterprises/ncpa

**Select the correct .spec file**::

cd ~/ncpa/build/linux

For a package targeting CentOS 9::

cp ncpa.spec el7-ncpa.spec
cp el9-ncpa.spec ncpa.spec

For other non-SuSE distributions, use the existing ncpa.spec file

**Run build script to install the requirements and build an rpm**::

cd ~/ncpa/build
./build.sh
Building on CentOS 7 is the easiest way to get a working package for all Linux distributions. When you build on CentOS 7, both a .deb as well as an .rpm package are built.

**Creating a package for Ubuntu or Debian**
(*Note: this step not necessary if building on Ubuntu*)
In most cases, building on the distribution that is targeted, e.g. building on Ubuntu 20.04 to deploy on Ubuntu 20.04, will work, but the resulting package will not be as portable.

Copy the resulting ~/ncpa/build/ncpa-2.x.x-1.elx.x86_64.rpm to an Ubuntu 20.04 server** with alien installed (`apt install alien`) and generate a .deb file::
To start, clone the repository in your directory::

`alien -c -k -v ./ncpa-2.x.x-1.elx.x86_64.rpm > build.log`
cd ~
git clone https://github.com/NagiosEnterprises/ncpa

** *Ubuntu 20.04 generates a .deb that will run on the most targets, but other distributions may work for your specific case.*
Now run the setup scripts to install the requirements::

The SuSE build flows (OpenSuSE and SLES):
------------------------------------------------
cd ncpa/build
./build.sh

**OpenSuSE**

Building on OpenSuSE is the same process as build on CentOS 7, except you do it on an OpenSuSE machine, and you use a different .spec file.

**Clone the git repo on an OpenSuSE Leap 15 machine** (*It must have wget and git installed*)::

cd ~
git clone https://github.com/NagiosEnterprises/ncpa

**Select the correct .spec file**::

cd ~/ncpa/build/linux
cp ncpa.spec el7-ncpa.spec
cp suse-ncpa.spec ncpa.spec

Note: this will name your rpm with "sle15" in the release segment. If you want it to be "os15", edit line 3 in ncpa.spec accordingly.

**Run build script to install the requirements and build an rpm**::

cd ~/ncpa/build
./build.sh


**SLES**

On SLES 15, the build script fails because rpm-build is no longer available in the zypper repositories. Hence, this process is not really recommended, but it is provided for those useers for whom building on older versions of SLES is necessary.

**Clone the repo as for OpenSuSE above.**

**Edit linux/setup.sh and remove "rpm-build" from line 49**

**Run build script to install the requirements and build an archive**

The script will die when it tries to invoke rpm-build leaving a compressed tarball in the build directory, e.g., ncpa-2.4.1.tar.gz.

**Copy this .gz into the build dir of the ncpa repo on another distrbution that that has rpm-build available, .e.g, a CentOS 7 VM.**

**Select the proper .spec file, as for OpenSuSE above.**

**From the build directory, run linux/package.sh**

An rpm, e.g., ncpa-2.4.1-sle15.x86_64.rpm, will be generated.
Follow the prompts to setup the system. When running the build.sh script it will setup
the system and build the ncpa binary.


**Install on the target Linux server**
--------------------------------

Copy the resulting ~/ncpa/build/ncpa-2.x.x-1.elx.x86_64.rpm or ncpa_2.4.1-1.el7_amd64.deb to the desired server and install using the appropriate package system:
Copy the resulting ~/ncpa/build/ncpa-3.0.0-latest.x86_64.rpm or ncpa_3.0.0-latest_amd64.deb to the desired server and install using the appropriate package system:

On CentOS/RHEL/Oracle/Amazon/Rocky::

On CentOs/RHEL::
yum install ./ncpa-3.0.0-latest.x86_64.rpm

yum install ./ncpa-2.x.x-1.elx.x86_64.rpm
On Ubuntu 18+/Debian 10+::

On Ubuntu/Debian::
dpkg -i ./ncpa_3.0.0-latest._amd64.deb

apt install ./ncpa_2.4.1-1.el7_amd64.deb
On Ubuntu 14-16/Debian 8-9 (not supported, but may work)::

dpkg --force-depends -i ./ncpa_3.0.0-latest._amd64.deb

On OpenSuSE/SLES::

zypper install ./ncpa_2.4.1-1.el7_amd64.deb
zypper install ./ncpa-3.0.0-latest.x86_64.rpm


Building on MacOS
=================

Working on this section. Using the new build system, these four lines should be enough
to create a working NCPA DMG.
*Not updated for v3, yet.*
It's basically the same as Linux, however you may need to
install the libraries and python differently, due to it being macOS. You must have
python3, wget and git installed prior to building NCPA v3.x.:


**Clone the git repo on an MacOS machine** (*It must have wget and git installed*)::
**Clone the repository into your directory**::

cd ~
git clone https://github.com/NagiosEnterprises/ncpa
Expand Down
Loading