-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Description
What I did
- I cloned the repo
- I checked out tag v6.7.21
- I added these files in docker/plugin
plugin.go
package main
import (
"github.com/rwynn/monstache/v6/monstachemap"
"strings"
)
// a plugin to convert document values to uppercase
func Map(input *monstachemap.MapperPluginInput) (output *monstachemap.MapperPluginOutput, err error) {
doc := input.Document
for k, v := range doc {
switch v.(type) {
case string:
doc[k] = strings.ToUpper(v.(string))
}
}
output = &monstachemap.MapperPluginOutput{Document: doc}
return
}
Taken from your docs.
go.mod
module monstacheplugin
go 1.13
require (
github.com/json-iterator/go v1.1.12
github.com/rwynn/monstache/v6 v6.7.21
)
Note that without go.mod and go.sum, it would not compile with the following error:
=> ERROR [8/8] RUN go build -buildmode=plugin -o plu 0.3s
------
> [8/8] RUN go build -buildmode=plugin -o plugin.so plugin.go:
#0 0.283 plugin.go:3:5: no required module provides package github.com/rwynn/monstache/monstachemap; to add it:
#0 0.283 go get github.com/rwynn/monstache/monstachemap
------
Dockerfile:17
--------------------
15 | RUN go mod download
16 |
17 | >>> RUN go build -buildmode=plugin -o $PLUGIN.so $PLUGIN.go
18 |
--------------------
ERROR: failed to solve: process "/bin/sh -c go build -buildmode=plugin -o $PLUGIN.so $PLUGIN.go" did not complete successfully: exit code: 1
- I generated go.sum with
go mod tidy
- I compiled the plugin with
build.sh
- I executed Monstache with the following compose:
services:
monstache-statistics:
image: rwynn/monstache:6.7.21
command: -f /app/configs/statistics.toml
volumes:
- ./config.toml:/app/configs/statistics.toml
- ./docker-build:/app/plugins
network_mode: host
healthcheck:
test: "wget -q -O - http://localhost:18083/healthz"
interval: 10s
timeout: 30s
retries: 60
restart: unless-stopped
working_dir: /app
The error I get
plugin-monstache-statistics-1 | ERROR 2025/06/09 15:16:38 Unable to load mapper plugin plugins/plugin.so: plugin: not implemented
Note that I have checked inside the container and it is using the correct plugin.so file.
Have you got any idea why it is not working? Thank you in advance!
Metadata
Metadata
Assignees
Labels
No labels