aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/README.md
blob: b727dde7bb84f196ee8abc16fc23c05667f3466f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Node Admin

## Setup

Set up Docker on your machine according to the instructions in README_LINUX or README_MAC, depending on your hardware.

You should have the docker daemon running and the following environment variables set:
```
DOCKER_HOST
CONTAINER_CERT_PATH
```

## Building

Build Node Admin and include it (and other local modifications) in the Docker image ```vespa-local```:
```
mvn clean package
./build.sh
```

## Running

TODO: Outdated! Update this section with info on how to run everything locally.

Start the container for the config server (TODO). Set the CONFIG_SERVER_ADDRESS
variable to the hostname of the config server.

Start the container
```
docker run -t -i --privileged \
        -p 4080:4080 \
        -v $CONTAINER_CERT_PATH:/host/docker/certs \
        -e "DOCKER_HOST=$DOCKER_HOST" \
        -e "CONFIG_SERVER_ADDRESS=$CONFIG_SERVER_ADDRESS" \
        vespa-local:latest
```

This will map the client certificate/key files to the path where Node Admin looks for them (as configured in
services.xml), and enable Node Admin to talk to the docker daemon. You can invoke Node Admin's REST APIs on port 4080
from both inside the container and the outside host.

## Using

Trigger the incredibly rich and complex node-admin REST API(s)
```
curl localhost:4080/test/ping
```

## Troubleshooting

If the container doesn't start, it can be helpful to look at the jdisc log. First, find the container id:
```
docker ps -a
```

Then, find the log files:
```
docker diff <container id>| grep $VESPA_HOME/logs
```

View the log file (`-L` follows the symbolic link):
```
docker cp -L <container id>:$VESPA_HOME/logs/jdisc_core/jdisc_core.log - | less
```

## Developing

We will describe how you can build a Docker image for Vespa which will be used
to set up a local Docker container with the Node Admin, and a local container
with the Config Server.

Then, we'll show how you bring up this local zone. And finally, how you can
deploy a local Vespa application to this zone.

### Building Local Docker Image

A Dockerfile exists in the module's root directory. This Dockerfile is not used
in production or any pipelines, it is here for convenience so you can build
images and experiment locally. See build.sh for how to build.

The image created by the Dockerfile will be used to run Node Admin or a Config
Server.

### Starting a Local Zone

To start a local zone, ensure your operating system ignores ```config-server```
and ```node-admin``` for proxying. Then issue the following command:

```
scripts/zone.sh start
```

The Node Admin and Config Server now runs in the ```node-admin``` and
```config-server``` Docker containers. These containers have their own IP
addresses and hostnames (also ```node-admin``` and ```config-server```).

### Deploying a Local Application

To deploy an application, use ```scripts/app.sh```. Assuming you have checked
out ```vespa/basic-search-for-docker``` to ```~```, and packaged it with ```mvn
package```, you can deploy the application with:

```
scripts/app.sh deploy ~/vespa/basic-search-for-docker/target/application
```

You can undeploy it with

```
scripts/app.sh undeploy
```