|
|
@ -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?) |
|
|
|