52 Commits
3.5.0 ... 3.7.0

Author SHA1 Message Date
Kelson
fcbb4a56bc Merge pull request #668 from kiwix/prepare-release-3.7.0
Prepare release 3.7.0
2024-03-13 15:17:32 +01:00
Emmanuel Engelhart
e37af51dd4 new 3.7.0 Changelog 2024-03-13 15:15:09 +01:00
Emmanuel Engelhart
43704c6154 Proper deb lizim/libkiwix dependencies 2024-03-13 15:15:09 +01:00
Emmanuel Engelhart
d25fda82be Request libzim9 2024-03-13 15:15:03 +01:00
Emmanuel Engelhart
279cdcda0b Bump-up version to 3.7.0 2024-03-13 15:14:11 +01:00
Kelson
331743ea29 Merge pull request #661 from kiwix/max-dependence-version
Check max version of libzim/libkiwix
2024-03-13 15:12:23 +01:00
Emmanuel Engelhart
19f11d8777 Check max version of libzim/libkiwix 2024-03-13 15:10:07 +01:00
Kelson
3377f9e8bb Merge pull request #666 from kiwix/implement_skip_option_2
kiwix-serve: Skip invalid ZIM files and continue startup #659
2024-03-13 15:09:43 +01:00
Emmanuel Engelhart
930c8321ca Add --skipInvalid option to man page 2024-03-10 16:53:15 +01:00
Emmanuel Engelhart
a3239ea8bc Rename --skipBroken to --skipInvalid 2024-03-10 16:50:34 +01:00
Florian Schüller
456c77d8fd kiwix-serve: Skip broken ZIM files and continue startup 2024-03-10 16:47:14 +01:00
Matthieu Gautier
7913b6a4f0 Merge pull request #665 from kiwix/documentation 2024-03-08 09:28:06 +01:00
Veloman Yunkan
027f7d6620 Reinstated the RTD Sphinx Theme for documentation
Sometime in 2023 the default theme on Read-the-Docs was changed to
Alabaster. This change enforces the old theme (sphinx_rtd_theme).
2024-03-07 18:53:37 +04:00
Matthieu Gautier
18b532a923 Merge pull request #664 from kiwix/documentation 2024-03-06 18:19:40 +01:00
Veloman Yunkan
21a145d999 Fixed the copyright date 2024-03-06 21:15:09 +04:00
Veloman Yunkan
be89de2bbe More conspicuous "ZIM name" links 2024-03-06 21:15:09 +04:00
Veloman Yunkan
433010a900 Clarified handling of naming conflicts 2024-03-06 21:15:09 +04:00
Veloman Yunkan
dd14e02741 Documented a couple of /search API's caveats 2024-03-06 21:15:09 +04:00
Veloman Yunkan
8ea12b2ce5 Fixed the "book name"-vs-"ZIM name" bug in docs 2024-03-06 21:15:09 +04:00
Matthieu Gautier
67c0ebd6ad Merge pull request #652 from kiwix/ghaction
Use kiwix-build's github action to download dependencies.
2023-12-20 11:57:05 +01:00
Matthieu Gautier
c5197ceb51 Use kiwix-build's github action to download dependencies. 2023-12-19 17:17:05 +01:00
Kelson
98b4fb3cdf Merge pull request #649 from kiwix/need-libkiwix-13
Requires libkiwix13+
2023-11-19 14:19:31 +01:00
Emmanuel Engelhart
33bdf56bdd Requires libkiwix13+ 2023-11-19 14:16:05 +01:00
Kelson
4556262c87 Merge pull request #648 from kiwix/release-3.6.0
Release 3.6.0
2023-11-19 14:13:57 +01:00
Emmanuel Engelhart
cb2159b114 Changelog for 3.6.0 2023-11-19 14:11:59 +01:00
Emmanuel Engelhart
5b45e1898b Bump-up version to 3.7.0 2023-11-19 13:59:52 +01:00
Kelson
f6128b9079 Merge pull request #643 from computerscienceiscool/patch-2 2023-10-20 10:20:47 +02:00
JJ
ba64c1637e Update README.md
Single spelling error fixed.
2023-10-20 01:02:02 -07:00
Matthieu Gautier
3a0e87d8ea Merge pull request #633 from kiwix/adapt_libkiwix_991 2023-10-12 18:05:52 +02:00
Kelson
9ca2b9fc16 Merge pull request #639 from computerscienceiscool/patch-1
Update README.md
2023-10-08 18:38:47 +02:00
JJ
f5932bf5d3 Update README.md
Fixed a few spelling and grammar errors.
2023-10-08 18:37:52 +02:00
Matthieu Gautier
018df0d563 Adapt to new api introduced in kiwix/libkiwix#991 2023-10-06 15:47:30 +02:00
Matthieu Gautier
76ac5ce93f Remove Ubuntu Kinetic from CI/CD (deprecated) 2023-10-06 15:47:30 +02:00
Matthieu Gautier
d0847525c6 Time to switch the CI to focal. 2023-10-06 15:47:30 +02:00
Matthieu Gautier
7f0c1d8a3f Merge pull request #642 from kiwix/fix_docs 2023-10-06 15:47:10 +02:00
Matthieu Gautier
bd9e67f48e Add readthedocs configuration 2023-10-06 15:33:40 +02:00
Kelson
a4cc4ba55b Merge pull request #636 from kiwix/cpp17
Move to c++17.
2023-09-22 17:38:55 +02:00
Matthieu Gautier
1a1274012f Move to c++17.
All our compilers should handle c++17. Let's move on.
2023-08-30 17:58:40 +02:00
Kelson
74712ff022 Merge pull request #631 from kiwix/kiwix-serve-docker-readme
Dedicated Docker Compose section
2023-08-13 09:39:44 +02:00
Emmanuel Engelhart
3c6971fced Dedicated Docker Compose section 2023-08-13 09:38:59 +02:00
Kelson
7a7eaaba0e Merge pull request #626 from iArchitSharma/patch-1
Added missing parameters to kiwix-serve.1
2023-07-12 15:20:43 +02:00
Archit Sharma
d166947447 Added missing parameters to kiwix-serve.1 2023-07-12 13:38:11 +05:30
Kelson
92ee72a8f2 Merge pull request #622 from kiwix/new-archs
Docker images for new architectures
2023-06-16 18:03:35 +02:00
renaud gaudin
d0f8226f50 Docker images for new architectures
- Fixes the release filename for arm64 and armv7
- Add new architectures for i386 and armv6
2023-06-16 17:59:33 +02:00
Kelson
221055f49c Merge pull request #621 from kiwix/docker-readme-improvements
Docker readme improvements
2023-05-24 10:53:31 +03:00
Emmanuel Engelhart
a463c31a0c Add example with globbing 2023-05-24 09:51:42 +02:00
Emmanuel Engelhart
6e239d5cb6 Add link to Kiwix server container image 2023-05-24 09:51:11 +02:00
Emmanuel Engelhart
191dc95266 Fix small typo in the usage() 2023-05-23 17:05:03 +02:00
Matthieu Gautier
840f92c677 Merge pull request #618 from kiwix/fix_clone_ci 2023-05-03 16:31:10 +02:00
Matthieu Gautier
f03dc46342 Remove custom git clone
Now possible because of new Docker images and proper user/permission mgmt
within the container.
2023-05-03 15:34:41 +02:00
Kelson
a8a62aef74 Merge pull request #617 from jgmoss/main
Update docker-compose.yml to use ghcr.io image
2023-04-29 13:42:28 +02:00
Graham Moss
7f9bf58742 Update docker-compose.yml to use ghcr.io image 2023-04-28 15:01:05 -04:00
17 changed files with 308 additions and 142 deletions

