-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5c2e7c
commit f041f87
Showing
5 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Tika | ||
|
||
[Tika](https://tika.apache.org/) is a content analysis toolkit as a service that can detect and extract metadata and | ||
text from over a thousand different file types. | ||
|
||
## Getting Started | ||
|
||
```nix | ||
# In `perSystem.process-compose.<name>` | ||
{ | ||
services.tika."instance-name" = { | ||
enable = true; | ||
port = 9998; | ||
host = "127.0.0.1"; | ||
}; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ in | |
./tempo.nix | ||
./weaviate.nix | ||
./searxng.nix | ||
./tika.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ pkgs, lib, name, config, ... }: | ||
let | ||
inherit (lib) types literalExpression; | ||
in | ||
{ | ||
options = { | ||
package = lib.mkPackageOption pkgs "tika" { }; | ||
|
||
host = lib.mkOption { | ||
description = "Apache Tika bind address"; | ||
default = "127.0.0.1"; | ||
example = "0.0.0.0"; | ||
type = types.str; | ||
}; | ||
|
||
port = lib.mkOption { | ||
description = "Apache Tika port to listen on"; | ||
default = 9998; | ||
type = types.port; | ||
}; | ||
|
||
configFile = lib.mkOption { | ||
type = types.nullOr types.path; | ||
default = null; | ||
description = '' | ||
The Apache Tika configuration (XML) file to use. | ||
''; | ||
example = literalExpression "./tika/tika-config.xml"; | ||
}; | ||
}; | ||
|
||
config = { | ||
outputs = { | ||
settings = { | ||
processes = { | ||
"${name}" = { | ||
command = "${lib.getExe config.package} --host ${config.host} --port ${toString config.port} ${lib.optionalString (config.configFile != null) "--config ${config.configFile}"}"; | ||
availability.restart = "on_failure"; | ||
readiness_probe = { | ||
http_get = { | ||
host = config.host; | ||
port = config.port; | ||
}; | ||
initial_delay_seconds = 2; | ||
period_seconds = 10; | ||
timeout_seconds = 4; | ||
success_threshold = 1; | ||
failure_threshold = 5; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ pkgs, ... }: | ||
{ | ||
services.tika."tika1" = { | ||
enable = true; | ||
}; | ||
|
||
settings.processes.test = { | ||
command = pkgs.writeShellApplication { | ||
runtimeInputs = [ pkgs.curl ]; | ||
text = '' | ||
curl http://127.0.0.1:9998 | ||
''; | ||
name = "tika-test"; | ||
}; | ||
depends_on."tika1".condition = "process_healthy"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters