Skip to content

Commit 3ca83f8

Browse files
authored
simplify docker-compose.yml (opensearch-project#763)
* simplify docker-compose.yml Signed-off-by: YANGDB <[email protected]> * update docs regarding security Signed-off-by: YANGDB <[email protected]> * update docs security doc and restrictions Signed-off-by: YANGDB <[email protected]> --------- Signed-off-by: YANGDB <[email protected]>
1 parent f9f1579 commit 3ca83f8

File tree

3 files changed

+35
-52
lines changed

3 files changed

+35
-52
lines changed

.env

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# version for opensearch & opensearch-dashboards docker image
2-
VERSION=2.6.0
3-
# auth details - change according to your system
4-
USER=admin
5-
PASSWORD=admin
2+
VERSION=2.9.0
3+

Using-Docker.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ First the plugin must be build using the `yarn build` command.
66

77
Once this build was completed - the expected zip location of the plugin is `./build/observabilityDashboards-?.?.?.zip` where as the `?.?.?` represents the version of this dashboard plugin.
88

9-
> Note that the plugin version must correspond to the OpenSearch-Dashboards version - this information appears [here](opensearch_dashboards.json)
9+
> Note: that the plugin version must correspond to the OpenSearch-Dashboards version - this information appears [here](opensearch_dashboards.json)
1010
>
1111
1212
Once the build is completed, make sure to overide the [Dockerfile](Dockerfile) target zip file with the exact name
@@ -16,17 +16,22 @@ RUN /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin install fi
1616
```
1717

1818
## Docker imageVersion
19-
The docker images used by this file are all referencing the [.env](.env) environment file that contains the version and user/password fields that need to be changed to match your own system.
19+
The docker images used by this file are all referencing the [.env](.env) environment file that contains the version that needed to be changed to match your own system.
2020

2121
## Run the docker image build
2222
To build the docker image use the next command:
2323
> `docker build --build-arg VERSION=$(grep VERSION .env | cut -d '=' -f2) -t your_image_name .`
2424
2525
## Run the docker compose
2626
The [docker-compose](docker-compose.yml) file represents a simple assembly of an OpenSearch cluster with two nodes and an opensearch dashboard that has the updated image with the latest changes in this plugin.
27+
> This is a test only docker compose that should not be used for production purpose - for such use cases please review this [link](https://opensearch.org/docs/latest/install-and-configure/install-opensearch/docker/)
2728
29+
### Option 1 (All from docker)
2830
run `docker compose up -d` to start the services and once the service is up and running you can start testing the changes.
2931

32+
### Option 2 (Combined Docker & Dashboard)
33+
run `docker compose up -d opensearch` to only run the OpenSearch engine - in this case the dashboard has to be run manualy using `yarn start --no-base-path` command in the root dashboards path `./OpenSearch-Dashboards/`
34+
3035
> Note that the OpenSearch version also must correspond to the OpenSearch-Dashboards version
3136
3237
## Accessing the Dashboard
@@ -37,5 +42,6 @@ The dashboard service uses port `localhost:5601` for access and this was already
3742
```
3843
3944
## Security Notice
40-
The default User:Password for this demo test is embedded within the [.env](.env) environment file - pay attention not to use this configuration in a production or any environment that may contain
41-
confident or personal information without first changing the security definition for accessing the servers.
45+
There is no security plugin and authentication definitions for this development test demo - pay attention not to use this configuration in a production or any environment that may contain
46+
confident or personal information without first changing the security definition for accessing the servers - for production use cases please review this [link](https://opensearch.org/docs/latest/install-and-configure/install-opensearch/docker/)
47+

docker-compose.yml

+23-44
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
3-
4-
53
version: '3.9'
64
x-default-logging: &logging
75
driver: "json-file"
@@ -10,64 +8,46 @@ x-default-logging: &logging
108
max-file: "2"
119

1210
volumes:
13-
opensearch-data1:
14-
opensearch-data2:
11+
opensearch-data:
1512

1613
networks:
1714
default:
1815
name: opensearch-dashboards-demo
1916
driver: bridge
2017

2118
services:
22-
# OpenSearch store - node1
23-
opensearch-node1: # This is also the hostname of the container within the Docker network (i.e. https://opensearch-node1/)
24-
image: opensearchproject/opensearch:${VERSION} # Specifying the latest available image - modify if you want a specific version
25-
container_name: opensearch-node1
26-
environment:
27-
- cluster.name=opensearch-cluster # Name the cluster
28-
- node.name=opensearch-node1 # Name the node that will run in this container
29-
- discovery.seed_hosts=opensearch-node1,opensearch-node2 # Nodes to look for when discovering the cluster
30-
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2 # Nodes eligible to serve as cluster manager
31-
- bootstrap.memory_lock=true # Disable JVM heap memory swapping
32-
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM
33-
ulimits:
34-
memlock:
35-
soft: -1 # Set memlock to unlimited (no soft or hard limit)
36-
hard: -1
37-
nofile:
38-
soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
39-
hard: 65536
40-
volumes:
41-
- opensearch-data1:/usr/share/opensearch/data # Creates volume called opensearch-data1 and mounts it to the container
42-
healthcheck:
43-
test: ["CMD", "curl", "-f", "https://opensearch-node1:9200/_cluster/health?wait_for_status=yellow", "-ku ${USER}:${PASSWORD}"]
44-
interval: 5s
45-
timeout: 25s
46-
retries: 4
47-
ports:
48-
- "9200:9200"
49-
- "9600:9600"
50-
51-
# OpenSearch store - node2
52-
opensearch-node2:
53-
image: opensearchproject/opensearch:${VERSION} # This should be the same image used for opensearch-node1 to avoid issues
54-
container_name: opensearch-node2
19+
# OpenSearch store - node (not for production - no security - only for test purpose )
20+
opensearch:
21+
image: opensearchstaging/opensearch:${VERSION}
22+
container_name: opensearch
5523
environment:
5624
- cluster.name=opensearch-cluster
57-
- node.name=opensearch-node2
58-
- discovery.seed_hosts=opensearch-node1,opensearch-node2
59-
- cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2
25+
- node.name=opensearch
26+
- discovery.seed_hosts=opensearch
27+
- cluster.initial_cluster_manager_nodes=opensearch
6028
- bootstrap.memory_lock=true
6129
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
30+
- "DISABLE_INSTALL_DEMO_CONFIG=true"
31+
- "DISABLE_SECURITY_PLUGIN=true"
6232
ulimits:
6333
memlock:
6434
soft: -1
6535
hard: -1
6636
nofile:
67-
soft: 65536
37+
soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536
6838
hard: 65536
6939
volumes:
70-
- opensearch-data2:/usr/share/opensearch/data
40+
- opensearch-data:/usr/share/opensearch/data # Creates volume called opensearch-data1 and mounts it to the container
41+
ports:
42+
- 9200:9200
43+
- 9600:9600
44+
expose:
45+
- "9200"
46+
healthcheck:
47+
test: ["CMD", "curl", "-f", "http://localhost:9200/_cluster/health?wait_for_status=yellow"]
48+
interval: 20s
49+
timeout: 10s
50+
retries: 10
7151

7252
# OpenSearch store - dashboard
7353
opensearch-dashboards:
@@ -85,6 +65,5 @@ services:
8565
environment:
8666
OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
8767
depends_on:
88-
- opensearch-node1
89-
- opensearch-node2
68+
- opensearch
9069

0 commit comments

Comments
 (0)