View File

@@ -14,10 +14,10 @@ jobs:
- win32_dyn
include:
- target: native_static
image_variant: bionic
image_variant: focal
lib_postfix: '/x86_64-linux-gnu'
- target: native_dyn
image_variant: bionic
image_variant: focal
lib_postfix: '/x86_64-linux-gnu'
- target: win32_static
image_variant: f35
@@ -36,22 +36,11 @@ jobs:
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout code
shell: python
run: |
from subprocess import check_call
from os import environ
command = [
'git', 'clone',
'https://github.com/${{github.repository}}',
'--depth=1',
'--branch', '${{steps.extract_branch.outputs.branch}}'
]
check_call(command, cwd=environ['HOME'])
- name: Install deps
shell: bash
run: |
ARCHIVE_NAME=deps2_${OS_NAME}_${{matrix.target}}_kiwix-tools.tar.xz
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C /home/runner
uses: actions/checkout@v3
- name: Install dependencies
uses: kiwix/kiwix-build/actions/dl_deps_archive@main
with:
target_platform: ${{ matrix.target }}
- name: Compile
shell: bash
run: |
@@ -63,10 +52,9 @@ jobs:
if [[ ! "${{matrix.target}}" =~ native_.* ]]; then
MESON_OPTION="$MESON_OPTION --cross-file $HOME/BUILD_${{matrix.target}}/meson_cross_file.txt"
fi
cd $HOME/kiwix-tools
meson . build ${MESON_OPTION}
cd build
ninja
env:
PKG_CONFIG_PATH: "/home/runner/BUILD_${{matrix.target}}/INSTALL/lib/pkgconfig:/home/runner/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}/pkgconfig"
CPPFLAGS: "-I/home/runner/BUILD_${{matrix.target}}/INSTALL/include"
PKG_CONFIG_PATH: "${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/lib/pkgconfig:${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}/pkgconfig"
CPPFLAGS: "-I${{env.HOME}}/BUILD_${{matrix.target}}/INSTALL/include"

