You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docker first look with openssl, mTLS and agent self registration (#158)
* corrected docker compose syntax. Folder is not specified this way anymore, and we don't actually need to specify it.
* made URL point to Ops Manager artifacts
* made URL point to Ops Manager artifacts
* improved description of GRPC_SERVER_SECURITY_CLIENT_AUTH
* updated to use openssl for certificate creation, mTLS and agent self-registration
* corrected values to be replaced
* typos
* typos
* made more compact without loosing information
* refer to docker first look guide for a concrete example to avoid duplication
* moved reference to the example to be a note in front of the steps
* updated to use 5.x Neo4j setting names
* Apply suggestions from code review
Co-authored-by: Jessica Wright <[email protected]>
* updated to use 5.x Neo4j setting names
---------
Co-authored-by: Jessica Wright <[email protected]>
Above Neo4j instance as a Docker compose service can be used with similar instances as part of single compose deployment in test and local environments.
54
+
Above Neo4j instance as a Docker compose service can be used with similar instances as part of single compose deployment in test and local environments.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/addition/docker/container.adoc
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
1
= Monitor instance in standalone Docker container
2
2
3
-
Running additional processes which are not tied to the lifecycle of container process is not a best practice for containerized applications. Nevertheless, it is possible transparently monitor a containerized Neo4j instance in following ways:
3
+
Running additional processes that are not tied to the lifecycle of the container process is not a best practice for containerized applications.
4
+
Nevertheless, it is possible to transparently monitor a containerized Neo4j instance in following ways:
4
5
5
6
[NOTE]
6
7
====
7
-
All methods below use a bundled NOM agent inside the Neo4j image instead of downloaded agent packages. Replacing `products/neo4j-ops-manager-agent-*-linux-amd64.tar.gz` with
8
-
path to NOM agent package downloaded should give the same results.
8
+
Both methods below use a bundled NOM agent inside the Neo4j image instead of downloaded agent packages.
9
+
Replacing `products/neo4j-ops-manager-agent-*-linux-amd64.tar.gz` with path to NOM agent package downloaded should give the same results.
9
10
====
10
11
11
-
. Monitoring a Neo4j instance Running inside a Docker container;
12
-
12
+
. Monitoring a Neo4j instance Running inside a Docker container:
Copy file name to clipboardExpand all lines: modules/ROOT/pages/addition/kubernetes/sidecar.adoc
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
= NOM agent as a Sidecar
2
2
3
-
A NOM agent can be deployed as a Sidecar container within the same pod as Neo4j instance in a Kubernetes cluster. Agent sidecar does not need to use a official agent image.
4
-
An agent can simply be run in a lightweight linux based container such as `alpine`. The agent binary can be either mounted into container or can be extracted from Neo4j image using an init container.
3
+
A NOM agent can be deployed as a Sidecar container within the same pod as Neo4j instance in a Kubernetes cluster.
4
+
The agent Sidecar does not need to use an official agent image.
5
+
An agent can simply be run in a lightweight Linux-based container such as `alpine`.
6
+
The agent binary can be either mounted into a container or can be extracted from the Neo4j image using an init container.
5
7
6
8
[WARNING]
7
9
====
8
-
An agent Sidecar container cannot access all resources that Neo4j pod uses and the host-metrics of the cluster node.
9
-
For example, for disk usage metrics, the agent needs access to the file system or persistent volumes that Neo4j pod uses.
10
-
These need to be mounted to the agent Daemon pod.
11
-
The agent Sidecar can only report host metrics of its own contained environment which is not a complete view of resource usage of the cluster node.
10
+
An agent Sidecar container cannot access all resources that the Neo4j pod uses and the host-metrics of the cluster node.
11
+
For example, for disk usage metrics, the agent needs access to the file system or persistent volumes that the Neo4j pod uses.
12
+
These need to be mounted to the agent Daemon pod.
13
+
The agent Sidecar can only report host metrics of its own contained environment which is not a complete view of the resource usage of the cluster node.
12
14
====
13
15
14
16
Following is a sample `values.yaml` file for Neo4j Helm charts with NOM agent sidecar configured:
Copy file name to clipboardExpand all lines: modules/ROOT/pages/first-look/docker-first-look.adoc
+97-69Lines changed: 97 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,45 +6,55 @@ Docker compose can be used to provision a set of related containers as services
6
6
7
7
Docker does not recommend using compose for production.
8
8
9
-
The manual installation, configuring and running of agents on the Neo4j containers is lost if the container is stopped.
10
-
11
9
== Prerequisites
12
10
* Unix-based operating system
13
11
* Docker
14
12
* Docker compose
15
13
16
14
== Prepare hosts file
17
15
18
-
You need to set up the following host names in your `/etc/hosts` or `C:/windows/system32/drivers/etc/hosts file`;
16
+
You need to set up the following host names in your `/etc/hosts` file:
19
17
[source,, role=noheader]
20
18
----
21
19
127.0.0.1 storage server db-single
22
20
----
23
21
24
-
== Create persistence DBMS and NOM server
25
-
26
-
=== Generate self-signed certificates
22
+
== Generate self-signed certificates
27
23
28
24
. Create a directory *`~/.nom/ssc`* on your local machine before running Docker compose.
29
-
The compose files below specify that this directory will be mounted into the docker container to make the generated certificates available to the NOM server and the agent.
25
+
The compose files below specify that this directory will be mounted into the Docker container to make the generated certificates available to the NOM server and the agent.
26
+
. Change to *`~/.nom/ssc`* and generate self-signed certificates using `server` as common name (CN) and DNS name, and `127.0.0.1` as IP address (details see *xref:installation/self-signed-certificate.adoc[here]*):
This results in the creation of `server.cer`, `server.key` and `server.pfx`.
46
+
. Use the password applied for the certificate store (`changeit`) instead of `<SSC_PASSWORD>` in the next sections.
47
+
31
48
[NOTE]
32
49
====
33
-
For *`sudo`* docker compose command, make sure the correct path to *`.nom/ssc`* is set in the bind section below.
50
+
To keep this example simple, the generated certificates are used for both NOM server and agents.
34
51
====
35
-
. Change to *`~/.nom/ssc`* and generate self-signed certificates as described *xref:installation/self-signed-certificate.adoc[here]*, using `server` as common name (CN) and DNS name, and `127.0.0.1` as IP address.
36
-
This results in the creation of `server.cer` and `server.pfx`.
37
-
. Use the password applied for the certificate store instead of `<SSC_PASSWORD>` in the next sections.
38
-
39
-
=== Copy docker compose file
40
52
41
-
Following is a docker compose file that can be used to start up a NOM server and Enerprise Neo4j Persistence system without any customization.
42
-
Copy this to your local machine as `docker-compose.yaml`.
53
+
== Create the Docker compose file
43
54
44
-
Edit the yaml as follows:
45
-
46
-
* replace all three occurrences of <PERSISTENCE_PASSWORD> with a secure password.
47
-
* replace all three occurrences of <SSC_PASSWORD> with a secure password.
55
+
Following is a Docker compose file that can be used to start up a NOM server including its persistence and a single Neo4j Enterprise instance that will be managed by NOM.
56
+
Create the file `docker-compose.yaml` in an empty directory on your local machine.
57
+
This directory is referenced as `INSTALLATION_ROOT` later in this document.
Documentation for NOM server docker image is *xref:installation/docker/container.adoc[here]*.
107
-
108
-
=== Run docker compose
109
-
Run the follwing command:
110
-
111
-
[source, shell]
112
-
----
113
-
docker compose -f docker-compose.yaml up <folder for context, typically current folder>
114
-
----
115
-
116
-
=== Open NOM UI
117
-
Wait for the server container to start and then go to https://server:8080.
118
-
Login as admin:passw0rd and accept license terms.
119
-
120
-
== Set up instance and agent
121
-
122
-
=== Register agent
123
-
In NOM UI - navigate to Agent settings (clicking on the sad robot takes you to the correct page) and add a new agent.
124
-
Copy environment variables that are provided.
125
-
126
-
Full documentation on registering an agent is *xref:addition/index.adoc#register[here]*.
127
-
128
-
=== Create docker compose file for Neo4j instance (pre-configured for agent)
129
-
130
-
Copy compose file below into `docker-compose.instance.yaml` and edit as follows:
131
-
132
-
* Replace `<CONFIG_TOKEN_CLIENT_ID from register agent step>` and `<CONFIG_TOKEN_CLIENT_SECRET from register agent step>` with the values shown during the reigister agent step in the NOM UI.
133
-
* Replace all three occurrences of <NEO4J_INSTANCE_PASSWORD> with a secure password.
Documentation for NOM server Docker image is *xref:installation/docker/container.adoc[here]*.
164
+
165
+
Edit `docker-compose.yaml` as follows:
166
+
167
+
* Replace all occurrences of `<SSC_PASSWORD>` with the certificate store password applied above.
168
+
* Replace all occurrences of `<PERSISTENCE_PASSWORD>` with a secure password.
169
+
* Replace all occurrences of `<NEO4J_INSTANCE_PASSWORD>` with a secure password.
170
+
171
+
== Start the Docker compose environment
172
+
Run the following command in your `INSTALLATION_ROOT`:
185
173
186
174
[source, shell]
187
175
----
188
-
docker compose -f docker-compose.instance.yaml up <folder for context, typically current folder>
176
+
docker compose -f docker-compose.yaml up
189
177
----
190
178
191
-
=== Run agent
179
+
Watch the output and make sure that the Docker containers `storage`, `server` and `db-single` are started successfully.
192
180
181
+
== Download and start the NOM agent
182
+
183
+
* Download NOM agent binaries TAR from https://neo4j.com/download-center/#ops-manager[here] and execute the following commands in your `INSTALLATION_ROOT`:
184
+
+
193
185
[source, shell]
194
186
----
195
-
docker compose -f docker-compose.instance.yaml exec sh -c tar -xvf products/neo4j-ops-manager-agent-*-linux-amd64.tar.gz && neo4j-ops-manager-agent-*/bin/agent console
187
+
mkdir agent
188
+
tar -xvf <DOWNLOADED_AGENT_BINARIES_TAR> -C agent --strip-components=1
189
+
----
190
+
* In `INSTALLATION_ROOT`, start the agent in self-registration mode:
Full documentation on registering an agent is *xref:addition/agent-installation/index.adoc[here]*.
198
+
198
199
== Explore NOM UI
199
-
Go to NOM UI and wait for DBMS to appear - this may take a few minutes.
200
-
You should be able to see that the agent has connected in the agents listing.
200
+
201
+
* Wait for the server container to start and then go to https://server:8080.
202
+
* Login as `admin` / `passw0rd` and accept license terms.
203
+
* Click the top right settings icon that redirects you to the global settings.
204
+
* Make sure that the agent is online.
205
+
Rename the agent if required.
206
+
* Return to the main page and wait for DBMS to appear - this may take a few minutes.
201
207
Once the DBMS is shown in the home page, double-click on the name (initially a generated string) to edit it.
202
208
Double-click on the DBMS to see the metrics, status, security panel, logs and upgrade pages for the DBMS.
209
+
210
+
== Controlling Docker containers
211
+
212
+
=== Stopping
213
+
214
+
* To stop the complete NOM environment, press `Ctrl-C` on the Docker compose console and the agent console.
215
+
* To stop a single Docker container, issue `docker container stop <CONTAINER_NAME>`.
216
+
To list containers use `docker ps`.
217
+
218
+
[NOTE]
219
+
====
220
+
Since Docker keeps persisted data in container volumes, restarted containers will keep the previous state.
221
+
====
222
+
223
+
=== Resetting
224
+
225
+
To start over with an empty Neo4j persistence and empty managed instance, use the following Docker command (use `docker ps -a` to find out actual container names):
0 commit comments