Skip to content

Commit 19fd7ee

Browse files
author
Thomas Loubrieu
committed
Merge branch 'develop' of https://github.com/NASA-PDS/registry into develop
2 parents 88e7aad + 4faf4ff commit 19fd7ee

4 files changed

Lines changed: 93 additions & 118 deletions

File tree

docker/docker-compose.yml

Lines changed: 83 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,56 @@
3131
version: "3.9"
3232

3333
services:
34+
# Starts Elasticsearch
35+
elasticsearch:
36+
profiles: ["dev-api", "dev-loader", "pds-core-registry", "int-registry-batch-loader", "os"]
37+
image: ${ES_IMAGE}
38+
ulimits:
39+
nofile:
40+
soft: 65536
41+
hard: 65536
42+
hostname: elasticsearch
43+
container_name: elasticsearch
44+
environment:
45+
- discovery.type=${ES_DISCOVERY_TYPE}
46+
- _JAVA_OPTIONS=-XX:-UseContainerSupport
47+
# Uncomment the following environment variable to use OpenSearch without security
48+
# - plugins.security.disabled=true
49+
volumes:
50+
- ./certs/node1.pem:/usr/share/opensearch/config/esnode.pem
51+
- ./certs/node1-key.pem:/usr/share/opensearch/config/esnode-key.pem
52+
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem
53+
- ./default-config/opensearch.yml:/usr/share/opensearch/config/opensearch.yml
54+
ports:
55+
- "9200:9200"
56+
- "9600:9600" # required for Performance Analyzer
57+
healthcheck:
58+
test:
59+
- CMD-SHELL
60+
- curl --insecure -f https://elasticsearch:9200/_cluster/health -u admin:admin
61+
interval: 10s
62+
timeout: 2s
63+
retries: 50
64+
networks:
65+
- pds
3466

35-
# Executes the Registry Loader component, which contains Harvest and Registry Manager
36-
registry-loader:
37-
profiles: ["pds-batch-loader"]
67+
# Initializes Elasticsearch by creating registry and data dictionary indices by utilizing the Registry Loader
68+
elasticsearch-init:
69+
profiles: ["dev-api", "pds-core-registry", "int-registry-batch-loader"]
3870
image: ${REG_LOADER_IMAGE}
3971
environment:
4072
- ES_URL=${ES_URL}
4173
volumes:
42-
- ${HARVEST_JOB_CONFIG_FILE}:/cfg/harvest-config.xml
43-
- ${REG_DATA_VOLUME}:${CONTAINER_HARVEST_data-volume}
74+
- ./scripts/elasticsearch-init.sh:/usr/local/bin/elasticsearch-init.sh
75+
- ./scripts/aliases:/usr/local/bin/aliases
4476
- ./default-config/es-auth.cfg:/etc/es-auth.cfg
45-
- ./default-config/local-registry.xml:/etc/local-registry.xml
77+
- ./default-config/local_registry.xml:/etc/local_registry.xml
4678
networks:
4779
- pds
80+
entrypoint: ["bash", "/usr/local/bin/elasticsearch-init.sh"]
81+
depends_on:
82+
elasticsearch:
83+
condition: service_healthy
4884

4985
# Downloads and harvests test data with the Registry loader
5086
registry-loader-test-init:
@@ -57,12 +93,13 @@ services:
5793
- TEST_DATA_LIDVID=${TEST_DATA_LIDVID}
5894
volumes:
5995
- ${REG_DATA_VOLUME}:${CONTAINER_HARVEST_DATA_DIR}
60-
- ./scripts/registry-loader-waits-for-elasticsearch.sh:/usr/local/bin/registry-loader-waits-for-elasticsearch.sh
6196
- ./default-config/es-auth.cfg:/etc/es-auth.cfg
6297
- ./custom-datasets.tar.gz:/etc/custom-datasets.tar.gz
6398
networks:
6499
- pds
65-
entrypoint: /usr/local/bin/registry-loader-waits-for-elasticsearch.sh
100+
depends_on:
101+
elasticsearch-init:
102+
condition: service_completed_successfully
66103

67104
# Runs provenance script
68105
registry-sweepers:
@@ -81,43 +118,7 @@ services:
81118
registry-loader-test-init:
82119
condition: service_completed_successfully
83120

84-
# Starts Elasticsearch
85-
elasticsearch:
86-
profiles: ["dev-api", "dev-loader", "pds-core-registry", "int-registry-batch-loader", "os"]
87-
image: ${ES_IMAGE}
88-
ulimits:
89-
nofile:
90-
soft: 65536
91-
hard: 65536
92-
environment:
93-
- discovery.type=${ES_DISCOVERY_TYPE}
94-
# Uncomment the following environment variable to use OpenSearch without security
95-
# - plugins.security.disabled=true
96-
volumes:
97-
- ./certs/node1.pem:/usr/share/opensearch/config/esnode.pem
98-
- ./certs/node1-key.pem:/usr/share/opensearch/config/esnode-key.pem
99-
- ./certs/root-ca.pem:/usr/share/opensearch/config/root-ca.pem
100-
- ./default-config/opensearch.yml:/usr/share/opensearch/config/opensearch.yml
101-
ports:
102-
- "9200:9200"
103-
- "9600:9600" # required for Performance Analyzer
104-
networks:
105-
- pds
106121

