Added Docker support for the Indexer
This commit is contained in:
@@ -26,6 +26,7 @@ This repository comes with
|
|||||||
1. By injecting IConfiguration (e.g. `services.AddSingleton<Client>();`)
|
1. By injecting IConfiguration (e.g. `services.AddSingleton<Client>();`)
|
||||||
2. By specifying the baseUri, apiKey, and searchdomain (e.g. `new Client.Client(baseUri, apiKey, searchdomain)`)
|
2. By specifying the baseUri, apiKey, and searchdomain (e.g. `new Client.Client(baseUri, apiKey, searchdomain)`)
|
||||||
## Indexer
|
## Indexer
|
||||||
|
(Docker now available! See [Docker installation](docs/Indexer.md#docker-installation))
|
||||||
1. [Install the dependencies](docs/Indexer.md#installing-the-dependencies)
|
1. [Install the dependencies](docs/Indexer.md#installing-the-dependencies)
|
||||||
2. [Set up the server](#server)
|
2. [Set up the server](#server)
|
||||||
3. [Configure the indexer](docs/Indexer.md#configuration)
|
3. [Configure the indexer](docs/Indexer.md#configuration)
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ The indexer by default
|
|||||||
- Uses Elmah error logging (endpoint: `/elmah`, local files: `~/logs`)
|
- Uses Elmah error logging (endpoint: `/elmah`, local files: `~/logs`)
|
||||||
- Uses serilog logging (local files: `~/logs`)
|
- Uses serilog logging (local files: `~/logs`)
|
||||||
- Uses HealthChecks (endpoint: `/healthz`)
|
- Uses HealthChecks (endpoint: `/healthz`)
|
||||||
|
## Docker installation
|
||||||
|
(On Linux you might need root privileges, thus use `sudo` where necessary)
|
||||||
|
1. Navigate to the `src` directory
|
||||||
|
2. Build the docker container: `docker build -t indexer -f Indexer/Dockerfile .`
|
||||||
|
3. Run the docker container: `docker run -t indexer` (the `-t` is optional, but you get more meaningful output)
|
||||||
|
|
||||||
## Installing the dependencies
|
## Installing the dependencies
|
||||||
## Ubuntu 24.04
|
## Ubuntu 24.04
|
||||||
1. Install the .NET SDK: `sudo apt update && sudo apt install dotnet-sdk-8.0 -y`
|
1. Install the .NET SDK: `sudo apt update && sudo apt install dotnet-sdk-8.0 -y`
|
||||||
|
|||||||
14
src/Indexer/Dockerfile
Normal file
14
src/Indexer/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM ubuntu:24.04 AS ubuntu
|
||||||
|
WORKDIR /app
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y python3.12 python3.12-venv python3.12-dev dotnet-sdk-8.0
|
||||||
|
RUN apt-get clean
|
||||||
|
COPY . /src/
|
||||||
|
ENV ASPNETCORE_ENVIRONMENT Docker
|
||||||
|
RUN rm /src/Server/appsettings*
|
||||||
|
RUN dotnet build /src/Indexer/Indexer.csproj
|
||||||
|
RUN dotnet publish /src/Indexer/Indexer.csproj -c Release -o /app
|
||||||
|
RUN cp -r /src/Indexer/Scripts /app/Scripts
|
||||||
|
RUN rm -r /src
|
||||||
|
ENV PYTHONIOENCODING=utf8
|
||||||
|
ENTRYPOINT ["./Indexer"]
|
||||||
@@ -40,7 +40,7 @@ def index_files(toolset: Toolset):
|
|||||||
jsonEntities:list = []
|
jsonEntities:list = []
|
||||||
for filename in os.listdir(example_content):
|
for filename in os.listdir(example_content):
|
||||||
qualified_filepath = example_content + "/" + filename
|
qualified_filepath = example_content + "/" + filename
|
||||||
with open(qualified_filepath, "r") as file:
|
with open(qualified_filepath, "r", encoding='utf-8') as file:
|
||||||
title = file.readline()
|
title = file.readline()
|
||||||
text = file.read()
|
text = file.read()
|
||||||
datapoints:list = [
|
datapoints:list = [
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"Worker":
|
"Worker":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"Name": "example",
|
"Name": "pythonExample",
|
||||||
"Searchdomains": [
|
"Searchdomains": [
|
||||||
"example"
|
"example"
|
||||||
],
|
],
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"Calls": [
|
"Calls": [
|
||||||
{
|
{
|
||||||
"Type": "interval",
|
"Type": "interval",
|
||||||
"Interval": 60000
|
"Interval": 30000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/Indexer/appsettings.Docker.json
Normal file
37
src/Indexer/appsettings.Docker.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Kestrel":{
|
||||||
|
"Endpoints": {
|
||||||
|
"http":{
|
||||||
|
"Url": "http://0.0.0.0:5120"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Embeddingsearch": {
|
||||||
|
"BaseUri": "http://172.17.0.1:5146",
|
||||||
|
"ApiKeys": ["b54ea868-496e-11f0-9cc7-f79f06b160e5", "bbdeedf0-496e-11f0-9744-97e28c221f67"]
|
||||||
|
},
|
||||||
|
"EmbeddingsearchIndexer": {
|
||||||
|
"Worker":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Name": "pythonExample",
|
||||||
|
"Searchdomains": [
|
||||||
|
"example"
|
||||||
|
],
|
||||||
|
"Script": "Scripts/example.py",
|
||||||
|
"Calls": [
|
||||||
|
{
|
||||||
|
"Type": "interval",
|
||||||
|
"Interval": 30000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
29
src/Indexer/appsettings.Production.json
Normal file
29
src/Indexer/appsettings.Production.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Embeddingsearch": {
|
||||||
|
"BaseUri": "http://localhost:5146"
|
||||||
|
},
|
||||||
|
"EmbeddingsearchIndexer": {
|
||||||
|
"Worker":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"Name": "pythonExample",
|
||||||
|
"Searchdomains": [
|
||||||
|
"example"
|
||||||
|
],
|
||||||
|
"Script": "Scripts/example.py",
|
||||||
|
"Calls": [
|
||||||
|
{
|
||||||
|
"Type": "interval",
|
||||||
|
"Interval": 30000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"Kestrel":{
|
"Kestrel":{
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"http":{
|
"http":{
|
||||||
"Url": "http://localhost:5146"
|
"Url": "http://0.0.0.0:5146"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user