mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-27 02:18:39 -05:00
Compare commits
6 Commits
14274c93b5
...
993b40d936
Author | SHA1 | Date | |
---|---|---|---|
993b40d936 | |||
0271ccd145 | |||
578062648b | |||
ecf30d3397 | |||
882e90767d | |||
|
0ca62e727e |
@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. Dates are d
|
|||||||
|
|
||||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||||
|
|
||||||
|
#### [v3.4.3](https://github.com/craigerl/aprsd/compare/v3.4.2...v3.4.3)
|
||||||
|
|
||||||
|
> 29 October 2024
|
||||||
|
|
||||||
|
- Change virtual env name to .venv [`882e907`](https://github.com/craigerl/aprsd/commit/882e90767dd967a4d1018c834a074b33ca9dcb06)
|
||||||
|
- Fixed issue in send_message command [`ecf30d3`](https://github.com/craigerl/aprsd/commit/ecf30d33978e26150bf41ff60b97ff00ab5d5f96)
|
||||||
|
|
||||||
#### [v3.4.2](https://github.com/craigerl/aprsd/compare/v3.4.1...v3.4.2)
|
#### [v3.4.2](https://github.com/craigerl/aprsd/compare/v3.4.1...v3.4.2)
|
||||||
|
|
||||||
> 18 October 2024
|
> 18 October 2024
|
||||||
|
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
WORKDIR?=.
|
WORKDIR?=.
|
||||||
VENVDIR ?= $(WORKDIR)/.aprsd-venv
|
VENVDIR ?= $(WORKDIR)/.venv
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
|
54
aprsd/cmds/admin.py
Normal file
54
aprsd/cmds/admin.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
|
||||||
|
import click
|
||||||
|
from oslo_config import cfg
|
||||||
|
import socketio
|
||||||
|
|
||||||
|
import aprsd
|
||||||
|
from aprsd import cli_helper
|
||||||
|
from aprsd import main as aprsd_main
|
||||||
|
from aprsd import utils
|
||||||
|
from aprsd.main import cli
|
||||||
|
|
||||||
|
|
||||||
|
os.environ["APRSD_ADMIN_COMMAND"] = "1"
|
||||||
|
from aprsd import wsgi as aprsd_wsgi
|
||||||
|
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
LOG = logging.getLogger("APRSD")
|
||||||
|
|
||||||
|
|
||||||
|
# main() ###
|
||||||
|
@cli.command()
|
||||||
|
@cli_helper.add_options(cli_helper.common_options)
|
||||||
|
@click.pass_context
|
||||||
|
@cli_helper.process_standard_options
|
||||||
|
def admin(ctx):
|
||||||
|
"""Start the aprsd admin interface."""
|
||||||
|
signal.signal(signal.SIGINT, aprsd_main.signal_handler)
|
||||||
|
signal.signal(signal.SIGTERM, aprsd_main.signal_handler)
|
||||||
|
|
||||||
|
level, msg = utils._check_version()
|
||||||
|
if level:
|
||||||
|
LOG.warning(msg)
|
||||||
|
else:
|
||||||
|
LOG.info(msg)
|
||||||
|
LOG.info(f"APRSD Started version: {aprsd.__version__}")
|
||||||
|
# Dump all the config options now.
|
||||||
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||||
|
|
||||||
|
async_mode = "threading"
|
||||||
|
sio = socketio.Server(logger=True, async_mode=async_mode)
|
||||||
|
aprsd_wsgi.app.wsgi_app = socketio.WSGIApp(sio, aprsd_wsgi.app.wsgi_app)
|
||||||
|
aprsd_wsgi.init_app()
|
||||||
|
sio.register_namespace(aprsd_wsgi.LoggingNamespace("/logs"))
|
||||||
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||||
|
aprsd_wsgi.app.run(
|
||||||
|
threaded=True,
|
||||||
|
debug=False,
|
||||||
|
port=CONF.admin.web_port,
|
||||||
|
host=CONF.admin.web_ip,
|
||||||
|
)
|
@ -14,6 +14,7 @@ from aprsd.client import client_factory
|
|||||||
from aprsd.main import cli
|
from aprsd.main import cli
|
||||||
import aprsd.packets # noqa : F401
|
import aprsd.packets # noqa : F401
|
||||||
from aprsd.packets import collector
|
from aprsd.packets import collector
|
||||||
|
from aprsd.packets import log as packet_log
|
||||||
from aprsd.threads import tx
|
from aprsd.threads import tx
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ def send_message(
|
|||||||
cl = client_factory.create()
|
cl = client_factory.create()
|
||||||
packet = cl.decode_packet(packet)
|
packet = cl.decode_packet(packet)
|
||||||
collector.PacketCollector().rx(packet)
|
collector.PacketCollector().rx(packet)
|
||||||
packet.log("RX")
|
packet_log.log(packet, tx=False)
|
||||||
# LOG.debug("Got packet back {}".format(packet))
|
# LOG.debug("Got packet back {}".format(packet))
|
||||||
if isinstance(packet, packets.AckPacket):
|
if isinstance(packet, packets.AckPacket):
|
||||||
got_ack = True
|
got_ack = True
|
||||||
|
@ -54,7 +54,7 @@ def cli(ctx):
|
|||||||
|
|
||||||
def load_commands():
|
def load_commands():
|
||||||
from .cmds import ( # noqa
|
from .cmds import ( # noqa
|
||||||
completion, dev, fetch_stats, healthcheck, list_plugins, listen,
|
admin, completion, dev, fetch_stats, healthcheck, list_plugins, listen,
|
||||||
send_message, server, webchat,
|
send_message, server, webchat,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,11 +79,15 @@ def signal_handler(sig, frame):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
|
try:
|
||||||
packets.PacketTrack().save()
|
packets.PacketTrack().save()
|
||||||
packets.WatchList().save()
|
packets.WatchList().save()
|
||||||
packets.SeenList().save()
|
packets.SeenList().save()
|
||||||
packets.PacketList().save()
|
packets.PacketList().save()
|
||||||
collector.Collector().collect()
|
collector.Collector().collect()
|
||||||
|
except Exception as e:
|
||||||
|
LOG.error(f"Failed to save data: {e}")
|
||||||
|
sys.exit(0)
|
||||||
# signal.signal(signal.SIGTERM, sys.exit(0))
|
# signal.signal(signal.SIGTERM, sys.exit(0))
|
||||||
# sys.exit(0)
|
# sys.exit(0)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import importlib.metadata as imp
|
|||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import queue
|
import queue
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
@ -23,6 +24,12 @@ CONF = cfg.CONF
|
|||||||
LOG = logging.getLogger("gunicorn.access")
|
LOG = logging.getLogger("gunicorn.access")
|
||||||
logging_queue = queue.Queue()
|
logging_queue = queue.Queue()
|
||||||
|
|
||||||
|
|
||||||
|
# ADMIN_COMMAND True means we are running from `aprsd admin`
|
||||||
|
# the `aprsd admin` command will import this file after setting
|
||||||
|
# the APRSD_ADMIN_COMMAND environment variable.
|
||||||
|
ADMIN_COMMAND = os.environ.get("APRSD_ADMIN_COMMAND", False)
|
||||||
|
|
||||||
auth = HTTPBasicAuth()
|
auth = HTTPBasicAuth()
|
||||||
users: dict[str, str] = {}
|
users: dict[str, str] = {}
|
||||||
app = Flask(
|
app = Flask(
|
||||||
@ -262,6 +269,7 @@ def init_app(config_file=None, log_level=None):
|
|||||||
|
|
||||||
return log_level
|
return log_level
|
||||||
|
|
||||||
|
print(f"__name__ = {__name__}")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
async_mode = "threading"
|
async_mode = "threading"
|
||||||
@ -297,7 +305,7 @@ if __name__ == "uwsgi_file_aprsd_wsgi":
|
|||||||
CONF.log_opt_values(LOG, logging.DEBUG)
|
CONF.log_opt_values(LOG, logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "aprsd.wsgi":
|
if __name__ == "aprsd.wsgi" and not ADMIN_COMMAND:
|
||||||
# set async_mode to 'threading', 'eventlet', 'gevent' or 'gevent_uwsgi' to
|
# set async_mode to 'threading', 'eventlet', 'gevent' or 'gevent_uwsgi' to
|
||||||
# force a mode else, the best mode is selected automatically from what's
|
# force a mode else, the best mode is selected automatically from what's
|
||||||
# installed
|
# installed
|
||||||
|
225
requirements.txt
225
requirements.txt
@ -4,69 +4,162 @@
|
|||||||
#
|
#
|
||||||
# pip-compile --annotation-style=line requirements.in
|
# pip-compile --annotation-style=line requirements.in
|
||||||
#
|
#
|
||||||
aprslib==0.7.2 # via -r requirements.in
|
aprslib==0.7.2
|
||||||
attrs==24.2.0 # via ax253, kiss3, rush
|
# via -r requirements.in
|
||||||
ax253==0.1.5.post1 # via kiss3
|
attrs==24.2.0
|
||||||
beautifulsoup4==4.12.3 # via -r requirements.in
|
# via
|
||||||
bidict==0.23.1 # via python-socketio
|
# ax253
|
||||||
bitarray==3.0.0 # via ax253, kiss3
|
# kiss3
|
||||||
blinker==1.8.2 # via flask
|
# rush
|
||||||
certifi==2024.8.30 # via requests
|
ax253==0.1.5.post1
|
||||||
charset-normalizer==3.4.0 # via requests
|
# via kiss3
|
||||||
click==8.1.7 # via -r requirements.in, click-params, flask
|
beautifulsoup4==4.12.3
|
||||||
click-params==0.5.0 # via -r requirements.in
|
# via -r requirements.in
|
||||||
commonmark==0.9.1 # via rich
|
bidict==0.23.1
|
||||||
dataclasses==0.6 # via -r requirements.in
|
# via python-socketio
|
||||||
dataclasses-json==0.6.7 # via -r requirements.in
|
bitarray==3.0.0
|
||||||
debtcollector==3.0.0 # via oslo-config
|
# via
|
||||||
deprecated==1.2.14 # via click-params
|
# ax253
|
||||||
flask==3.0.3 # via -r requirements.in, flask-httpauth, flask-socketio
|
# kiss3
|
||||||
flask-httpauth==4.8.0 # via -r requirements.in
|
blinker==1.8.2
|
||||||
flask-socketio==5.4.1 # via -r requirements.in
|
# via flask
|
||||||
geographiclib==2.0 # via geopy
|
certifi==2024.8.30
|
||||||
geopy==2.4.1 # via -r requirements.in
|
# via requests
|
||||||
h11==0.14.0 # via wsproto
|
charset-normalizer==3.4.0
|
||||||
idna==3.10 # via requests
|
# via requests
|
||||||
imapclient==3.0.1 # via -r requirements.in
|
click==8.1.7
|
||||||
importlib-metadata==8.5.0 # via ax253, kiss3
|
# via
|
||||||
itsdangerous==2.2.0 # via flask
|
# -r requirements.in
|
||||||
jinja2==3.1.4 # via flask
|
# click-params
|
||||||
kiss3==8.0.0 # via -r requirements.in
|
# flask
|
||||||
loguru==0.7.2 # via -r requirements.in
|
click-params==0.5.0
|
||||||
markupsafe==3.0.2 # via jinja2, werkzeug
|
# via -r requirements.in
|
||||||
marshmallow==3.23.0 # via dataclasses-json
|
commonmark==0.9.1
|
||||||
mypy-extensions==1.0.0 # via typing-inspect
|
# via rich
|
||||||
netaddr==1.3.0 # via oslo-config
|
dataclasses==0.6
|
||||||
oslo-config==9.6.0 # via -r requirements.in
|
# via -r requirements.in
|
||||||
oslo-i18n==6.4.0 # via oslo-config
|
dataclasses-json==0.6.7
|
||||||
packaging==24.1 # via marshmallow
|
# via -r requirements.in
|
||||||
pbr==6.1.0 # via oslo-i18n, stevedore
|
debtcollector==3.0.0
|
||||||
pluggy==1.5.0 # via -r requirements.in
|
# via oslo-config
|
||||||
pygments==2.18.0 # via rich
|
deprecated==1.2.14
|
||||||
pyserial==3.5 # via pyserial-asyncio
|
# via click-params
|
||||||
pyserial-asyncio==0.6 # via kiss3
|
flask==3.0.3
|
||||||
python-engineio==4.10.1 # via python-socketio
|
# via
|
||||||
python-socketio==5.11.4 # via -r requirements.in, flask-socketio
|
# -r requirements.in
|
||||||
pytz==2024.2 # via -r requirements.in
|
# flask-httpauth
|
||||||
pyyaml==6.0.2 # via -r requirements.in, oslo-config
|
# flask-socketio
|
||||||
requests==2.32.3 # via -r requirements.in, oslo-config, update-checker
|
flask-httpauth==4.8.0
|
||||||
rfc3986==2.0.0 # via oslo-config
|
# via -r requirements.in
|
||||||
rich==12.6.0 # via -r requirements.in
|
flask-socketio==5.4.1
|
||||||
rush==2021.4.0 # via -r requirements.in
|
# via -r requirements.in
|
||||||
shellingham==1.5.4 # via -r requirements.in
|
geographiclib==2.0
|
||||||
simple-websocket==1.1.0 # via python-engineio
|
# via geopy
|
||||||
six==1.16.0 # via -r requirements.in
|
geopy==2.4.1
|
||||||
soupsieve==2.6 # via beautifulsoup4
|
# via -r requirements.in
|
||||||
stevedore==5.3.0 # via oslo-config
|
h11==0.14.0
|
||||||
tabulate==0.9.0 # via -r requirements.in
|
# via wsproto
|
||||||
thesmuggler==1.0.1 # via -r requirements.in
|
idna==3.10
|
||||||
typing-extensions==4.12.2 # via typing-inspect
|
# via requests
|
||||||
typing-inspect==0.9.0 # via dataclasses-json
|
imapclient==3.0.1
|
||||||
tzlocal==5.2 # via -r requirements.in
|
# via -r requirements.in
|
||||||
update-checker==0.18.0 # via -r requirements.in
|
importlib-metadata==8.5.0
|
||||||
urllib3==2.2.3 # via requests
|
# via
|
||||||
validators==0.22.0 # via click-params
|
# ax253
|
||||||
werkzeug==3.0.4 # via flask
|
# kiss3
|
||||||
wrapt==1.16.0 # via -r requirements.in, debtcollector, deprecated
|
itsdangerous==2.2.0
|
||||||
wsproto==1.2.0 # via simple-websocket
|
# via flask
|
||||||
zipp==3.20.2 # via importlib-metadata
|
jinja2==3.1.4
|
||||||
|
# via flask
|
||||||
|
kiss3==8.0.0
|
||||||
|
# via -r requirements.in
|
||||||
|
loguru==0.7.2
|
||||||
|
# via -r requirements.in
|
||||||
|
markupsafe==3.0.2
|
||||||
|
# via
|
||||||
|
# jinja2
|
||||||
|
# werkzeug
|
||||||
|
marshmallow==3.23.0
|
||||||
|
# via dataclasses-json
|
||||||
|
mypy-extensions==1.0.0
|
||||||
|
# via typing-inspect
|
||||||
|
netaddr==1.3.0
|
||||||
|
# via oslo-config
|
||||||
|
oslo-config==9.6.0
|
||||||
|
# via -r requirements.in
|
||||||
|
oslo-i18n==6.4.0
|
||||||
|
# via oslo-config
|
||||||
|
packaging==24.1
|
||||||
|
# via marshmallow
|
||||||
|
pbr==6.1.0
|
||||||
|
# via
|
||||||
|
# oslo-i18n
|
||||||
|
# stevedore
|
||||||
|
pluggy==1.5.0
|
||||||
|
# via -r requirements.in
|
||||||
|
pygments==2.18.0
|
||||||
|
# via rich
|
||||||
|
pyserial==3.5
|
||||||
|
# via pyserial-asyncio
|
||||||
|
pyserial-asyncio==0.6
|
||||||
|
# via kiss3
|
||||||
|
python-engineio==4.10.1
|
||||||
|
# via python-socketio
|
||||||
|
python-socketio==5.11.4
|
||||||
|
# via
|
||||||
|
# -r requirements.in
|
||||||
|
# flask-socketio
|
||||||
|
pytz==2024.2
|
||||||
|
# via -r requirements.in
|
||||||
|
pyyaml==6.0.2
|
||||||
|
# via
|
||||||
|
# -r requirements.in
|
||||||
|
# oslo-config
|
||||||
|
requests==2.32.3
|
||||||
|
# via
|
||||||
|
# -r requirements.in
|
||||||
|
# oslo-config
|
||||||
|
# update-checker
|
||||||
|
rfc3986==2.0.0
|
||||||
|
# via oslo-config
|
||||||
|
rich==12.6.0
|
||||||
|
# via -r requirements.in
|
||||||
|
rush==2021.4.0
|
||||||
|
# via -r requirements.in
|
||||||
|
shellingham==1.5.4
|
||||||
|
# via -r requirements.in
|
||||||
|
simple-websocket==1.1.0
|
||||||
|
# via python-engineio
|
||||||
|
six==1.16.0
|
||||||
|
# via -r requirements.in
|
||||||
|
soupsieve==2.6
|
||||||
|
# via beautifulsoup4
|
||||||
|
stevedore==5.3.0
|
||||||
|
# via oslo-config
|
||||||
|
tabulate==0.9.0
|
||||||
|
# via -r requirements.in
|
||||||
|
thesmuggler==1.0.1
|
||||||
|
# via -r requirements.in
|
||||||
|
typing-extensions==4.12.2
|
||||||
|
# via typing-inspect
|
||||||
|
typing-inspect==0.9.0
|
||||||
|
# via dataclasses-json
|
||||||
|
tzlocal==5.2
|
||||||
|
# via -r requirements.in
|
||||||
|
update-checker==0.18.0
|
||||||
|
# via -r requirements.in
|
||||||
|
urllib3==2.2.3
|
||||||
|
# via requests
|
||||||
|
validators==0.22.0
|
||||||
|
# via click-params
|
||||||
|
werkzeug==3.0.6
|
||||||
|
# via flask
|
||||||
|
wrapt==1.16.0
|
||||||
|
# via
|
||||||
|
# -r requirements.in
|
||||||
|
# debtcollector
|
||||||
|
# deprecated
|
||||||
|
wsproto==1.2.0
|
||||||
|
# via simple-websocket
|
||||||
|
zipp==3.20.2
|
||||||
|
# via importlib-metadata
|
||||||
|
Loading…
Reference in New Issue
Block a user