107-
# Initializes Elasticsearch by creating registry and data dictionary indices by utilizing the Registry Loader
108-
elasticsearch-init:
109-
profiles: ["dev-api", "pds-core-registry", "int-registry-batch-loader"]
110-
image: ${REG_LOADER_IMAGE}
111-
environment:
112-
- ES_URL=${ES_URL}
113-
volumes:
114-
- ./scripts/elasticsearch-init.sh:/usr/local/bin/elasticsearch-init.sh
115-
- ./scripts/aliases:/usr/local/bin/aliases
116-
- ./default-config/es-auth.cfg:/etc/es-auth.cfg
117-
- ./default-config/local_registry.xml:/etc/local_registry.xml
118-
networks:
119-
- pds
120-
entrypoint: ["bash", "/usr/local/bin/elasticsearch-init.sh"]
121122

122123
# Starts the Registry API
123124
registry-api:
@@ -131,10 +132,24 @@ services:
131132
volumes:
132133
# make volume match how the spring-boot plugin deploys in docker
133134
- ${REG_API_APP_PROPERTIES_FILE}:/workspace/BOOT-INF/classes/application.properties
134-
- ./scripts/registry-api-waits-for-elasticsearch.sh:/usr/local/registry-api-service/registry-api-waits-for-elasticsearch.sh
135+
- ./scripts/registry-api.sh:/usr/local/registry-api-service/registry-api.sh
135136
networks:
136137
- pds
137-
command: /usr/local/registry-api-service/registry-api-waits-for-elasticsearch.sh
138+
command: /usr/local/registry-api-service/registry-api.sh
139+
healthcheck:
140+
test:
141+
- CMD
142+
- curl
143+
- -f
144+
- http://localhost:8080/health
145+
interval: 10s
146+
timeout: 2s
147+
retries: 50
148+
depends_on:
149+
registry-sweepers:
150+
condition: service_completed_successfully
151+
152+
138153

139154
# Executes an nginx service to expose the PDS4 archive
140155
registry-web-archive:
@@ -147,6 +162,9 @@ services:
147162
- ${REG_DATA_VOLUME}:/usr/share/nginx/html/archive
148163
networks:
149164
- pds
165+
depends_on:
166+
registry-loader-test-init:
167+
condition: service_completed_successfully
150168

151169
# Executes Registry API integration test as a Postman collection with test data
152170
reg-api-integration-test:
@@ -206,13 +224,31 @@ services:
206224
profiles: ["pds-core-registry", "int-registry-batch-loader", "int-registry-service-loader"]
207225
image: ${PROXYCRYPT_IMAGE}
208226
environment:
209-
- PROXY_URL=https://registry-api:8080/
227+
- PROXY_URL=https://${COMPOSE_PROJECT_NAME}-registry-api-1:8080/
210228
- PROXY_PATH=/api/search/1/
211229
- PROXY_PORT=443
212230
ports:
213231
- "443:443"
214232
networks:
215233
- pds
234+
depends_on:
235+
registry-api:
236+
condition: service_healthy
237+
238+
239+
# Executes the Registry Loader component, which contains Harvest and Registry Manager
240+
registry-loader:
241+
profiles: ["pds-batch-loader"]
242+
image: ${REG_LOADER_IMAGE}
243+
environment:
244+
- ES_URL=${ES_URL}
245+
volumes:
246+
- ${HARVEST_JOB_CONFIG_FILE}:/cfg/harvest-config.xml
247+
- ${REG_DATA_VOLUME}:${CONTAINER_HARVEST_data-volume}
248+
- ./default-config/es-auth.cfg:/etc/es-auth.cfg
249+
- ./default-config/local-registry.xml:/etc/local-registry.xml
250+
networks:
251+
- pds
216252

217253
volumes:
218254
data-volume:

docker/scripts/elasticsearch-init.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ if [ -z "$ES_URL" ]; then
4040
exit 1
4141
fi
4242

43-
echo "Waiting for Elasticsearch to launch..." 1>&2
44-
# TODO Warning: Use the default username and password only for testing purposes in local setup
45-
while ! curl --output /dev/null --silent --head --fail "$ES_URL" -u 'admin:admin' --insecure; do
46-
sleep 1
47-
done
48-
4943
echo "Creating registry and data dictionary indices..." 1>&2
5044
registry-manager create-registry -registry file:///etc/local_registry.xml -auth /etc/es-auth.cfg
5145

docker/scripts/registry-api-waits-for-elasticsearch.sh renamed to docker/scripts/registry-api.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@
3535
# ------------------------------------------------------------------------------------------------
3636

3737
# Check if the ES_URL environment variable is set
38-
if [ -z "$ES_URL" ]; then
39-
echo "Error: 'ES_URL' (Elasticsearch URL) environment variable is not set. Use docker's -e option." 1>&2
40-
exit 1
41-
fi
38+
#if [ -z "$ES_URL" ]; then
39+
# echo "Error: 'ES_URL' (Elasticsearch URL) environment variable is not set. Use docker's -e option." 1>&2
40+
# exit 1
41+
#fi
4242

4343
echo "Waiting for Elasticsearch to launch..." 1>&2
4444
# TODO Warning: Use the default username and password only for testing purposes in local setup
45-
while ! curl --output /dev/null --silent --head --fail "$ES_URL" -u 'admin:admin' --insecure; do
46-
echo "waiting for elasticsearch" 1>&2
47-
sleep 1
48-
done
45+
#while ! curl --output /dev/null --silent --head --fail "$ES_URL" -u 'admin:admin' --insecure; do
46+
# echo "waiting for elasticsearch" 1>&2
47+
# sleep 1
48+
#done
4949

50-
echo "Waiting for the creation of registry and data dictionary indices..." 1>&2
51-
sleep 60
50+
#echo "Waiting for the creation of registry and data dictionary indices..." 1>&2
51+
#sleep 60
5252

5353
echo "Starting Registry API service..." 1>&2
5454
java -cp /usr/local/registry-api-service \

docker/scripts/registry-loader-waits-for-elasticsearch.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)