From 8f683e2a1a212baea1ab454078c0ff9484db6a4a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 1 Dec 2023 12:13:49 -0700 Subject: [PATCH] add more setup hints to README to run locally --- README.md | 70 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7990446..8aab47f 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,6 @@ ## Docker Compose Setup -``` -version: '3.1' - -services: - endorser-push-server: - container_name: 'endorser-push-server' - image: endorser-push-server:1.0 - build: - context: ./py-push-server - volumes: - - /docker-volumes/pwa-push-server/data:/app/instance/data - restart: always - networks: - - phoenix-network - -networks: - phoenix-network: - external: true -``` On first run you need to: @@ -204,3 +185,54 @@ timesafari-pwa.anomalistlabs.com/web-push/ web_push_backend `docker-compose up -d` should just work :-) + + + + + + + + + + + + +## Run the server outside Docker + +Run the app: + +```commandline +sh <(curl https://pkgx.sh) +python.org +virtualenv.pypa.io sh + +source venv/bin/activate + +python app.py + +# See Troubleshooting below if that doesn't work out of the box. +``` + + + +Run a test: + +```commandline +python webpush.py +``` + + + +Run haproxy (on a Mac): + +* Create "haproxy-config" directory for those files above, eg. /usr/local/etc/haproxy + +* Comment out the `log rsyslog` and `bind *:443` lines in /usr/local/etc/haproxy/haproxy.cfg and then run: + +`haproxy -f /usr/local/etc/haproxy/haproxy.cfg` + + + +Troubleshooting + +* If you get "unable to open database file", you can edit the app.py line with + SQLALCHEMY_DATABASE_URI and add `sqlite:////...` with the full path to the data/webpush.db file. + (Why does the relative path of `sqlite:///...` not work for a relative path?)