]> git.donarmstrong.com Git - ptouch_web.git/commitdiff
add ptouch web service and apache configuration
authorDon Armstrong <don@donarmstrong.com>
Fri, 10 May 2024 04:14:13 +0000 (21:14 -0700)
committerDon Armstrong <don@donarmstrong.com>
Fri, 10 May 2024 04:14:13 +0000 (21:14 -0700)
apache.conf [new file with mode: 0644]
ptouch_web.service [new file with mode: 0644]
run_ptouch [new file with mode: 0755]

diff --git a/apache.conf b/apache.conf
new file mode 100644 (file)
index 0000000..05ae7f0
--- /dev/null
@@ -0,0 +1,31 @@
+# -*- mode: apache; auto-save-default: nil; make-backup-files: nil; -*-
+<Macro SSL_Letsencrypt $host>
+    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"
+</Macro>
+
+<Macro ProxyVirtualHost $host $port>
+    <VirtualHost *:443>
+        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]
+    </VirtualHost>
+</Macro>    
+
+Use ProxyVirtualHost label-printer.agrin.laureldon.us 8000
+
+<VirtualHost *:80>
+    ServerName label-printer.agrin.laureldon.us
+    RewriteEngine On
+    RewriteCond %{HTTPS} off
+    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
+</VirtualHost>
diff --git a/ptouch_web.service b/ptouch_web.service
new file mode 100644 (file)
index 0000000..b7054c4
--- /dev/null
@@ -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 (executable)
index 0000000..a556df6
--- /dev/null
@@ -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