Add initial support for solr

This commit is contained in:
Tom Wiesing 2022-11-02 13:50:11 +01:00
parent 7bedeefb50
commit b27871f39a
No known key found for this signature in database
13 changed files with 131 additions and 31 deletions

View file

@ -0,0 +1 @@
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME}

View file

@ -0,0 +1,48 @@
package solr
import (
"context"
"embed"
"path/filepath"
"time"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
)
type Solr struct {
component.Base
BaseURL string // upstream solr url
PollContext context.Context // context to abort polling with
PollInterval time.Duration // duration to wait for during wait
}
func (s *Solr) Path() string {
return filepath.Join(s.Still.Config.DeployRoot, "core", "solr")
}
func (*Solr) Context(parent component.InstallationContext) component.InstallationContext {
return parent
}
//go:embed all:solr
//go:embed solr.env
var resources embed.FS
func (solr *Solr) Stack(env environment.Environment) component.StackWithResources {
return component.MakeStack(solr, env, component.StackWithResources{
Resources: resources,
ContextPath: "solr",
EnvPath: "solr.env",
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": solr.Config.DockerNetworkName,
},
MakeDirs: []string{
filepath.Join("data"),
},
})
}

View file

@ -0,0 +1,18 @@
version: "3.7"
services:
solr:
image: docker.io/library/solr:8.11-slim
ports:
- "127.0.0.1:8983:8983"
volumes:
- './data/:/var/solr'
labels:
- "eu.wiss-ki.barrel.distillery=${DOCKER_NETWORK_NAME}"
restart: always
networks:
default:
name: ${DOCKER_NETWORK_NAME}
external: true

View file

@ -17,6 +17,7 @@ import (
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/instances/malt"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/meta"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/resolver"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/solr"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/ssh"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/triplestore"
@ -50,6 +51,7 @@ type Distillery struct {
type Upstream struct {
SQL string
Triplestore string
Solr string
}
// Context returns a new Context belonging to this distillery
@ -114,6 +116,11 @@ func (dis *Distillery) allComponents() []initFunc {
sql.PollContext = dis.Context()
sql.PollInterval = time.Second
}),
manual(func(s *solr.Solr) {
s.BaseURL = dis.Upstream.Solr
s.PollContext = dis.Context()
s.PollInterval = time.Second
}),
// instainces
auto[*instances.Instances],

View file

@ -23,11 +23,12 @@ func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (di
dis = &Distillery{
context: params.Context,
Still: component.Still{
Environment: environment.Native{},
Environment: new(environment.Native),
},
Upstream: Upstream{
SQL: "127.0.0.1:3306",
Triplestore: "127.0.0.1:7200",
Solr: "127.0.0.1:8983",
},
}
@ -38,6 +39,7 @@ func NewDistillery(params cli.Params, flags cli.Flags, req cli.Requirements) (di
if flags.InternalInDocker {
dis.Upstream.SQL = "sql:3306"
dis.Upstream.Triplestore = "triplestore:7200"
dis.Upstream.Solr = "solr:8983"
params.ConfigPath = dis.Still.Environment.GetEnv("CONFIG_PATH")
}