summaryrefslogtreecommitdiff
path: root/docker/README.md
blob: 8a63637b3a11d228214f8d4060c78c1c697f2e52 (plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Yacy Docker image from latest sources

## Supported tags

* `latest` (Latest stable release)
* `latest-alpine` (Latest stable release based on Alpine Linux)
* `<version>` (Lock on a specific/minor/major version, e.g., `1.2.3`, `1.2`, `1`)
* `<version>-alpine` (e.g., `1.2.3-alpine`)
* `<branch-name>` (e.g., `master` for the latest commit of branches)
* `pr-<number>` (e.g., `pr-42` for pull requests)

For a detailed explanation of supported tags, refer to [DockerImageTags.md](./DockerImageTags.md).

## Getting built image from Docker Hub and GitHub Container Registry

The repository URLs are:

* Docker Hub: <https://hub.docker.com/r/yacy/yacy_search_server/>
* GitHub Container Registry: `ghcr.io/yacy/yacy_search_server`

Examples:

* `docker pull yacy/yacy_search_server:latest`
* `docker pull ghcr.io/yacy/yacy_search_server:latest`
* `docker pull ghcr.io/yacy/yacy_search_server:latest-alpine`
* `docker pull ghcr.io/yacy/yacy_search_server:1.2.3`
* `docker pull ghcr.io/yacy/yacy_search_server:master`
* `docker pull ghcr.io/yacy/yacy_search_server:pr-42`

## Building image yourself

Using files in 'yacy_search_server/docker/':

```sh
cd yacy_search_server/docker
```

Then according to the image type:

* `yacy/yacy_search_server:latest`: This image is based on the latest stable official [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release. It includes YaCy compiled from the latest git repository sources.
* `yacy/yacy_search_server:latest-alpine`: This image is based on the latest stable [Eclipse Temurin](https://hub.docker.com/_/eclipse-temurin) 21 release with Alpine Linux as the base. It also includes YaCy compiled from the latest git repository sources.

```sh
docker build -t yacy/yacy_search_server:latest -f Dockerfile ../
```

## Usage

### Run the Docker image directly

You can run the YaCy Docker image directly using the following command:

```sh
docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest
```

### Using Docker Compose

You can also use Docker Compose to run the YaCy container. Create a `docker-compose.yml` file with the following content:

```yaml
services:
    yacy:
        container_name: yacy
        image: yacy/yacy_search_server:latest
        restart: unless-stopped
        ports:
            - "8090:8090"
            - "8443:8443"
        volumes:
            - yacy_data:/opt/yacy_search_server/DATA
        logging:
            options:
                max-size: "200m"
                max-file: "2"

volumes:
    yacy_data:
```

Then start the container with:

```sh
docker-compose up -d
```

YaCy web interface is then exposed at `http://[container_ip]:8090`  
You can retrieve the container IP address with `docker inspect`.

### Default admin account

* login: admin
* password: yacy

You should modify this default password with page /ConfigAccounts_p.html when exposing publicly your YaCy container.

### Handle persistent data volume

As configured in the Dockerfile, by default YaCy data (in /opt/yacy_search_server/DATA) will persist after container stop or deletion, in a volume named "yacy_data".

### HTTPS support

This images are default configured with HTTPS enabled, and use a default certificate stored in defaults/freeworldKeystore. You should use your own certificate. In order to do it, you can proceed as follow.

#### Self-signed certificate

A self-signed certificate will provide encrypted communications with your YaCy server, but browsers will still complain about an invalid security certificate with the error "SEC_ERROR_UNKNOWN_ISSUER". If it is sufficient for you, you can permanently add an exception to your browser.

This kind of certificate can be generated and added to your YaCy Docker container with the following:

```sh
keytool -keystore /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacykeystore -genkey -keyalg RSA -alias yacycert
```

Then edit YaCy config file. For example, with the nano text editor:

```sh
nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf
```

And configure the keyStoreXXXX properties accordingly:

```sh
keyStore=/opt/yacy_search_server/DATA/SETTINGS/yacykeystore
keyStorePassword=yourpassword
```

#### Import an existing certificate

Importing a certificate validated by a certification authority (CA) will ensure you have full HTTPS support with no security errors when accessing your YaCy peer. You can import an existing certificate in pkcs12 format.

First copy it to the YaCy Docker container volume:

```sh
cp [yourStore].pkcs12 /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/[yourStore].pkcs12
```

Then edit YaCy config file. For example, with the nano text editor:

```sh
nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf
```

And configure the pkcs12XXX properties accordingly:

```sh
pkcs12ImportFile=/opt/yacy_search_server/DATA/SETTINGS/[yourStore].pkcs12
pkcs12ImportPwd=yourpassword
```

### Next starts

#### As attached process

```sh
docker start -a yacy
```

#### As background process

```sh
docker start yacy
```

### Shutdown

* Use "Shutdown" button in administration web interface
* OR run:

```sh
docker exec yacy /opt/yacy_search_server/stopYACY.sh
```

* OR run:

```sh
docker stop yacy
```

### Upgrade

To upgrade your YaCy container, follow these steps:

1. Pull the latest Docker image:

    ```sh
    docker pull yacy/yacy_search_server:latest
    ```

2. Stop and remove the old container:

    ```sh
    docker stop yacy
    docker rm yacy
    ```

3. Run the new container using the same command as before:

    ```sh
    docker run -d --name yacy -p 8090:8090 -p 8443:8443 -v yacy_data:/opt/yacy_search_server/DATA --log-opt max-size=200m --log-opt max-file=2 yacy/yacy_search_server:latest
    ```

#### Update Docker Compose Images

To update the images created with the Docker Compose file, you can use the following command:

```sh
docker-compose up -d --force-recreate --pull always
```

This command ensures that the latest images are pulled and the containers are recreated with the updated images.

## License

View [license](https://github.com/yacy/yacy_search_server/blob/master/COPYRIGHT) information for the software contained in this image.