From acadc57958d430e45f9a01da3b718d13c56ce44a Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Mon, 25 May 2026 13:52:46 +0000 Subject: [PATCH] Initial infra: cron, systemd units, agent config template, README --- README.md | 20 ++++++++++++++++++++ agent/config.template.json | 8 ++++++++ cron/do-server.crontab | 26 ++++++++++++++++++++++++++ systemd/do-agent.service | 19 +++++++++++++++++++ systemd/droplet-agent.service | 19 +++++++++++++++++++ systemd/fastapi_ssh_server.service | 14 ++++++++++++++ systemd/jarvis-agent.service | 14 ++++++++++++++ 7 files changed, 120 insertions(+) create mode 100644 README.md create mode 100644 agent/config.template.json create mode 100644 cron/do-server.crontab create mode 100644 systemd/do-agent.service create mode 100644 systemd/droplet-agent.service create mode 100644 systemd/fastapi_ssh_server.service create mode 100644 systemd/jarvis-agent.service diff --git a/README.md b/README.md new file mode 100644 index 0000000..b0e8b74 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# DO Server Infrastructure + +DigitalOcean server at 165.22.1.228 (CyberPanel / OpenLiteSpeed). + +## Directory Structure +- `cron/` — Root crontab (CyberPanel + JARVIS entries) +- `systemd/` — Custom systemd service units +- `agent/` — JARVIS agent config template + +## Deploy workflow +1. Edit code in site repos (myronblair/*) +2. `git push origin main` +3. On server: `cd /home//public_html && git pull origin main` + +## JARVIS agent install +```bash +cp agent/config.json /opt/jarvis-agent/config.json +systemctl enable jarvis-agent +systemctl start jarvis-agent +``` diff --git a/agent/config.template.json b/agent/config.template.json new file mode 100644 index 0000000..6b20213 --- /dev/null +++ b/agent/config.template.json @@ -0,0 +1,8 @@ +{ + "server_url": "https://165.22.1.228", + "host_header": "jarvis.orbishosting.com", + "registration_key": "REPLACE_WITH_AGENT_REGISTRATION_KEY", + "agent_type": "linux", + "heartbeat_interval": 10, + "metrics_interval": 30 +} diff --git a/cron/do-server.crontab b/cron/do-server.crontab new file mode 100644 index 0000000..51c648e --- /dev/null +++ b/cron/do-server.crontab @@ -0,0 +1,26 @@ + +0 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/findBWUsage.py >/dev/null 2>&1 +0 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/postfixSenderPolicy/client.py hourlyCleanup >/dev/null 2>&1 +0 0 1 * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/postfixSenderPolicy/client.py monthlyCleanup >/dev/null 2>&1 +0 2 * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/upgradeCritical.py >/dev/null 2>&1 +0 0 * * 4 /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/renew.py >/dev/null 2>&1 +7 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null +0 0 * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py Daily +0 0 * * 0 /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py Weekly + +*/30 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '30 Minutes' +0 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '1 Hour' +0 */6 * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '6 Hours' +0 */12 * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '12 Hours' +0 1 * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '1 Day' +0 0 */3 * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '3 Days' +0 0 * * 0 /usr/local/CyberCP/bin/python /usr/local/CyberCP/IncBackups/IncScheduler.py '1 Week' + +*/3 * * * * if ! find /home/*/public_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then systemctl restart lsws; fi +09,39 * * * * /usr/local/CyberCP/bin/cleansessions >/dev/null 2>&1 + +* * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/manage.py run_scheduled_scans >/usr/local/lscp/logs/scheduled_scans.log 2>&1 + +*/5 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/pdnsHealthCheck.py >/dev/null 2>&1 +*/3 * * * * /usr/local/lsws/lsphp85/bin/lsphp /home/jarvis.orbishosting.com/api/endpoints/facts_collector.php >> /home/jarvis.orbishosting.com/logs/cron.log 2>&1 +*/5 * * * * /usr/local/lsws/lsphp85/bin/lsphp /home/jarvis.orbishosting.com/api/endpoints/stats_cache.php >> /home/jarvis.orbishosting.com/logs/cron.log 2>&1 diff --git a/systemd/do-agent.service b/systemd/do-agent.service new file mode 100644 index 0000000..6157610 --- /dev/null +++ b/systemd/do-agent.service @@ -0,0 +1,19 @@ +[Unit] +Description=The DigitalOcean Monitoring Agent +After=network-online.target +Wants=network-online.target + +[Service] +User=do-agent +ExecStart=/opt/digitalocean/bin/do-agent --syslog +Restart=always + +OOMScoreAdjust=-900 +SyslogIdentifier=DigitalOceanAgent +PrivateTmp=yes +ProtectSystem=full +ProtectHome=yes +NoNewPrivileges=yes + +[Install] +WantedBy=multi-user.target diff --git a/systemd/droplet-agent.service b/systemd/droplet-agent.service new file mode 100644 index 0000000..64c665e --- /dev/null +++ b/systemd/droplet-agent.service @@ -0,0 +1,19 @@ +[Unit] +Description=The DigitalOcean Droplet Agent +After=network-online.target +Wants=network-online.target + +[Service] +User=root +Environment=TERM=xterm-256color +ExecStart=/opt/digitalocean/bin/droplet-agent +Restart=always +RestartSec=10 +TimeoutStopSec=90 +KillMode=process + +OOMScoreAdjust=-900 +SyslogIdentifier=DropletAgent + +[Install] +WantedBy=multi-user.target diff --git a/systemd/fastapi_ssh_server.service b/systemd/fastapi_ssh_server.service new file mode 100644 index 0000000..916b777 --- /dev/null +++ b/systemd/fastapi_ssh_server.service @@ -0,0 +1,14 @@ +[Unit] +Description=FastAPI SSH Web Terminal Server +After=network.target + +[Service] +Type=simple +WorkingDirectory=/usr/local/CyberCP +ExecStart=/usr/local/CyberCP/bin/python3 -m uvicorn fastapi_ssh_server:app --host 0.0.0.0 --port 8888 --ssl-keyfile=/usr/local/lscp/conf/key.pem --ssl-certfile=/usr/local/lscp/conf/cert.pem +Restart=on-failure +User=root +Group=root + +[Install] +WantedBy=multi-user.target diff --git a/systemd/jarvis-agent.service b/systemd/jarvis-agent.service new file mode 100644 index 0000000..abde978 --- /dev/null +++ b/systemd/jarvis-agent.service @@ -0,0 +1,14 @@ +[Unit] +Description=JARVIS Agent +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/bin/python3 /usr/local/bin/jarvis-agent.py +Restart=always +RestartSec=30 +User=root + +[Install] +WantedBy=multi-user.target