View File

@@ -28,8 +28,10 @@ jobs:
VERSION={tag}
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
linux/arm/v7
linux/arm/v6
linux/386
restrict-to: kiwix/kiwix-tools
manual-tag: ${{ github.event.inputs.version }}
repo_description: auto
@@ -55,8 +57,10 @@ jobs:
VERSION={tag}
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
linux/arm/v7
linux/arm/v6
linux/386
restrict-to: kiwix/kiwix-tools
manual-tag: ${{ github.event.inputs.version }}
repo_description: auto

View File

@@ -8,7 +8,6 @@ jobs:
fail-fast: false
matrix:
distro:
- ubuntu-kinetic
- ubuntu-jammy
- ubuntu-focal
steps:
@@ -41,14 +40,6 @@ jobs:
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}
- uses: legoktm/gh-action-build-deb@ubuntu-kinetic
if: matrix.distro == 'ubuntu-kinetic'
name: Build package for ubuntu-kinetic
id: build-ubuntu-kinetic
with:
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}
- uses: legoktm/gh-action-build-deb@ubuntu-focal
if: matrix.distro == 'ubuntu-focal'
name: Build package for ubuntu-focal

21
.readthedocs.yaml Normal file
View File

@@ -0,0 +1,21 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt

View File

@@ -1,3 +1,18 @@
kiwix-tools 3.7.0
=================
* Fixed ZIM name vs Book name confusion in documentation (@veloman-yunkan #663)
* Fixes compilation dependencies to rely on appropriate version (@kelson42 #667)
* New --skipInvalid Kiwix Server command line option (@schuellerf @kelson42 #666)
kiwix-tools 3.6.0
=================
* Improved kiwix-serve man page (@iArchitSharma #626)
* C++17 compliant code base (@mgautierfr #636)
* Support of libkiwix13 (@mgautierfr #633)
* Additional docker images archs for armv6 and i386 (@rgaudin #622)
kiwix-tools 3.5.0
=================

View File

@@ -4,7 +4,7 @@ Kiwix tools
The Kiwix tools is a collection of [Kiwix](https://kiwix.org) related
command line tools:
* kiwix-manage: Manage XML based library of ZIM files
* kiwix-search: Fulltext search in ZIM files
* kiwix-search: Full text search in ZIM files
* kiwix-serve: HTTP daemon serving ZIM files
[![latest release](https://img.shields.io/github/v/tag/kiwix/kiwix-tools?label=latest%20release&sort=semver)](https://download.kiwix.org/release/kiwix-tools/)
@@ -29,8 +29,8 @@ Preamble
--------
Although the Kiwix tools can be compiled/cross-compiled on/for many
sytems, the following documentation explains how to do it on POSIX
ones. It is primarly thought for GNU/Linux systems and has been tested
systems, the following documentation explains how to do it on POSIX
ones. It is primarily thought for GNU/Linux systems and has been tested
on recent releases of
[Debian](https://debian.org)/[Ubuntu](https://ubuntu.com) and
[Fedora](https://getfedora.org).
@@ -62,7 +62,7 @@ Environment
-------------
The Kiwix tools build using [Meson](http://mesonbuild.com/) version
0.43 or higher. Meson relies itself on Ninja, pkg-config and few other
0.43 or higher. Meson relies itself on Ninja, pkg-config and a few other
compilation tools. Install them first:
* [Meson](http://mesonbuild.com/)
* [Ninja](https://ninja-build.org/)
@@ -96,7 +96,7 @@ ninja -C build install
```
You might need to run the command as `root` (or using `sudo`),
depending where you want to install the Kiwix tools. After the
depending on where you want to install the Kiwix tools. After the
installation succeeded, you may need to run ldconfig (as `root`).
Uninstallation

4
debian/control vendored
View File

@@ -3,8 +3,8 @@ Section: utils
Priority: optional
Maintainer: Kiwix team <kiwix@kiwix.org>
Build-Depends: debhelper-compat (= 13),
libkiwix-dev (>= 10.0.0~),
libzim-dev (>= 7.2.0~),
libzim-dev (>= 9.0.0), libzim-dev (<< 10.0.0),
libkiwix-dev (>= 13.0.0), libkiwix-dev (<< 14.0.0),
meson,
pkg-config,
Standards-Version: 4.5.0

View File

@@ -1,12 +1,25 @@
FROM alpine:3.16
FROM alpine:3.18
LABEL org.opencontainers.image.source https://github.com/openzim/kiwix-tools
# TARGETPLATFORM is injected by docker build
ARG TARGETPLATFORM
ARG VERSION
RUN apk --no-cache add dumb-init curl && \
ARCH=$(cat /etc/apk/arch) && \
if [ "$ARCH" = "x86" ]; then ARCH="i586"; \
elif [ "$ARCH" = "aarch64" ]; then ARCH="armhf"; \
elif [ "$ARCH" = "armv7" ]; then ARCH="armhf"; fi && \
RUN set -e && \
apk --no-cache add dumb-init curl && \
echo "TARGETPLATFORM: $TARGETPLATFORM" && \
if [ "$TARGETPLATFORM" = "linux/386" ]; then ARCH="i586"; \
# linux/arm64/v8 points to linux/arm64
elif [ "$TARGETPLATFORM" = "linux/arm64/v8" \
-o "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="aarch64"; \
# linux/arm translates to linux/arm/v7
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then ARCH="armv8"; \
elif [ "$TARGETPLATFORM" = "linux/arm/v6" ]; then ARCH="armv6"; \
elif [ "$TARGETPLATFORM" = "linux/amd64/v3" \
-o "$TARGETPLATFORM" = "linux/amd64/v2" \
-o "$TARGETPLATFORM" = "linux/amd64" ]; then ARCH="x86_64"; \
# we dont suppot any other arch so let it fail
else ARCH="unknown"; fi && \
# download requested kiwix-tools version
url="http://mirror.download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-$ARCH-$VERSION.tar.gz" && \
echo "URL: $url" && \

View File

@@ -30,3 +30,7 @@ docker run -v $(pwd):/data -it ghcr.io/kiwix/kiwix-tools kiwix-search /data/wiki
- `wget` in `alpine:3` on `arm/v7` (__inside github action only__) crashes when downloading from HTTPs locations. Keep http-only in Dockerfile.
- Was also unhappy when using the mirrors so it's using `mirror.download` on purpose.
## See also
If you are interested by a Kiwix server only container image, [here it is](server/README.md).

View File

@@ -12,6 +12,12 @@ With local ZIM file(s)
docker run -v /tmp/zim:/data -p 8080:8080 ghcr.io/kiwix/kiwix-serve wikipedia.zim wiktionary.zim
```
or, if you want to load all ZIM files within a directory, then use globbing:
```bash
docker run -v /tmp/zim:/data -p 8080:8080 ghcr.io/kiwix/kiwix-serve '*.zim'
```
With remote ZIM file
--------------------
@@ -36,7 +42,12 @@ Build an image for an ARM based GNU/Linux:
docker build . -t ghcr.io/kiwix/kiwix-serve:latest --build-arg ARCH="arm32v7/"
```
You can also deploy kiwix with [`docker-compose`](https://docs.docker.com/compose/). Check out a sample at [docker-compose.yml.example](docker-compose.yml.example)
Docker Compose
--------------
You can also deploy kiwix with
[`docker-compose`](https://docs.docker.com/compose/). Check out a
sample at [docker-compose.yml.example](docker-compose.yml.example).
Screenshots
-----------

View File

@@ -3,7 +3,7 @@ services:
kiwix-serve:
ports:
- 8080:8080
image: kiwix/kiwix-serve
image: ghcr.io/kiwix/kiwix-serve:latest
# uncomment next 4 lines to use it with local zim file in /tmp/zim
# volumes:
# - /tmp/zim:/data

View File

@@ -18,7 +18,7 @@ import os
# -- Project information -----------------------------------------------------
project = 'kiwix-tools'
copyright = '2022, kiwix-team'
copyright = '2024, kiwix-team'
author = 'kiwix-team'
@@ -30,6 +30,7 @@ on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx_rtd_theme"
]
# Add any paths that contain templates here, relative to this directory.
@@ -41,8 +42,7 @@ templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
if not on_rtd:
html_theme = 'sphinx_rtd_theme'
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,

View File

@@ -339,8 +339,8 @@ filtering criteria must be specified via the following URL parameters:
* ``q`` - include in the results only entries that contain the specified text
in the title or description.
* ``name`` - include in the results only the entry with the specified
:term:`name <ZIM name>`.
* ``name`` - include in the results only entries with a matching
:term:`book name <Book name>`.
Examples:
@@ -532,7 +532,7 @@ specified ZIM file.
**Parameters:**
``content``: :term:`name <ZIM name>` of the ZIM file.
``content``: :term:`name of the ZIM file <ZIM name>`.
.. _raw:
@@ -609,7 +609,7 @@ A multi-ZIM search request must comply with the following constraints:
below list take precedence over subsequent ones (the later ones, even if
present in the request, are simply ignored).
``content``: :term:`name <ZIM name>` of the ZIM file (for a single-ZIM
``content``: :term:`name of the ZIM file <ZIM name>` (for a single-ZIM
search). This is a :ref:`legacy parameter <deprecation>`. ``books.name``
should be used instead.
@@ -617,9 +617,23 @@ A multi-ZIM search request must comply with the following constraints:
a multi-ZIM search, however must respect the :ref:`multi-ZIM search
constraints <multi-zim-search-constraints>`.
``books.name``: :term:`name <ZIM name>` of the ZIM file. Can be repeated
for a multi-ZIM search, however must respect the :ref:`multi-ZIM search
constraints <multi-zim-search-constraints>`.
.. note::
If any of the provided ``books.id`` values refers to a book missing
from the library then an error is returned instead of running the
search on the remaining (valid) entries.
``books.name``: :term:`name of the ZIM file <ZIM name>` (not to be confused
with ``books.filter.name`` which selects/filters based on the :term:`book
name <Book name>`). Can be repeated for a multi-ZIM search, however must
respect the :ref:`multi-ZIM search constraints
<multi-zim-search-constraints>`.
.. note::
If any of the provided ``books.name`` values refers to a book missing
from the library then an error is returned instead of running the
search on the remaining (valid) entries.
``books.filter.{criteria}``: allows to take full advantage of :ref:`library
filtering <library-filtering>` functionality of the `/catalog/v2/entries`_
@@ -739,7 +753,7 @@ added as an option to perform a full text search in the said ZIM file.
**Parameters:**
``content`` (mandatory): :term:`name <ZIM name>` of the ZIM file.
``content`` (mandatory): :term:`name of the ZIM file <ZIM name>`.
``term`` (optional; defaults to an empty string): query text.
@@ -799,6 +813,21 @@ Glossary
.. glossary::
Book name
Name of the book as specified in the ZIM file metadata (for a
``kiwix-serve`` started *WITHOUT* the :option:`--library` option) or the
library XML file (for a ``kiwix-serve`` started with the
:option:`--library` option).
.. note::
Two or more books may have the same name in the library. That's not
considered a conflict, because there may be multiple versions of the
"same" book (differing by the settings of the scraper, date, etc).
:ref:`Library filtering <library-filtering>` by name will return all
matching books.
ZIM filename
Name of a ZIM file on the server filesystem.
@@ -808,20 +837,22 @@ Glossary
Identifier of a ZIM file in the server's library (used for referring to a
particular ZIM file in requests).
For a ``kiwix-serve`` started with a list of ZIM files, ZIM names are
derived from the filename by dropping the extension and replacing certain
characters (spaces are replaced with underscores, and ``+`` symbols are
replaced with the text ``plus``). Presence of the
:option:`-z`/:option:`--nodatealiases` option will create additional names
(aliases) for filenames with dates.
ZIM names are derived from the filenames as follows:
For a ``kiwix-serve`` started with the :option:`--library` option, ZIM
names come from the library XML file.
- file extension is removed,
- all characters are converted to lowercase,
- diacritics are removed,
- spaces are replaced with underscores,
- ``+`` symbols are replaced with the text ``plus``.
Presence of the :option:`-z`/:option:`--nodatealiases` option will create
additional names (aliases) for filenames with dates.
ZIM names are expected to be unique across the library. Any name conflicts
(including those caused by the usage of the
:option:`-z`/:option:`--nodatealiases` option) are reported on STDERR but,
otherwise, are ignored.
otherwise, are ignored (i.e. only one of the entries can be accessed via
the conflicting name).
ZIM title

View File

@@ -1,7 +1,7 @@
project('kiwix-tools', 'cpp',
version : '3.5.0',
version : '3.7.0',
license : 'GPL',
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])
default_options: ['c_std=c11', 'cpp_std=c++17', 'werror=true'])
compiler = meson.get_compiler('cpp')
@@ -16,8 +16,10 @@ if static_linkage
endif
thread_dep = dependency('threads')
kiwixlib_dep = dependency('kiwix', version:'>=12.0.0', static:static_linkage)
libzim_dep = dependency('libzim', version:'>=8.1.0', static:static_linkage)
libzim_dep = dependency('libzim', version:'>=9.0.0', static:static_linkage)
libzim_dep = dependency('libzim', version:'<10.0.0', static:static_linkage)
kiwixlib_dep = dependency('kiwix', version:'>=13.0.0', static:static_linkage)
kiwixlib_dep = dependency('kiwix', version:'<14.0.0', static:static_linkage)
all_deps = [thread_dep, kiwixlib_dep, libzim_dep]

View File

@@ -1,60 +1,136 @@
.TH KIWIX 1 "21 May 2012"
.TH KIWIX 1 "10 July 2023"
.SH NAME
kiwix\-serve \- Kiwix HTTP Server
kiwix-serve \- Kiwix HTTP Server
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.B kiwix-serve --library [OPTIONS] LIBRARY_FILE_PATH
.br
kiwix\-serve [\-\-index=INDEX_PATH] [\-\-port=PORT] [\-\-verbose] [\-\-daemon] [\-\-attachToProcess=PID] ZIM_PATH
.br
kiwix\-serve \-\-library [\-\-port=PORT] [\-\-verbose] [\-\-daemon] [\-\-attachToProcess=PID] LIBRARY_PATH
.B kiwix-serve [OPTIONS] ZIM_FILE_PATH ...
.SH DESCRIPTION
.PP
Stand\-alone HTTP server for serving ZIM contents over the network.
The \fBkiwix-serve\fR command is used to run a stand-alone HTTP server for serving ZIM contents over the network.
.SH ARGUMENTS
.TP
\fBLIBRARY_FILE_PATH\fR
Path of an XML library file listing ZIM files to serve. To be used only with the --library option. Multiple library files can be provided as a semicolon (;) separated list.
.TP
\fB\-\-index=INDEX_PATH\fR
Path to index folder created using \fBkiwix-install\fB.
\fBZIM_FILE_PATH ...\fR
ZIM file path(s). Multiple arguments are allowed.
.SH OPTIONS
.TP
\fB--library\fR
By default, kiwix-serve expects a list of ZIM files as command line arguments. Providing the --library option tells kiwix-serve that the command line argument is rather a library XML file.
.TP
\fB\-\-port=PORT\fR
Port number on which the server should listen.
\fB-i ADDR, --address=ADDR\fR
Listen only on this IP address. By default, the server listens on all available IP addresses.
.TP
\fB-p PORT, --port=PORT\fR
TCP port on which to listen for HTTP requests (default: 80).
.TP
\fB-r ROOT, --urlRootLocation=ROOT\fR
URL prefix on which the content should be made available (default: empty).
.TP
\fB-d, --daemon\fR
Detach the HTTP server daemon from the main process.
.TP
\fB-a PID, --attachToProcess=PID\fR
Exit when the process with id PID stops running.
.TP
\fB-M, --monitorLibrary\fR
Monitor the XML library file and reload it automatically when it changes.
Library reloading can be forced anytime by sending a SIGHUP signal to the
\*(lqkiwix-serve\*(rq process (this works regardless of the presence of the
\*(lq--monitorLibrary\*(rq/\*(lq-M\*(rq option).
.TP
\fB-m, --nolibrarybutton\fR
Disable the library home button in the ZIM viewer toolbar.
.TP
\fB-n, --nosearchbar\fR
Disable the search box in the ZIM viewer toolbar.
.TP
\fB-b, --blockexternal\fR
Prevent users from directly navigating to external resources via links in ZIM content.
.TP
\fB-t N, --threads=N\fR
Number of threads to run in parallel (default: 4).
.TP
\fB-s N, --searchLimit=N\fR
Maximum number of ZIM files in a fulltext multizim search (default: No limit).
.TP
\fB-z, --nodatealiases\fR
Create URL aliases for each content by removing the date embedded in the file name.
The expected format of the date in the filename is \*(lq_YYYY-MM\*(rq. For example, a ZIM file named \*(lqwikipedia_en_all_2020-08.zim\*(rq will be accessible both as \*(lqwikipedia_en_all_2020-08\*(rq and \*(lqwikipedia_en_all\*(rq.
.TP
\fB-c PATH, --customIndex=PATH\fR
Override the welcome page with a custom HTML file.
.TP
\fB-L N, --ipConnectionLimit=N\fR
Max number of (concurrent) connections per IP (default: infinite, recommended: >= 6).
.TP
\fB-k, --skipInvalid\fR
Startup even when ZIM files are invalid (those will be skipped)
.TP
\fB-v, --verbose\fR
Print debug log to STDOUT.
.TP
\fB-V, --version\fR
Print the software version.
.TP
\fB-h, --help\fR
Print a help message.
.SH EXAMPLES
Serve a single ZIM file:
.sp
.nf
.B kiwix-serve myzim.zim
.fi
Serve multiple ZIM files:
.sp
.nf
.B kiwix-serve zim1.zim zim2.zim zim3.zim
.fi
Serve ZIM files from a library:
.sp
.nf
.B kiwix-serve --library library.xml
.fi
.SH DOCUMENTATION
Online documentation: https://kiwix-tools.readthedocs.io/en/latest/kiwix-serve.html
.br
By default, server listens on port 80.
.TP
\fB\-\-verbose\fR
Enable verbose output.
.TP
\fB\-\-daemon\fR
Run the server as a daemon.
.TP
\fB\-\-attachToProcess=PID\fR
Shutdown the server when process numbered PID dies.
.TP
\fBZIM_PATH\fR
ZIM file of the content to serve.
Source code: https://github.com/kiwix/kiwix-tools
.br
Mandatory if not in library mode.
More info: https://wiki.kiwix.org/wiki/Kiwix-serve
.TP
\fB\-\-library\fR
Enable library mode.
.br
Serves the contents of a library file instead of a single ZIM file.
.TP
\fBLIBRARY_PATH\fR
Kiwix library file path.
.br
Library is an XML file created using \fBkiwix-manage\fB.
.SH SEE ALSO
kiwix(1) kiwix\-manage(1)
.SH AUTHOR
.SH AUTHORS
Emmanuel Engelhart <kelson@kiwix.org>
.br
Vasudev Kamath <kamathvasudev@gmail.com> (Manual)
Vasudev Kamath <kamathvasudev@gmail.com>

View File

@@ -29,10 +29,10 @@ using namespace std;
enum supportedAction { NONE, ADD, SHOW, REMOVE };
void show(kiwix::Library* library, const std::string& bookId)
void show(const kiwix::Library& library, const std::string& bookId)
{
try {
auto& book = library->getBookById(bookId);
auto& book = library.getBookById(bookId);
std::cout << "id:\t\t" << book.getId() << std::endl
<< "path:\t\t" << book.getPath() << std::endl
<< "url:\t\t" << book.getUrl() << std::endl
@@ -96,7 +96,7 @@ void usage()
<< std::endl;
}
int handle_show(kiwix::Library* library, const std::string& libraryPath,
int handle_show(const kiwix::Library& library, const std::string& libraryPath,
int argc, char* argv[])
{
if (argc > 3 ) {
@@ -105,7 +105,7 @@ int handle_show(kiwix::Library* library, const std::string& libraryPath,
show(library, bookId);
}
} else {
auto booksIds = library->getBooksIds();
auto booksIds = library.getBooksIds();
for(auto& bookId: booksIds) {
show(library, bookId);
}
@@ -113,7 +113,7 @@ int handle_show(kiwix::Library* library, const std::string& libraryPath,
return(0);
}
int handle_add(kiwix::Library* library, const std::string& libraryPath,
int handle_add(kiwix::LibraryPtr library, const std::string& libraryPath,
int argc, char* argv[])
{
string zimPath;
@@ -182,11 +182,11 @@ int handle_add(kiwix::Library* library, const std::string& libraryPath,
return(resultCode);
}
int handle_remove(kiwix::Library* library, const std::string& libraryPath,
int handle_remove(kiwix::Library& library, const std::string& libraryPath,
int argc, char* argv[])
{
std::string bookId;
const unsigned int totalBookCount = library->getBookCount(true, true);
const unsigned int totalBookCount = library.getBookCount(true, true);
int exitCode = 0;
if (argc <= 3) {
@@ -203,7 +203,7 @@ int handle_remove(kiwix::Library* library, const std::string& libraryPath,
for (int i = 3; i<argc; i++) {
bookId = argv[i];
if (!library->removeBookById(bookId)) {
if (!library.removeBookById(bookId)) {
std::cerr << "Invalid book id '" << bookId << "'." << std::endl;
exitCode = 1;
}
@@ -216,7 +216,7 @@ int main(int argc, char** argv)
{
string libraryPath = "";
supportedAction action = NONE;
kiwix::Library library;
auto library = kiwix::Library::create();
/* General argument parsing */
static struct option long_options[] = {
@@ -261,7 +261,7 @@ int main(int argc, char** argv)
libraryPath = kiwix::isRelativePath(libraryPath)
? kiwix::computeAbsolutePath(kiwix::getCurrentDirectory(), libraryPath)
: libraryPath;
kiwix::Manager manager(&library);
kiwix::Manager manager(library);
if (!manager.readFile(libraryPath, false)) {
if (kiwix::fileExists(libraryPath) || action!=ADD) {
std::cerr << "Cannot read the library " << libraryPath << std::endl;
@@ -273,13 +273,13 @@ int main(int argc, char** argv)
int exitCode = 0;
switch (action) {
case SHOW:
exitCode = handle_show(&library, libraryPath, argc, argv);
exitCode = handle_show(*library, libraryPath, argc, argv);
break;
case ADD:
exitCode = handle_add(&library, libraryPath, argc, argv);
exitCode = handle_add(library, libraryPath, argc, argv);
break;
case REMOVE:
exitCode = handle_remove(&library, libraryPath, argc, argv);
exitCode = handle_remove(*library, libraryPath, argc, argv);
break;
case NONE:
break;
@@ -292,7 +292,7 @@ int main(int argc, char** argv)
/* Rewrite the library file */
if (action == REMOVE || action == ADD) {
// writeToFile return true (1) if everything is ok => exitCode is 0
if (!library.writeToFile(libraryPath)) {
if (!library->writeToFile(libraryPath)) {
std::cerr << "Cannot write the library " << libraryPath << std::endl;
return 1;
}

View File

@@ -61,7 +61,7 @@ void usage()
<< "Optional arguments:" << std::endl << std::endl
<< "\t-h, --help\t\tPrint this help" << std::endl << std::endl
<< "\t-a, --attachToProcess\tWxit if given process id is not running anymore" << std::endl
<< "\t-a, --attachToProcess\tExit if given process id is not running anymore" << std::endl
<< "\t-d, --daemon\t\tDetach the HTTP server daemon from the main process" << std::endl
<< "\t-i, --address\t\tListen only on this ip address, all available ones otherwise" << std::endl
<< "\t-M, --monitorLibrary\tMonitor the XML library file and reload it automatically" << std::endl
@@ -77,6 +77,7 @@ void usage()
<< "\t-z, --nodatealiases\tCreate URL aliases for each content by removing the date" << std::endl
<< "\t-c, --customIndex\tAdd path to custom index.html for welcome page" << std::endl
<< "\t-L, --ipConnectionLimit\tMax number of (concurrent) connections per IP (default: infinite, recommended: >= 6)" << std::endl
<< "\t-k, --skipInvalid\tStartup even when ZIM files are invalid (those will be skipped)" << std::endl
<< std::endl
<< "Documentation:" << std::endl
@@ -197,7 +198,7 @@ int main(int argc, char** argv)
#endif
std::string rootLocation = "/";
kiwix::Library library;
auto library = kiwix::Library::create();
unsigned int nb_threads = DEFAULT_THREADS;
std::vector<std::string> zimPathes;
std::string libraryPath;
@@ -217,6 +218,7 @@ int main(int argc, char** argv)
unsigned int PPID = 0;
int ipConnectionLimit = 0;
int searchLimit = 0;
bool skipInvalid = false;
static struct option long_options[]
= {{"daemon", no_argument, 0, 'd'},
@@ -237,6 +239,7 @@ int main(int argc, char** argv)
{"monitorLibrary", no_argument, 0, 'M'},
{"ipConnectionLimit", required_argument, 0, 'L'},
{"searchLimit", required_argument, 0, 's'},
{"skipInvalid", no_argument, 0, 'k'},
{0, 0, 0, 0}};
std::set<int> usedOptions;
@@ -307,6 +310,9 @@ int main(int argc, char** argv)
case 's':
searchLimit = atoi(optarg);
break;
case 'k':
skipInvalid = true;
break;
case '?':
usage();
return 2;
@@ -331,7 +337,7 @@ int main(int argc, char** argv)
}
/* Setup the library manager and get the list of books */
kiwix::Manager manager(&library);
kiwix::Manager manager(library);
std::vector<std::string> libraryPaths;
if (libraryFlag) {
libraryPaths = kiwix::split(libraryPath, ";");
@@ -340,7 +346,7 @@ int main(int argc, char** argv)
}
/* Check if the library is not empty (or only remote books)*/
if (library.getBookCount(true, false) == 0) {
if (library->getBookCount(true, false) == 0) {
std::cerr << "The XML library file '" << libraryPath
<< "' is empty (or has only remote books)." << std::endl;
}
@@ -348,9 +354,13 @@ int main(int argc, char** argv)
std::vector<std::string>::iterator it;
for (it = zimPathes.begin(); it != zimPathes.end(); it++) {
if (!manager.addBookFromPath(*it, *it, "", false)) {
std::cerr << "Unable to add the ZIM file '" << *it
<< "' to the internal library." << std::endl;
exit(1);
if (skipInvalid) {
std::cerr << "Skipping invalid '" << *it << "' ...continuing" << std::endl;
} else {
std::cerr << "Unable to add the ZIM file '" << *it
<< "' to the internal library." << std::endl;
exit(1);
}
}
}
}
@@ -376,8 +386,8 @@ int main(int argc, char** argv)
}
#endif
kiwix::UpdatableNameMapper nameMapper(library, noDateAliasesFlag);
kiwix::Server server(&library, &nameMapper);
auto nameMapper = std::make_shared<kiwix::UpdatableNameMapper>(library, noDateAliasesFlag);
kiwix::Server server(library, nameMapper);
if (!customIndexPath.empty()) {
try {
@@ -447,7 +457,7 @@ int main(int argc, char** argv)
if ( libraryMustBeReloaded && !libraryPaths.empty() ) {
libraryFileTimestamp = curLibraryFileTimestamp;
reloadLibrary(manager, libraryPaths);
nameMapper.update();
nameMapper->update();
libraryMustBeReloaded = false;
}
} while (waiting);