7 Commits

Author SHA1 Message Date
Matthieu Gautier
ee75bc72f5 Time to switch the CI to focal. 2023-10-08 18:29:45 +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
6 changed files with 58 additions and 33 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

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

@@ -42,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

@@ -1,7 +1,7 @@
project('kiwix-tools', 'cpp',
version : '3.5.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')

View File

@@ -29,10 +29,10 @@ using namespace std;
enum supportedAction { NONE, ADD, SHOW, REMOVE };
void show(const kiwix::Library& library, const std::string& bookId)
void show(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(const kiwix::Library& library, const std::string& libraryPath,
int handle_show(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
if (argc > 3 ) {
@@ -105,7 +105,7 @@ int handle_show(const 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(const kiwix::Library& library, const std::string& libraryPath,
return(0);
}
int handle_add(std::shared_ptr<kiwix::Library> library, const std::string& libraryPath,
int handle_add(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
string zimPath;
@@ -182,7 +182,7 @@ int handle_add(std::shared_ptr<kiwix::Library> library, const std::string& libra
return(resultCode);
}
int handle_remove(std::shared_ptr<kiwix::Library> library, const std::string& libraryPath,
int handle_remove(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
std::string bookId;
@@ -216,7 +216,7 @@ int main(int argc, char** argv)
{
string libraryPath = "";
supportedAction action = NONE;
auto library = std::make_shared<kiwix::Library>();
kiwix::Library library;
/* 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

@@ -197,7 +197,7 @@ int main(int argc, char** argv)
#endif
std::string rootLocation = "/";
auto library = std::make_shared<kiwix::Library>();
kiwix::Library library;
unsigned int nb_threads = DEFAULT_THREADS;
std::vector<std::string> zimPathes;
std::string libraryPath;
@@ -331,7 +331,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 +340,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;
}
@@ -376,8 +376,8 @@ int main(int argc, char** argv)
}
#endif
auto nameMapper = std::make_shared<kiwix::UpdatableNameMapper>(library, noDateAliasesFlag);
kiwix::Server::Configuration configuration(library, nameMapper);
kiwix::UpdatableNameMapper nameMapper(library, noDateAliasesFlag);
kiwix::Server server(&library, &nameMapper);
if (!customIndexPath.empty()) {
try {
@@ -388,18 +388,17 @@ int main(int argc, char** argv)
}
}
configuration.setAddress(address);
configuration.setRoot(rootLocation);
configuration.setPort(serverPort);
configuration.setNbThreads(nb_threads);
configuration.setVerbose(isVerboseFlag);
configuration.setTaskbar(!noSearchBarFlag, !noLibraryButtonFlag);
configuration.setBlockExternalLinks(blockExternalLinks);
configuration.setIndexTemplateString(indexTemplateString);
configuration.setIpConnectionLimit(ipConnectionLimit);
configuration.setMultiZimSearchLimit(searchLimit);
server.setAddress(address);
server.setRoot(rootLocation);
server.setPort(serverPort);
server.setNbThreads(nb_threads);
server.setVerbose(isVerboseFlag);
server.setTaskbar(!noSearchBarFlag, !noLibraryButtonFlag);
server.setBlockExternalLinks(blockExternalLinks);
server.setIndexTemplateString(indexTemplateString);
server.setIpConnectionLimit(ipConnectionLimit);
server.setMultiZimSearchLimit(searchLimit);
kiwix::Server server(configuration);
if (! server.start()) {
exit(1);
}
@@ -448,7 +447,7 @@ int main(int argc, char** argv)
if ( libraryMustBeReloaded && !libraryPaths.empty() ) {
libraryFileTimestamp = curLibraryFileTimestamp;
reloadLibrary(manager, libraryPaths);
nameMapper->update();
nameMapper.update();
libraryMustBeReloaded = false;
}
} while (waiting);