-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
80 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,22 +46,22 @@ jobs: | |
run: | | ||
apt update | ||
export DEBIAN_FRONTEND=noninteractive | ||
apt -y install python3-setuptools debhelper dh-exec dh-python git-buildpackage | ||
apt -y install python3-setuptools debhelper dh-exec dh-python git-buildpackage yarnpkg | ||
- name: Fix sh so env vars propogate | ||
run: | | ||
rm /bin/sh | ||
ln -sf /bin/bash /bin/sh | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: master | ||
ref: main | ||
- name: git fetch --all | ||
run: | | ||
git config --global --add safe.directory /__w/openvpn-monitor/openvpn-monitor | ||
git fetch --all | ||
- name: Get version | ||
run: | | ||
export version=$(echo "${{ github.ref }}" | cut -dv -f2) | ||
export version=$(echo "${{ github.ref }}" | cut -d/ -f3) | ||
echo "version=${version}" >> $GITHUB_ENV | ||
- name: Download upload_url artifact | ||
uses: actions/download-artifact@v4 | ||
|
@@ -73,21 +73,25 @@ jobs: | |
export upload_url=$(<upload_url.txt) | ||
rm upload_url.txt | ||
echo "upload_url=${upload_url}" >> $GITHUB_ENV | ||
- name: Build deb packages | ||
- name: Build deb package | ||
env: | ||
EMAIL: [email protected] | ||
COMMIT_MSG: | | ||
auto-commit | ||
skip-checks: true | ||
run: | | ||
export version=$(echo "${{ github.ref }}" | cut -dv -f2) | ||
export version=$(echo "${{ github.ref }}" | cut -d/ -f3) | ||
echo "${version}" > VERSION.txt | ||
git add VERSION.txt | ||
yarnpkg --prod --modules-folder openvpn_monitor/static/dist install | ||
find openvpn_monitor/static > debian/source/include-binaries | ||
rm yarn.lock | ||
git add debian/source/include-binaries openvpn_monitor/static/dist | ||
git diff --quiet && git diff --staged --quiet || git commit -m "${COMMIT_MSG}" | ||
gbp dch --new-version=${version}-1 --release --distribution=stable --spawn-editor=never --commit --commit-msg="${COMMIT_MSG}" | ||
git tag --delete v${version} | ||
git tag v${version} | ||
gbp buildpackage --git-upstream-tree=${{ github.ref }} -uc -us | ||
gbp dch --ignore-branch --new-version=${version}-1 --release --distribution=stable --spawn-editor=never --commit --commit-msg="${COMMIT_MSG}" | ||
git tag --delete ${version} | ||
git tag ${version} | ||
gbp buildpackage --git-ignore-branch --git-upstream-tree=${{ github.ref }} -uc -us | ||
- name: Get version | ||
run: echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- name: Upload deb | ||
|
@@ -97,7 +101,7 @@ jobs: | |
with: | ||
upload_url: ${{ env.upload_url }} | ||
asset_name: ${{ format('python3-openvpn-monitor_{0}-1_all.deb', env.version) }} | ||
asset_path: ${{ format('deb_dist/python3-openvpn-monitor_{0}-1_all.deb', env.version) }} | ||
asset_path: ${{ format('../python3-openvpn-monitor_{0}-1_all.deb', env.version) }} | ||
asset_content_type: application/vnd.debian.binary-package | ||
build-and-upload-rpm-asset: | ||
needs: create-release | ||
|
@@ -107,7 +111,9 @@ jobs: | |
steps: | ||
- name: Install build dependencies | ||
run: | | ||
dnf -y install rpm-build python3 python3-setuptools git | ||
dnf -y install epel-release | ||
dnf makecache | ||
dnf -y install rpm-build python3 python3-setuptools git yarnpkg | ||
- uses: actions/checkout@v4 | ||
- name: Download upload_url artifact | ||
uses: actions/download-artifact@v4 | ||
|
@@ -118,8 +124,9 @@ jobs: | |
export upload_url=$(cat upload_url.txt) | ||
rm upload_url.txt | ||
echo "upload_url=${upload_url}" >> $GITHUB_ENV | ||
- name: Build rpm packages | ||
- name: Build rpm package | ||
run: | | ||
yarnpkg --prod --modules-folder openvpn_monitor/static/dist install| | ||
sed -i -e "s/name='.*/name='python3-openvpn-monitor',/" setup.py | ||
python3 setup.py bdist_rpm | ||
- name: Get version | ||
|
@@ -136,6 +143,11 @@ jobs: | |
upload-package-to-pypi: | ||
needs: create-release | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/openvpn-monitor | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up python | ||
|
@@ -144,9 +156,12 @@ jobs: | |
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
sudo apt -y install yarnpkg | ||
python3 -m pip install --upgrade pip | ||
pip3 install setuptools wheel | ||
- name: Build dists | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* | ||
yarnpkg --prod --modules-folder openvpn_monitor/static/dist install | ||
python3 setup.py sdist bdist_wheel | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
include README.md | ||
recursive-include openvpn_monitor *.py | ||
include openvpn-monitor.conf.example | ||
include AUTHORS | ||
include COPYING | ||
include MANIFEST.in | ||
include VERSION.txt | ||
include requirements.txt | ||
recursive-include openvpn_monitor *.py | ||
recursive-include openvpn_monitor/static/images * | ||
recursive-include openvpn_monitor/templates * | ||
include etc/openvpn-monitor/openvpn-monitor.conf.example | ||
include etc/openvpn-monitor/apache.conf.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.0.2 | ||
2.0.3 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,18 @@ Section: python | |
Priority: optional | ||
Maintainer: Marcus Furlong <[email protected]> | ||
Uploaders: Marcus Furlong <[email protected]> | ||
Build-Depends: debhelper (>=10-.0.0), python (>=3), dh-python | ||
Build-Depends: debhelper (>=10.0.0), python3 (>=3.11.0), dh-python | ||
Standards-Version: 3.9.7 | ||
Homepage: https://github.com/furlongm/openvpn-monitor | ||
Vcs-Git: git://github.com/furlongm/openvpn-monitor | ||
Vcs-Browser: https://github.com/furlongm/openvpn-monitor | ||
X-Python-Version: >= 3 | ||
X-Python-Version: >= 3.11.0 | ||
|
||
Package: python3-openvpn-monitor | ||
Architecture: all | ||
Homepage: https://github.com/furlongm/openvpn-monitor | ||
Depends: ${misc:Depends}, python3, apache2, libapache2-mod-wsgi, | ||
python3-geoip2, python3-humanize, python3-flask, python3-flaskext.wtf | ||
Depends: ${misc:Depends}, python3, apache2, libapache2-mod-wsgi-py3, | ||
python3-geoip2, python3-humanize, python3-flask, python3-flaskext.wtf, | ||
python3-semver | ||
Description: openvpn-monitor is a web based OpenVPN monitor, that shows | ||
current connection information, such as users, location and data transferred. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
#!/bin/sh -e | ||
#!/bin/bash -e | ||
|
||
#DEBHELPER# | ||
|
||
if [ "$1" = "configure" ] ; then | ||
apache_conf_file=/etc/apache2/conf-available/openvpn-monitor.conf | ||
|
||
echo 'WSGIScriptAlias /openvpn-monitor /usr/lib/python3/dist-packages/openvpn_monitor/app.py' > /etc/apache2/conf-available/python3-openvpn-monitor.conf | ||
if [ ! -e ${apache_conf_file} ] ; then | ||
cp /etc/openvpn-monitor/apache.conf.example ${apache_conf_file} | ||
fi | ||
|
||
site_packages=/usr/lib/python3/dist-packages | ||
site_packages="${site_packages//\//\\\/}" | ||
if ! grep ${site_packages} ${apache_conf_file} >/dev/null 2>&1 ; then | ||
sed -i -e "s/^\(Define openvpn_monitor_pythonpath\).*/\1 ${site_packages}/" ${apache_conf_file} | ||
. /usr/share/apache2/apache2-maintscript-helper | ||
apache2_invoke enconf python2-openvpn-monitor.conf | ||
apache2_invoke enconf openvpn-monitor.conf | ||
fi | ||
|
||
systemctl enable apache2 | ||
systemctl restart apache2 | ||
|
||
chown :www-data /etc/openvpn-monitor/openvpn-monitor.conf.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
#!/bin/sh | ||
|
||
if [ ! -e /etc/httpd/conf.d/openvpn-monitor.conf ] ; then | ||
cp /etc/openvpn-monitor/apache.conf.example /etc/httpd/conf.d/openvpn-monitor.conf | ||
apache_conf_file=/etc/httpd/conf.d/openvpn-monitor.conf | ||
|
||
if [ ! -e ${apache_conf_file} ] ; then | ||
cp /etc/openvpn-monitor/apache.conf.example ${apache_conf_file} | ||
fi | ||
|
||
site_packages=$(python3 -c 'import site; print(site.getsitepackages()[-1])') | ||
if ! grep ${site-packages} /etc/httpd/conf.d/openvpn-monitor.conf >/dev/null 2>&1 ; then | ||
sed -i -e "s/^\(Define openvpn_monitor_pythonpath\).*/\1 ${site_packages}" \ | ||
/etc/httpd/conf.d/openvpn-monitor.conf | ||
site_packages="${site_packages//\//\\\/}" | ||
if ! grep ${site_packages} ${apache_conf_file} >/dev/null 2>&1 ; then | ||
sed -i -e "s/^\(Define openvpn_monitor_pythonpath\).*/\1 ${site_packages}/" ${apache_conf_file} | ||
fi | ||
|
||
systemctl enable httpd | ||
systemctl restart httpd | ||
|
||
chown :apache /etc/openvpn-monitor/openvpn-monitor.conf | ||
chown :apache /etc/openvpn-monitor/openvpn-monitor.conf.example | ||
|
||
semanage port -a -t openvpn_port_t -p tcp 5555 | ||
setsebool -P httpd_can_network_connect 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters