Skip to content

Commit

Permalink
elastic8-only by default
Browse files Browse the repository at this point in the history
  • Loading branch information
aaxelb committed Apr 13, 2023
1 parent ca08e9d commit 25bb9c9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 28 deletions.
2 changes: 0 additions & 2 deletions .docker-compose.elastic8.env

This file was deleted.

1 change: 0 additions & 1 deletion .docker-compose.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672
DATABASE_HOST=postgres
ELASTICSEARCH_URL=http://elasticsearch:9200/
ELASTICSEARCH8_URL=https://elastic8:9200/
EMBER_SHARE_URL=http://frontend:4200
LOGIN_REDIRECT_URL=http://localhost:8003/
Expand Down
28 changes: 6 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ version: '3.4'
volumes:
postgres_data_vol:
external: false
elasticsearch_data_vol:
external: false
elastic8_data_vol:
external: false
elastic8_cert_vol:
Expand All @@ -29,29 +27,21 @@ services:
# Backend Services #
####################

elasticsearch:
image: elasticsearch:5.4
ports:
- 9203:9200
environment:
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
volumes:
- elasticsearch_data_vol:/usr/share/elasticsearch/data
stdin_open: true

elastic8_setup:
image: docker.elastic.co/elasticsearch/elasticsearch:8.6.1
volumes:
- elastic8_cert_vol:/usr/share/elasticsearch/config/certs
user: "0"
env_file: .docker-compose.elastic8.env
environment:
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-secretsecret}
KIBANA_PASSWORD: ${KIBANA_PASSWORD:-kibanakibana}
command: >
bash -c '
if [ x$${ELASTIC_PASSWORD} == x ]; then
echo "Set the ELASTIC_PASSWORD environment variable in the .docker-compose.elastic8.env file";
echo "Set the ELASTIC_PASSWORD environment variable";
exit 1;
elif [ x$${KIBANA_PASSWORD} == x ]; then
echo "Set the KIBANA_PASSWORD environment variable in the .docker-compose.elastic8.env file";
echo "Set the KIBANA_PASSWORD environment variable";
exit 1;
fi;
if [ ! -f config/certs/ca.zip ]; then
Expand Down Expand Up @@ -99,8 +89,8 @@ services:
volumes:
- elastic8_data_vol:/usr/share/elasticsearch/data
- elastic8_cert_vol:/usr/share/elasticsearch/config/certs/
env_file: .docker-compose.elastic8.env
environment:
- ELASTIC_PASSWORD=secretsecret
- node.name=singlenode
- cluster.initial_master_nodes=singlenode
- ES_JAVA_OPTS=-Xms512m -Xmx512m # raise memory limits a lil bit
Expand Down Expand Up @@ -183,7 +173,6 @@ services:
- postgres
- rabbitmq
- web
- elasticsearch
- elastic8
- indexer
volumes:
Expand All @@ -192,7 +181,6 @@ services:
- elastic8_cert_vol:/elastic8_certs
env_file:
- .docker-compose.env
- .docker-compose.elastic8.env
environment:
ELASTICSEARCH8_SECRET: ${ELASTIC_PASSWORD:-secretsecret}
ELASTICSEARCH8_CERT_PATH: /elastic8_certs/ca/ca.crt
Expand All @@ -206,7 +194,6 @@ services:
depends_on:
- postgres
- rabbitmq
- elasticsearch
- elastic8
- frontend
volumes:
Expand All @@ -215,7 +202,6 @@ services:
- elastic8_cert_vol:/elastic8_certs
env_file:
- .docker-compose.env
- .docker-compose.elastic8.env
environment:
ELASTICSEARCH8_SECRET: ${ELASTIC_PASSWORD:-secretsecret}
ELASTICSEARCH8_CERT_PATH: /elastic8_certs/ca/ca.crt
Expand All @@ -227,15 +213,13 @@ services:
depends_on:
- postgres
- rabbitmq
- elasticsearch
- elastic8
volumes:
- ./:/code:cached
- share_requirements_vol:/usr/local/lib/python3.11
- elastic8_cert_vol:/elastic8_certs
env_file:
- .docker-compose.env
- .docker-compose.elastic8.env
environment:
ELASTICSEARCH8_SECRET: ${ELASTIC_PASSWORD:-secretsecret}
ELASTICSEARCH8_CERT_PATH: /elastic8_certs/ca/ca.crt
Expand Down
4 changes: 2 additions & 2 deletions how-to/run-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ docker-compose up requirements
```

### 2. structured data
there are ~~two~~three services that store persistent data: `postgres`, `elasticsearch`, and `elastic8`
there are two services that store more-or-less persistent data: `postgres` and `elastic8`

let's start them from the host machine:
```
docker-compose up -d postgres elasticsearch elastic8
docker-compose up -d postgres elastic8
```

since we're not installing anything more on the host machine, it'll be useful to open
Expand Down
5 changes: 4 additions & 1 deletion project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ def split(string, delim):
'MAX_RETRIES': int(os.environ.get('ELASTICSEARCH_MAX_RETRIES', 7)),
'INDEX_STRATEGIES': {}, # populated below based on environment
}
ELASTICSEARCH5_URL = os.environ.get('ELASTICSEARCH_URL')
ELASTICSEARCH5_URL = (
os.environ.get('ELASTICSEARCH5_URL')
or os.environ.get('ELASTICSEARCH_URL')
)
if ELASTICSEARCH5_URL:
ELASTICSEARCH['INDEX_STRATEGIES']['sharev2_elastic5'] = {
'INDEX_STRATEGY_CLASS': 'share.search.index_strategy.sharev2_elastic5.Sharev2Elastic5IndexStrategy',
Expand Down

0 comments on commit 25bb9c9

Please sign in to comment.