|
1 |
| -# Open Pectus |
2 |
| -Documentation is available at [Read the Docs](https://docs.openpectus.org/latest/). |
| 1 | +# Open Pectus Database Administration |
| 2 | +Manage [Open Pectus](https://github.com/Open-Pectus/Open-Pectus/) aggregator database in a convenient web interface. |
| 3 | + |
| 4 | +Documentation is available at [Read the Docs](https://docs.openpectus.org/latest/). |
| 5 | + |
| 6 | +## Getting started |
| 7 | +Run this tool using Docker assuming the aggregator sqlite database is located at `/home/azureuser/data_prd/open_pectus_aggregator.sqlite3`: |
| 8 | + |
| 9 | +```console |
| 10 | +docker run --pull=always --detach \ |
| 11 | +--name openpectus-database-administration \ |
| 12 | +-h AZR-PECTUS-PRD-DATABASE-ADMINISTRATION \ |
| 13 | +-v /home/azureuser/data_prd:/data |
| 14 | +-p 0.0.0.0:8301:8301/tcp \ |
| 15 | +ghcr.io/open-pectus/database-administration:main |
| 16 | +``` |
| 17 | + |
| 18 | +The web interface will be available at http://localhost:8301. Beware that the web interface has no access restrictions. |
| 19 | + |
| 20 | +## Azure Authorization Intregration |
| 21 | +The Database Administration web interface can integrated with Azure App Registrations for access control. A client secret must be provided, a Web app redirect url `https://domain.tld/admin/msal` must be specified, and users who should have access must be assigned to an "Administrator" App Role. |
| 22 | + |
| 23 | +To enable the integration, specify the following environment variables when launching the Docker image: |
| 24 | +* `AZURE_APPLICATION_CLIENT_ID` |
| 25 | +* `AZURE_DIRECTORY_TENANT_ID` |
| 26 | +* `AZURE_CLIENT_SECRET` |
| 27 | +* `ENABLE_AZURE_AUTHENTICATION=true` |
| 28 | + |
| 29 | +Run the Docker image as follows: |
| 30 | +```console |
| 31 | +docker run --pull=always --detach \ |
| 32 | +--name openpectus-database-administration \ |
| 33 | +-h AZR-PECTUS-PRD-DATABASE-ADMINISTRATION \ |
| 34 | +-v /home/azureuser/data_prd:/data |
| 35 | +-e AZURE_APPLICATION_CLIENT_ID='...' \ |
| 36 | +-e AZURE_DIRECTORY_TENANT_ID='...' \ |
| 37 | +-e AZURE_CLIENT_SECRET='...' \ |
| 38 | +-e ENABLE_AZURE_AUTHENTICATION='true' \ |
| 39 | +-p 0.0.0.0:8301:8301/tcp \ |
| 40 | +ghcr.io/open-pectus/database-administration:main |
| 41 | +``` |
| 42 | + |
| 43 | +## Deployment behind nginx |
| 44 | +The Database Administration web interface can be deployed behind nginx reverse proxy. See the sample nginx configuration below in which letsencrypt is used for SSL certificates. The web interface is then available at https://domain.tld/admin/. |
| 45 | + |
| 46 | +```nginx |
| 47 | +server { |
| 48 | + if ($host = domain.tld) { |
| 49 | + return 301 https://$host$request_uri; |
| 50 | + } |
| 51 | +} |
| 52 | +
|
| 53 | +server { |
| 54 | + listen 443 ssl; |
| 55 | + server_name openpectus.com; |
| 56 | + ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; # managed by Certbot |
| 57 | + ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; # managed by Certbot |
| 58 | + location /admin/ { |
| 59 | + proxy_pass http://127.0.0.1:8301; |
| 60 | + proxy_set_header Host $host; |
| 61 | + proxy_set_header X-Real-IP $remote_addr; |
| 62 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 63 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 64 | + proxy_buffer_size 128k; |
| 65 | + proxy_buffers 8 128k; |
| 66 | + proxy_busy_buffers_size 256k; |
| 67 | + } |
| 68 | + } |
| 69 | + ``` |
0 commit comments