Skip to content

Conversation

@joshStillerman
Copy link
Contributor

Hi -

I made a whole bunch of changes to add authentication for redis and provide systemd services files. A few of them are BREAKING changes - named arguments to some of the scripts. If you would like to discuss, prior to, or instead of merging I totally understand and would be happy to.

There are pretty good comments in some of the commits.

A lot of the code was written / suggested by chatGPT, but I did look at it pretty closely.

-Josh

joshStillerman and others added 9 commits January 6, 2026 15:08
…ment improvements

This commit introduces a comprehensive production-ready deployment system with
systemd service integration, centralized configuration, and operational improvements.

New Features:
- redis_connector.py: Centralized Redis connection management with support for
  environment variables, CLI args, TLS, authentication, password files, and
  configurable connection options
- Systemd service units for action_dispatcher, dispatcher_webmonitor, and
  templated action_server@ instances with hardening (NoNewPrivileges,
  PrivateTmp, ProtectSystem, ProtectHome)
- install.sh: Automated installer script for setting up services with
  configurable user/path, virtualenv creation, and dependency installation
- nginx-dispatcher.conf: Production-ready Nginx reverse proxy configuration
  with upstream pooling, WebSocket support, and security headers
- requirements.txt: Python dependency declarations (redis, Flask, gunicorn, gevent)
- rdispatch.env.example: Sample environment configuration file

Core Improvements:
- Replaced hardcoded sys.argv parsing with argparse across all entry points
- Converted debug print() statements to structured logging with --log-level CLI option
- Added graceful shutdown handlers (SIGTERM/SIGINT) to dispatcher
- Robust error handling in Redis connector (file I/O, connection failures, auth)
- Parameterized service files using %INSTALL_USER% and %INSTALL_PATH% placeholders

Configuration Changes:
- action_dispatcher.py: Now uses redis_connector, argparse, and logging
- action_server.py: Accepts Redis object, uses logging, --log-level support
- dispatcher_webmonitor.py: Uses redis_connector.connect_from_env(), logging
- show_log.py: Migrated to argparse, redis_connector, and logging
- Gunicorn settings: 4 workers, 120s timeout, 600s keepalive, bind to 127.0.0.1:5000

Service Architecture:
- [email protected]: Templated unit supporting instances like
  action_server@my_server:1 for scalable server deployment
- All services use journald logging, environment files, and systemd best practices
- Services bind web monitor to localhost only, requiring reverse proxy for external access

Documentation:
- README.md: Added installation instructions, configuration guide, service
  management examples, and Nginx setup documentation

Breaking Changes:
- action_server.py main() signature changed to accept Redis object instead of host string
- Redis connection now requires explicit configuration via CLI args or environment
- action_server_my_server_1.service removed in favor of templated [email protected]
@GabrieleManduchi
Copy link
Contributor

GabrieleManduchi commented Jan 12, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants