-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify Docker Compose configuration
Intention is to make is as easy as possible to get started and provide documentation for any optional configuration, and leave it up to developers to manage their own configuration in override files that won't be committed.
- Loading branch information
Showing
8 changed files
with
226 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,14 @@ | ||
version: '3.5' | ||
version: '3' | ||
|
||
services: | ||
|
||
django: | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile.dev | ||
environment: | ||
DB_NAME: postgres | ||
DB_USER: postgres | ||
DB_PASSWORD: iogt | ||
DB_HOST: database | ||
DB_PORT: '5432' | ||
DJANGO_SETTINGS_MODULE: iogt.settings.docker_compose_dev | ||
COMMIT_HASH: asdfghjkl | ||
WAGTAILTRANSFER_SECRET_KEY: wagtailtransfer-secret-key | ||
WAGTAILTRANSFER_SOURCE_NAME: iogt_global | ||
WAGTAILTRANSFER_SOURCE_BASE_URL: https://example.com/wagtail-transfer/ | ||
WAGTAILTRANSFER_SOURCE_SECRET_KEY: wagtailtransfer-source-secret-key | ||
BASE_URL: 'http://localhost:8000' | ||
VAPID_PUBLIC_KEY: '' | ||
VAPID_PRIVATE_KEY: '' | ||
VAPID_ADMIN_EMAIL: '' | ||
COMMENTS_COMMUNITY_MODERATION: 'enable' | ||
COMMENT_MODERATION_CLASS: 'comments.clients.AlwaysApproveModerator' | ||
BLACKLISTED_WORDS: '' | ||
SUPERSET_BASE_URL: '' | ||
SUPERSET_DATABASE_NAME: '' | ||
SUPERSET_USERNAME: '' | ||
SUPERSET_PASSWORD: '' | ||
PUSH_NOTIFICATION: 'enable' | ||
JQUERY: 'enable' | ||
MATOMO_TRACKING: 'enable' | ||
MATOMO_SERVER_URL: '' | ||
MATOMO_SITE_ID: '' | ||
IMAGE_SIZE_PRESET: '' | ||
DJANGO_SETTINGS_MODULE: iogt.settings.dev | ||
command: python manage.py runserver 0.0.0.0:8000 | ||
volumes: | ||
- ./:/app/ | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- elasticsearch | ||
- database | ||
|
||
elasticsearch: | ||
image: 'docker.elastic.co/elasticsearch/elasticsearch:7.12.1' | ||
environment: | ||
- discovery.type=single-node | ||
volumes: | ||
- es-data01:/usr/share/elasticsearch/data | ||
ports: | ||
- "9200:9200" | ||
|
||
database: | ||
image: postgres:alpine | ||
restart: unless-stopped | ||
environment: | ||
POSTGRES_PASSWORD: iogt | ||
volumes: | ||
- pg-data01:/var/lib/postgresql/data | ||
- ./initdb.d:/docker-entrypoint-initdb.d | ||
ports: | ||
- 5432:5432 | ||
|
||
|
||
volumes: | ||
es-data01: | ||
pg-data01: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Overview | ||
|
||
Wagtail supports the use of Elasticsearch as a search backend, to speed up searches and remove the burden of searching from the relational database. | ||
|
||
# Setup | ||
|
||
The outline of the setup process is as follows. | ||
|
||
1. Create an Elasticsearch cluster | ||
1. Configure Wagtail to use Elasticsearch | ||
1. Create the search index | ||
|
||
## Create Elasticsearch cluster | ||
|
||
Create the file `docker-compose.override.yml`. Add the following to the file. | ||
|
||
```yaml | ||
version: '3' | ||
services: | ||
search: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.1 | ||
environment: | ||
- discovery.type=single-node | ||
volumes: | ||
- search:/usr/share/elasticsearch/data | ||
ports: | ||
- "9200:9200" | ||
volumes: | ||
search: | ||
``` | ||
If you already have a `docker-compose.override.yml`, you will need to merge the snippet above into it, in which case, you will probably not need the first two lines. | ||
|
||
## Configure Wagtail to use Elasticsearch | ||
|
||
Create the file `iogt/settings/local.py`. Add the following to the file. | ||
|
||
```python | ||
WAGTAILSEARCH_BACKENDS = { | ||
'default': { | ||
'BACKEND': 'wagtail.search.backends.elasticsearch7', | ||
'URLS': ['http://search:9200'], | ||
'INDEX': 'iogt', | ||
'TIMEOUT': 5, | ||
'OPTIONS': {}, | ||
'INDEX_SETTINGS': {}, | ||
'AUTO_UPDATE': True, | ||
'ATOMIC_REBUILD': True | ||
} | ||
} | ||
``` | ||
|
||
More information about the available configuration options can be found in the [search backends] section of the Wagtail documentation. | ||
|
||
## Create the search index | ||
|
||
To create and subsequently update the ElasticSearch index. | ||
|
||
```sh | ||
docker compose run --rm django python manage.py update_index | ||
``` | ||
|
||
|
||
[search backends]: https://docs.wagtail.org/en/v2.15.6/topics/search/backends.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Overview | ||
|
||
The IoGT app supports environment variables as a way of changing some frequently used configuration options. | ||
|
||
# Use with Docker | ||
|
||
Environment variables can be defined in `docker-compose.yml`, `docker-compose.override.yml` or any custom Docker Compose configuration file. Environment variables are specified for each service, for example. | ||
|
||
```yaml | ||
services: | ||
django: | ||
environment: | ||
DB_HOST: db | ||
``` | ||
# List of environment variables | ||
```yaml | ||
DB_NAME: postgres | ||
DB_USER: postgres | ||
DB_PASSWORD: iogt | ||
DB_HOST: db | ||
DB_PORT: '5432' | ||
COMMIT_HASH: asdfghjkl | ||
WAGTAILTRANSFER_SECRET_KEY: wagtailtransfer-secret-key | ||
WAGTAILTRANSFER_SOURCE_NAME: iogt_global | ||
WAGTAILTRANSFER_SOURCE_BASE_URL: https://example.com/wagtail-transfer/ | ||
WAGTAILTRANSFER_SOURCE_SECRET_KEY: wagtailtransfer-source-secret-key | ||
VAPID_PUBLIC_KEY: '' | ||
VAPID_PRIVATE_KEY: '' | ||
VAPID_ADMIN_EMAIL: '' | ||
COMMENTS_COMMUNITY_MODERATION: enable | ||
COMMENT_MODERATION_CLASS: comments.clients.AlwaysApproveModerator | ||
BLACKLISTED_WORDS: '' | ||
SUPERSET_BASE_URL: '' | ||
SUPERSET_DATABASE_NAME: '' | ||
SUPERSET_USERNAME: '' | ||
SUPERSET_PASSWORD: '' | ||
PUSH_NOTIFICATION: enable | ||
JQUERY: enable | ||
MATOMO_TRACKING: enable | ||
MATOMO_URL: '' | ||
MATOMO_SITE_ID: '' | ||
IMAGE_SIZE_PRESET: '' | ||
``` | ||
Oops, something went wrong.