|
2 | 2 |
|
3 | 3 | Using this image allows for the quick creation of any number of parallel systems hosting OpenSearchServer.
|
4 | 4 |
|
5 |
| - |
6 |
| -## Usage |
7 |
| - |
8 |
| -### Run a container |
9 |
| - |
10 |
| -`/path/to/local/folder` must be a directory, and must contain a directory named `opensearchserver/data`. **This is the directory that will be used by OpenSearchServer as its data folder**. |
11 |
| - |
12 |
| - docker run -d -P -v </path/to/local/folder>:/srv alexandretoyer/opensearchserver |
13 |
| - |
14 |
| -* parameter `-d` tells docker to daemonize this container (so it runs in the background) |
15 |
| -* parameter `-P` tells docker to map those ports exposed in the container |
16 |
| -* parameter `-v` is used to map a local folder to the `/srv` folder within the container |
17 |
| - |
18 |
| -#### Configure memory |
19 |
| - |
20 |
| -To determine how much memory OpenSearchServer can access, you can set the variable called `MEMORY`. |
21 |
| - |
22 |
| -Its value can be expressed using these three units - `k`, `m` or `g`. For instance: |
23 |
| - |
24 |
| - docker run -d -P -v </path/to/local/folder>:/srv -e MEMORY=4g alexandretoyer/opensearchserver |
25 |
| - |
26 |
| -### Get the port used by Docker |
27 |
| - |
28 |
| - docker ps -l |
29 |
| - |
30 |
| -Here is an output example for this: |
31 |
| - |
32 |
| - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
33 |
| - 3b49cb1c7fed alexandretoyer/opensearchserver:latest /bin/sh -c '/start_o 23 minutes ago Up 23 minutes 0.0.0.0:49185->9090/tcp backstabbing_mayer |
34 |
| - |
35 |
| -The value in the `PORTS` column is the port to use. In this example it's `49185`. |
36 |
| - |
37 |
| -#### Use a particular port |
38 |
| - |
39 |
| -Instead of using option `-P` one can use option `-p` with parameters `<public port>:<exposed port>`. For example: |
40 |
| - |
41 |
| - docker run -d -p 9091:9090 -v </path/to/local/folder>:/srv -e MEMORY=4g alexandretoyer/opensearchserver |
42 |
| - |
43 |
| -This would allow OpenSearchServer to be accessed with port 9091. |
44 |
| - |
45 |
| -### Give a specific name to the container |
46 |
| - |
47 |
| -A name can be given to the container with option `--name`. For example: |
48 |
| - |
49 |
| - docker run --name oss -d -P -v </path/to/local/folder>:/srv -e MEMORY=4g alexandretoyer/opensearchserver |
50 |
| - |
51 |
| -### Open a browser to access OpenSearchServer |
52 |
| - |
53 |
| -Browse to `127.0.0.1:<port used by docker>`. In the above example: `127.0.0.1:49185`. |
54 |
| - |
55 |
| - |
56 |
| -OpenSearchServer now runs within a Docker container: |
57 |
| - |
58 |
| - |
59 |
| - |
60 |
| - |
61 |
| -The data folder is stored on the host system. For instance, after having created an index named `test`: |
62 |
| - |
63 |
| - |
64 |
| - |
65 |
| -#### When using boot2docker |
66 |
| - |
67 |
| -Start by using the command `boot2docker ip` to know which IP address is used by boot2docker. Then use this IP address and the port used by Docker to access OpenSearchServer. For example - `192.168.59.103:49185`. |
68 |
| - |
69 |
| -### Managing OpenSearchServer within a running container |
70 |
| - |
71 |
| -It may be useful to manage an OpenSearchServer instance that is embedded within a running container. |
72 |
| - |
73 |
| -To do so use [jpetazzo/nsenter program](https://github.com/jpetazzo/nsenter). |
74 |
| - |
75 |
| -In this example (which uses _boot2docker_ on a Windows system), a container gets created and is then accessed to stop and restart OpenSearchServer: |
76 |
| - |
77 |
| - docker@boot2docker:~/DockerOSS$ docker run -P -d -v ~/DockerOSS/OSS1:/srv alexandretoyer/opensearchserver |
78 |
| - 3e9442f18a6abe12513e12ddd8206f1c2e3008912039202b0bd631f4923b78c0 |
79 |
| - |
80 |
| - docker@boot2docker:~/DockerOSS$ docker ps |
81 |
| - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
82 |
| - 3e9442f18a6a alexandretoyer/opensearchserver:latest /bin/sh -c '/start_o 3 seconds ago Up 2 seconds 0.0.0.0:49153->9090/tcp trusting_almeida |
83 |
| - |
84 |
| - docker@boot2docker:~/DockerOSS$ /var/lib/boot2docker/docker-enter trusting_almeida |
85 |
| - root@3e9442f18a6a:~# service opensearchserver stop |
86 |
| - Stopping OpenSearchServer ... |
87 |
| - OpenSearchServer stopped ... |
88 |
| - |
89 |
| - root@3e9442f18a6a:~# service opensearchserver start |
90 |
| - Starting OpenSearchServer ... |
91 |
| - OpenSearchServer started ... |
92 |
| - |
93 |
| - root@3e9442f18a6a:~# exit |
94 |
| - logout |
95 |
| - |
96 |
| - docker@boot2docker:~/DockerOSS$ |
97 |
| - |
98 |
| -## Creating several containers |
99 |
| -It is now possible to create multiple containers: |
100 |
| - |
101 |
| - mkdir -p OSS1/opensearchserver/data |
102 |
| - mkdir -p OSS2/opensearchserver/data |
103 |
| - docker run -d -P -v ~/DockerOSS/OSS1:/srv -e MEMORY=3g alexandretoyer/opensearchserver |
104 |
| - docker run -d -P -v ~/DockerOSS/OSS2:/srv -e MEMORY=1856m alexandretoyer/opensearchserver |
105 |
| - |
106 |
| -Here running `docker ps` will result in: |
107 |
| - |
108 |
| - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
109 |
| - 2f95109b18c8 alexandretoyer/opensearchserver:latest /bin/sh -c '/start_o 3 minutes ago Up 3 minutes 0.0.0.0:49165->9090/tcp backstabbing_morse |
110 |
| - b98be11e2d33 alexandretoyer/opensearchserver:latest /bin/sh -c '/start_o 5 minutes ago Up 5 minutes 0.0.0.0:49163->9090/tcp trusting_kowalevski |
111 |
| - |
112 |
| -These instances can be accessed by two separate browsers, and two different indexes can be created: |
113 |
| - |
114 |
| - |
115 |
| - |
116 |
| -Indexes are created within two different folders, like this: |
117 |
| - |
118 |
| - docker@boot2docker:~$ ls -l DockerOSS/OSS1/opensearchserver/data/ |
119 |
| - total 4 |
120 |
| - -rw-r--r-- 1 999 1 188 Oct 10 08:11 advanced.xml |
121 |
| - drwxr-xr-x 2 999 1 60 Oct 10 08:04 logs/ |
122 |
| - drwxr-xr-x 7 999 1 200 Oct 10 08:12 testOSS1/ |
123 |
| - docker@boot2docker:~$ ls -l DockerOSS/OSS2/opensearchserver/data/ |
124 |
| - total 4 |
125 |
| - -rw-r--r-- 1 999 1 188 Oct 10 08:10 advanced.xml |
126 |
| - drwxr-xr-x 2 999 1 60 Oct 10 08:09 logs/ |
127 |
| - drwxr-xr-x 7 999 1 200 Oct 10 08:12 testOSS2/ |
128 |
| - docker@boot2docker:~$ |
129 |
| - |
130 |
| ---- |
131 |
| - |
132 |
| - |
133 |
| -## FAQ |
134 |
| - |
135 |
| -#### When trying to create an index I get error `Exception inconnue: java.lang.NullPointerException.` |
136 |
| -* Try running the container with more memory (for example `-e MEMORY=2g`). |
137 |
| -* Check that directory `opensearchserver/data` (mapped to `/srv`) has succifient permission. |
138 |
| - |
139 |
| - |
140 |
| -#### When accessing OpenSearchServer's interface I see a red message saying `There is an issue with the data directory. Please check that the OPENSEARCHSERVER_DATA environment variable points to a valid directory.` |
141 |
| - |
142 |
| -* Check that container has been run with a correct mapping between a local folder and `/srv`. This local folder must contain a directory named `opensearchserver` and this `opensearchserver` directory must contain a directory named `data`. |
143 |
| -* Check that directory `opensearchserver/data` has succifient permission. |
144 |
| - |
145 |
| ---- |
146 |
| - |
147 |
| - |
148 |
| -## Build images |
149 |
| -### Clone repo |
150 |
| - |
151 |
| - git clone https://github.com/AlexandreToyer/opensearchserver-docker.git |
152 |
| - |
153 |
| -### Build images |
154 |
| - |
155 |
| -#### Image for Debian + OpenJDK |
156 |
| - |
157 |
| - docker build -t="alexandretoyer/debian-openjdk7jdk" ./debian-openjdk7jdk/ |
158 |
| - |
159 |
| -#### Image for OpenSearchServer |
160 |
| - |
161 |
| -Current Dockerfile will download and use **`opensearchserver-1.5.7-b767.deb`**. |
162 |
| - |
163 |
| - docker build -t="alexandretoyer/opensearchserver" ./opensearchserver/ |
| 5 | +Documentation can be found at the [OpenSearchServer documentation center](http://www.opensearchserver.com/documentation/installation/docker.md). |
0 commit comments