From c8fbde89d62e6339a182819ac04dee368e94d9a2 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 9 May 2024 21:14:13 -0700 Subject: [PATCH] add ptouch web service and apache configuration --- apache.conf | 31 +++++++++++++++++++++++++++++++ ptouch_web.service | 11 +++++++++++ run_ptouch | 8 ++++++++ 3 files changed, 50 insertions(+) create mode 100644 apache.conf create mode 100644 ptouch_web.service create mode 100755 run_ptouch diff --git a/apache.conf b/apache.conf new file mode 100644 index 0000000..05ae7f0 --- /dev/null +++ b/apache.conf @@ -0,0 +1,31 @@ +# -*- mode: apache; auto-save-default: nil; make-backup-files: nil; -*- + + SSLEngine On + SSLProtocol all -SSLv2 -SSLv3 + SSLHonorCipherOrder on + SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS " + SSLCertificateFile "/etc/letsencrypt/live/$host/fullchain.pem" + SSLCertificateKeyFile "/etc/letsencrypt/live/$host/privkey.pem" + + + + + ServerName $host + RewriteEngine On + Use SSL_Letsencrypt $host + + RewriteCond %{HTTP:Upgrade} =websocket [NC] + RewriteRule /(.*) ws://localhost:$port/$1 [P,L] + RewriteCond %{HTTP:Upgrade} !=websocket [NC] + RewriteRule /(.*) http://localhost:$port/$1 [P,L] + + + +Use ProxyVirtualHost label-printer.agrin.laureldon.us 8000 + + + ServerName label-printer.agrin.laureldon.us + RewriteEngine On + RewriteCond %{HTTPS} off + RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] + diff --git a/ptouch_web.service b/ptouch_web.service new file mode 100644 index 0000000..b7054c4 --- /dev/null +++ b/ptouch_web.service @@ -0,0 +1,11 @@ +[Unit] +Description=Ptouch Web Service + +[Service] +ExecStart=%Y/run_ptouch +Restart=on-failure +Type=exec + +[Install] +WantedBy=multi-user.target + diff --git a/run_ptouch b/run_ptouch new file mode 100755 index 0000000..a556df6 --- /dev/null +++ b/run_ptouch @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +cd "$(dirname $0)" +. ./venv/bin/activate +export PYTHONPATH="src:." +exec uvicorn ptouch_web.api:app --host 0.0.0.0 -- 2.39.5