mirror of
https://github.com/yacy/yacy_search_server.git
synced 2026-10-25 05:54:15 +00:00
Merge pull request #698 from MisterX2000/master
Automate Docker Build Process with Multiarch Support (and GitHub Release action)
This commit is contained in:
8 files changed
+471
-264
No files matched your search
+2
-1
@@ -1,3 +1,5 @@
|
||||
.git
|
||||
.github
|
||||
DATA*
|
||||
RELEASE
|
||||
yacy.log
|
||||
@@ -8,4 +10,3 @@ examples
|
||||
build.nsi
|
||||
README.md
|
||||
Heroku.md
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
name: Build GitHub Release
|
||||
# This workflow builds the YaCy Search Server and creates a GitHub Release with the build artifacts.
|
||||
|
||||
on:
|
||||
# TODO: Currently disabled, because I'm not sure if this is the right way to do the release.
|
||||
# push:
|
||||
# tags:
|
||||
# - "v*.*.*"
|
||||
# - "Release_*"
|
||||
# pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
#os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Check-out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build
|
||||
run: ant clean all dist
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ runner.os }} ${{ runner.arch }} Build
|
||||
path: RELEASE/*
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
draft: true
|
||||
generate_release_notes: true
|
||||
files: RELEASE/*
|
||||
@@ -0,0 +1,87 @@
|
||||
name: Build Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
- "Release_*"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- tag: "" # Default Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
- tag: alpine
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
# GitHub Container Registry & Docker Hub
|
||||
images: |
|
||||
ghcr.io/${{ github.repository }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
|
||||
# generate Docker tags based on the following events/attributes
|
||||
flavor: |
|
||||
latest=auto
|
||||
prefix=
|
||||
suffix=${{ matrix.tag != '' && format('-{0}', matrix.tag) || '' }},onlatest=true
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
type=match,pattern=Release_(\d+\.\d+),group=1
|
||||
type=match,pattern=Release_(\d+),group=1
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
# Use "Dockerfile" if matrix.tag is empty, otherwise use "Dockerfile.{tag}"
|
||||
file: docker/Dockerfile${{ matrix.tag != '' && format('.{0}', matrix.tag) || '' }}
|
||||
platforms: ${{ matrix.platforms }}
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -0,0 +1,57 @@
|
||||
# Docker Image Tags Documentation
|
||||
|
||||
This document describes the tags generated by the `docker/metadata-action` in the GitHub Actions workflow for building Docker images.
|
||||
|
||||
## Base Name
|
||||
|
||||
The base name for the Docker images is derived from the repository:
|
||||
|
||||
- `ghcr.io/yacy/yacy_search_server` (GitHub Container Registry)
|
||||
- `yacy/yacy_search_server` (Docker Hub)
|
||||
|
||||
## Version Structure
|
||||
|
||||
The tags are generated based on the following rules:
|
||||
|
||||
### Default Tags
|
||||
|
||||
- `latest`: Automatically assigned to the latest tagged release.
|
||||
|
||||
### Semantic Versioning Tags
|
||||
|
||||
For releases following semantic versioning (e.g., `1.2.3` or the `Release_1.2` format), the following tags are created:
|
||||
|
||||
- `1.2.3`: Full version tag.
|
||||
- `1.2`: Major and minor version tag.
|
||||
- `1`: Major version tag.
|
||||
|
||||
### Branch Tags
|
||||
|
||||
- `<branch-name>`: For latest commit of branches (bleeding edge channel, e.g. `master`).
|
||||
|
||||
### Pull Request Tags
|
||||
|
||||
- `pr-<number>`: For latest commit of pull requests.
|
||||
|
||||
## Image Variants
|
||||
|
||||
The Docker images come in many flavors, each designed for a specific use case.
|
||||
|
||||
### `yacy/yacy_search_server:<version>`
|
||||
|
||||
This is the default image. If you are unsure about what your needs are, you probably want to use this one.
|
||||
|
||||
### `yacy/yacy_search_server:<version>-alpine`
|
||||
|
||||
This image is based on the popular Alpine Linux project. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
|
||||
|
||||
## Examples
|
||||
|
||||
- `ghcr.io/yacy/yacy_search_server:latest`
|
||||
- `ghcr.io/yacy/yacy_search_server:1.2.3`
|
||||
- `ghcr.io/yacy/yacy_search_server:1.2`
|
||||
- `ghcr.io/yacy/yacy_search_server:1`
|
||||
- `ghcr.io/yacy/yacy_search_server:master`
|
||||
- `ghcr.io/yacy/yacy_search_server:pr-42`
|
||||
- `ghcr.io/yacy/yacy_search_server:latest-alpine`
|
||||
- `ghcr.io/yacy/yacy_search_server:1.2.3-alpine`
|
||||
+11
-24
@@ -7,43 +7,30 @@
|
||||
# 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
|
||||
|
||||
|
||||
## build base
|
||||
FROM eclipse-temurin:24-jdk-noble AS base
|
||||
RUN apt-get update && apt-get install -yq wkhtmltopdf imagemagick xvfb ghostscript && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
## build app
|
||||
FROM base AS appbuilder
|
||||
|
||||
RUN apt-get update && apt-get install -yq ant git curl && rm -rf /var/lib/apt/lists/*
|
||||
RUN java -version
|
||||
## builder image
|
||||
FROM eclipse-temurin:24-jdk-noble AS builder
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ant git curl && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# compile YaCy
|
||||
WORKDIR /opt
|
||||
COPY . /opt/yacy_search_server/
|
||||
|
||||
RUN ant compile -f /opt/yacy_search_server/build.xml && \
|
||||
apt-get purge -yq --auto-remove ant && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /opt/yacy_search_server/
|
||||
RUN git rev-parse HEAD > .git/shallow && \
|
||||
git tag -l | xargs git tag -d && \
|
||||
git gc --prune=now
|
||||
RUN ant compile -f /opt/yacy_search_server/build.xml
|
||||
|
||||
# Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex())
|
||||
# Intially enable HTTPS: this is the most secure option for remote administrator authentication
|
||||
RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init
|
||||
|
||||
|
||||
## build dist
|
||||
FROM base
|
||||
## build final image
|
||||
FROM eclipse-temurin:24-jdk-noble AS app
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends wkhtmltopdf xvfb ghostscript && rm -rf /var/lib/apt/lists/*
|
||||
LABEL maintainer="Michael Peter Christen <mc@yacy.net>"
|
||||
|
||||
# copy YaCy to app image
|
||||
RUN adduser --system --group --no-create-home --disabled-password yacy
|
||||
WORKDIR /opt
|
||||
COPY --chown=yacy:yacy --from=appbuilder /opt/yacy_search_server /opt/yacy_search_server
|
||||
COPY --chown=yacy:yacy --from=builder /opt/yacy_search_server /opt/yacy_search_server
|
||||
|
||||
EXPOSE 8090 8443
|
||||
VOLUME ["/opt/yacy_search_server/DATA"]
|
||||
|
||||
+46
-88
@@ -1,105 +1,63 @@
|
||||
# Build a docker image from latest YaCy sources on Alpine Linux
|
||||
# with wkhtmltopdf for PDF generation and Java 21
|
||||
|
||||
# Base image : latest stable official jdk 11 image from Docker based on Alpine Linux
|
||||
FROM openjdk:11-alpine
|
||||
|
||||
# trace java version
|
||||
RUN java -version
|
||||
## builder image
|
||||
FROM eclipse-temurin:21-jdk-alpine-3.21 AS builder
|
||||
|
||||
# Install needed packages not in base image
|
||||
# (curl for sh scripts in /bin, and imagemagick,xvfb and ghostscript to enable PDF and image snapshot generation)
|
||||
RUN apk add --no-cache curl imagemagick xvfb ghostscript
|
||||
RUN apk add --no-cache curl git apache-ant
|
||||
|
||||
# --- Begin of wkhtmltopdf install : compile from sources because the wkhtmltopdf Alpine package is currently only on the Alpine edge branch
|
||||
|
||||
# set current working dir
|
||||
WORKDIR /tmp
|
||||
|
||||
# set wkhtmltopdf version once in a environment variable
|
||||
ENV WKHTMLTOPDF_VERSION 0.12.5
|
||||
|
||||
# Download and extract wkhtmltopdf sources
|
||||
RUN curl -fSL https://github.com/wkhtmltopdf/wkhtmltopdf/archive/${WKHTMLTOPDF_VERSION}.tar.gz -o wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz && \
|
||||
tar xzf wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz
|
||||
|
||||
# set current working dir
|
||||
WORKDIR wkhtmltopdf-${WKHTMLTOPDF_VERSION}
|
||||
|
||||
# All in one step to reduce image size growth :
|
||||
# - add packages necessary to build wkhtmltopdf from sources and then to run it
|
||||
# - build wkhtmltopdf
|
||||
# - create a symbolic link to the wkhtmltopdf executable at a path where YaCy is expecting it
|
||||
# - remove the sources archive
|
||||
# - remove the build packages
|
||||
RUN apk update && \
|
||||
apk add --no-cache g++ make qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev libgcc libstdc++ musl qt5-qtbase qt5-qtbase-x11 qt5-qtsvg qt5-qtwebkit && \
|
||||
qmake-qt5 -makefile && \
|
||||
make && \
|
||||
make install && \
|
||||
rm -f /tmp/wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz && \
|
||||
apk del g++ make qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev
|
||||
|
||||
# --- End of wkhtmltopdf install
|
||||
|
||||
# --- Begin of apache ant install : from binary distribution because ant is not in alpine packages
|
||||
|
||||
# set current working dir
|
||||
WORKDIR /tmp
|
||||
|
||||
# set ant version once in a environment variable
|
||||
ENV ANT_VERSION 1.10.5
|
||||
|
||||
# All in one step to reduce image size growth :
|
||||
# - add gnupg package
|
||||
# - get ant binary file from a mirror and PGP file signature from main repository
|
||||
# - import gpg keys from main repository and verify binary file signature
|
||||
# - extract binary, make /opt directory, move extracted ant to /opt/ant
|
||||
# - remove archive and gnupg package
|
||||
RUN apk update && \
|
||||
apk add --no-cache gnupg && \
|
||||
curl -fSL https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz -o apache-ant-${ANT_VERSION}-bin.tar.gz && \
|
||||
curl -fSL https://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.asc -o apache-ant-${ANT_VERSION}-bin.tar.gz.asc && \
|
||||
curl -fSL https://www.apache.org/dist/ant/KEYS | gpg --import && \
|
||||
gpg --verify apache-ant-${ANT_VERSION}-bin.tar.gz.asc && \
|
||||
tar xzf apache-ant-${ANT_VERSION}-bin.tar.gz && \
|
||||
mkdir -p /opt && \
|
||||
mv apache-ant-${ANT_VERSION} /opt/ant && \
|
||||
rm -f apache-ant-${ANT_VERSION}-bin.tar.gz && \
|
||||
apk del gnupg
|
||||
|
||||
# set ant required environment variables
|
||||
ENV ANT_HOME /opt/ant
|
||||
ENV PATH ${PATH}:/opt/ant/bin
|
||||
|
||||
# --- End of apache ant install
|
||||
|
||||
# set current working dir
|
||||
# set current working dir & copy sources
|
||||
WORKDIR /opt
|
||||
|
||||
# All in one step to reduce image size growth :
|
||||
# - compile with apache ant
|
||||
# - delete ant binary install
|
||||
|
||||
# copy sources
|
||||
COPY . /opt/yacy_search_server/
|
||||
|
||||
RUN apk add --no-cache \
|
||||
ant compile -f /opt/yacy_search_server/build.xml && \
|
||||
rm -rf /opt/yacy_search_server/.git && \
|
||||
rm -rf /opt/ant
|
||||
RUN ant compile -f /opt/yacy_search_server/build.xml
|
||||
|
||||
RUN \
|
||||
# Set initial admin password: "yacy" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex())
|
||||
sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
# Intially enable HTTPS: this is the most secure option for remote administrator authentication
|
||||
sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
# Create user and group yacy: this user will be used to run YaCy main process
|
||||
addgroup yacy && adduser -S -G yacy -H -D yacy && \
|
||||
# Set ownership of yacy install directory to yacy user/group
|
||||
chown yacy:yacy -R /opt/yacy_search_server
|
||||
RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:8cffbc0d66567a0987a4aba1ec46d63c" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
sed -i "/adminAccountForLocalhost=/c\adminAccountForLocalhost=false" /opt/yacy_search_server/defaults/yacy.init && \
|
||||
sed -i "/server.https=false/c\server.https=true" /opt/yacy_search_server/defaults/yacy.init
|
||||
|
||||
RUN rm -rf /opt/yacy_search_server/DATA
|
||||
## build final image
|
||||
FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-small AS wkhtmltopdf
|
||||
FROM eclipse-temurin:21-jre-alpine-3.21 AS app
|
||||
|
||||
RUN apk add --no-cache \
|
||||
imagemagick \
|
||||
xvfb \
|
||||
ghostscript \
|
||||
# Install dependencies for wkhtmltopdf
|
||||
libstdc++ \
|
||||
libx11 \
|
||||
libxrender \
|
||||
libxext \
|
||||
libssl3 \
|
||||
ca-certificates \
|
||||
fontconfig \
|
||||
freetype \
|
||||
ttf-dejavu \
|
||||
ttf-droid \
|
||||
ttf-freefont \
|
||||
ttf-liberation \
|
||||
# more fonts
|
||||
&& apk add --no-cache --virtual .build-deps \
|
||||
msttcorefonts-installer \
|
||||
# Install microsoft fonts
|
||||
&& update-ms-fonts \
|
||||
&& fc-cache -f \
|
||||
# Clean up when done
|
||||
&& rm -rf /tmp/* \
|
||||
&& apk del .build-deps
|
||||
|
||||
# Copy wkhtmltopdf files from docker-wkhtmltopdf image
|
||||
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
|
||||
|
||||
RUN addgroup yacy && adduser -S -G yacy -H -D yacy
|
||||
WORKDIR /opt
|
||||
COPY --chown=yacy:yacy --from=builder /opt/yacy_search_server /opt/yacy_search_server
|
||||
|
||||
# Expose HTTP and HTTPS default ports
|
||||
EXPOSE 8090 8443
|
||||
|
||||
@@ -0,0 +1,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.
|
||||
@@ -1,151 +0,0 @@
|
||||
# Yacy Docker image from latest sources
|
||||
|
||||
## Supported tags and respective Dockerfiles
|
||||
|
||||
* latest (Dockerfile)
|
||||
* latest-alpine (Dockerfile.alpine)
|
||||
|
||||
## Getting built image from Docker Hub
|
||||
|
||||
The repository URL is https://hub.docker.com/r/yacy/yacy_search_server/
|
||||
|
||||
* ubuntu-based: `docker pull yacy/yacy_search_server:latest`
|
||||
|
||||
|
||||
## Building image yourself
|
||||
|
||||
Using files in 'yacy_search_server/docker/':
|
||||
```
|
||||
cd yacy_search_server/docker
|
||||
```
|
||||
|
||||
Then according to the image type:
|
||||
* `yacy/yacy_search_server:latest`: This image is based on latest stable official Debian stable [openjdk](https://hub.docker.com/_/openjdk/) 11 image provided by Docker. Embed Yacy compiled from latest git repository sources.
|
||||
|
||||
```
|
||||
docker build -t yacy/yacy_search_server:latest -f Dockerfile ../
|
||||
```
|
||||
|
||||
* `yacy/yacy_search_server:aarch64-latest`: same as yacy/yacy_search_server:latest but based on
|
||||
|
||||
```
|
||||
docker build -t yacy/yacy_search_server:aarch64-latest -f Dockerfile.aarch64 ../
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Run the docker image
|
||||
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
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 and exception to your browser.
|
||||
|
||||
This kind of certificate can be generated and added to your YaCy Docker container with the following:
|
||||
|
||||
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:
|
||||
|
||||
nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf
|
||||
|
||||
And configure the keyStoreXXXX properties accordingly:
|
||||
|
||||
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:
|
||||
|
||||
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:
|
||||
|
||||
nano /var/lib/docker/volumes/[your_yacy_volume]/_data/SETTINGS/yacy.conf
|
||||
|
||||
And configure the pkcs12XXX properties accordingly:
|
||||
|
||||
pkcs12ImportFile=/opt/yacy_search_server/DATA/SETTINGS/[yourStore].pkcs12
|
||||
pkcs12ImportPwd=yourpassword
|
||||
|
||||
### Next starts
|
||||
|
||||
#### As attached process
|
||||
|
||||
docker start -a yacy
|
||||
|
||||
#### As background process
|
||||
|
||||
docker start yacy
|
||||
|
||||
### Shutdown
|
||||
|
||||
* Use "Shutdown" button in administration web interface
|
||||
* OR run:
|
||||
|
||||
docker exec [your_container_name] /opt/yacy_search_server/stopYACY.sh
|
||||
|
||||
* OR run:
|
||||
|
||||
docker stop [your_container_name]
|
||||
|
||||
### Upgrade
|
||||
|
||||
You can upgrade your YaCy container the Docker way with the following commands sequence.
|
||||
|
||||
Get latest Docker image:
|
||||
|
||||
docker pull yacy/yacy_search_server:latest
|
||||
|
||||
Create new container based on pulled image, using volume data from old container:
|
||||
|
||||
docker create --name [tmp-container_name] -p 8090:8090 -p 8443:8443 --volumes-from=[container_name] --log-opt max-size=100m --log-opt max-file=2 yacy/yacy_search_server:latest
|
||||
|
||||
Stop old container:
|
||||
|
||||
docker exec [container_name] /opt/yacy_search_server/stopYACY.sh
|
||||
|
||||
Start new container:
|
||||
|
||||
docker start [tmp-container_name]
|
||||
|
||||
Check everything works fine, then you can delete old container:
|
||||
|
||||
docker rm [container_name]
|
||||
|
||||
Rename new container to reuse same container name:
|
||||
|
||||
docker rename [tmp-container_name] [container_name]
|
||||
|
||||
## License
|
||||
|
||||
View [license](https://github.com/yacy/yacy_search_server/blob/master/COPYRIGHT) information for the software contained in this image.
|
||||
Reference in new issue
Block a user