|
| 1 | +# Docker Compose |
| 2 | + |
| 3 | +This section describes how to setup Papermerge and |
| 4 | +related services using docker compose. |
| 5 | + |
| 6 | +Each docker compose file is used here in combination with one `environment file` usually |
| 7 | +named `.env`. |
| 8 | + |
| 9 | +Make sure you have both `docker`. |
| 10 | + |
| 11 | +This guide was tested with docker version 20.10.6 and |
| 12 | +docker-compose version 1.29.2. |
| 13 | + |
| 14 | + |
| 15 | +## Complete Stack in 2 minutes |
| 16 | + |
| 17 | + |
| 18 | +This setup installs complete {{ extra.project }} stack with all required services. |
| 19 | + |
| 20 | +Save following `docker-compose.yml` file on your local computer. |
| 21 | + |
| 22 | + |
| 23 | +Next, create `.env` file with following content: |
| 24 | + |
| 25 | +```console |
| 26 | + DB_USER=postgres |
| 27 | + DB_NAME=postgres |
| 28 | + DB_PASSWORD=postgres |
| 29 | + DB_HOST=db |
| 30 | + DB_PORT=5432 |
| 31 | + |
| 32 | + REDIS_HOST=redis |
| 33 | + REDIS_PORT=6379 |
| 34 | + |
| 35 | + SECRET_KEY=12345abcdxyz |
| 36 | + |
| 37 | + SUPERUSER_USERNAME=admin |
| 38 | + |
| 39 | + SUPERUSER_PASSWORD=admin |
| 40 | +``` |
| 41 | + |
| 42 | +Start {{ extra.project }} using following docker compose command: |
| 43 | + |
| 44 | +```console |
| 45 | + docker compose -f docker-compose.yml --env-file .env up |
| 46 | +``` |
| 47 | + |
| 48 | +You can access |project| user interface using a web browser like Firefox. |
| 49 | +Open your web browser and point it to http://localhost:16000 address: |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +Sign in using credentials configured with ``SUPERUSER_USERNAME`` and |
| 54 | +``SUPERUSER_PASSWORD`` options in ``.env`` file. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +## Elastic Search |
| 60 | + |
| 61 | +In previous section, {{ extra.project }} used xapian built in search engine. However, for |
| 62 | +production environments, a full fledged search engine like Elasticsearch makes more sense. |
| 63 | + |
| 64 | +Here is setup which uses Elasticsearch: |
| 65 | + |
| 66 | +```yaml |
| 67 | + version: '3.7' |
| 68 | + x-backend: &common # yaml anchor definition |
| 69 | + image: papermerge/papermerge:2.1.9 |
| 70 | + volumes: |
| 71 | + - media_root:/app/media |
| 72 | + environment: |
| 73 | + - PAPERMERGE__MAIN__SECRET_KEY=12345SKK |
| 74 | + - DJANGO_SUPERUSER_PASSWORD=1234 |
| 75 | + - PAPERMERGE__REDIS__HOST=redis |
| 76 | + - PAPERMERGE__REDIS__PORT=6379 |
| 77 | + - PAPERMERGE__DATABASE__TYPE=postgres |
| 78 | + - PAPERMERGE__DATABASE__USER=postgres |
| 79 | + - PAPERMERGE__DATABASE__NAME=postgres |
| 80 | + - PAPERMERGE__DATABASE__PASSWORD=postgres |
| 81 | + - PAPERMERGE__DATABASE__HOST=db |
| 82 | + - PAPERMERGE__DATABASE__PORT=5432 |
| 83 | + - PAPERMERGE__SEARCH__ENGINE=elastic7 |
| 84 | + - PAPERMERGE__SEARCH__URL=http://es:9200 |
| 85 | + services: |
| 86 | + backend: |
| 87 | + <<: *common |
| 88 | + worker: |
| 89 | + <<: *common |
| 90 | + command: worker |
| 91 | + redis: |
| 92 | + image: redis:6 |
| 93 | + ports: |
| 94 | + - '6379:6379' |
| 95 | + db: |
| 96 | + image: postgres:14.4 |
| 97 | + volumes: |
| 98 | + - postgres_data:/var/lib/postgresql/data/ |
| 99 | + environment: |
| 100 | + - POSTGRES_USER=postgres |
| 101 | + - POSTGRES_DB=postgres |
| 102 | + - POSTGRES_PASSWORD=postgres |
| 103 | + es: |
| 104 | + image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2 |
| 105 | + environment: |
| 106 | + - discovery.type=single-node |
| 107 | + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" |
| 108 | + ports: |
| 109 | + - 9200:9200 |
| 110 | + - 9300:9300 |
| 111 | + volumes: |
| 112 | + media_root: |
| 113 | + postgres_data: |
| 114 | +``` |
0 commit comments