Coder Social home page Coder Social logo

aes-example-plugins's Issues

Compiling plugins with external libraries is painfully slow on macOS

Because we use --volume to expose the host's Go module cache to the Docker build image, and because Docker for Mac's osxfs really does not perform well for that use-case.

The first workaround I would try would be to use a Dockerfile to copy the module cache in as a tarball, so that it's on a native Linux filesystem once we get around to actually compiling things. Similar to the trick used in teleproxy.git's Makefile. Maybe even only copy the modules listed in go list -m all, to avoid copying the entire cache.

Wrong entry point of aes-plugin-runner

Hi,

with version 1.14.2 of aes-plugin-runner for Mac you get the following error when running aes-plugin-runner :8080 ./my-plugin.so:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/ambassador/aes-plugin-runner": stat /ambassador/aes-plugin-runner: no such file or directory: unknown.

It looks like you moved the entrypoint to /usr/local/bin/aes-plugin-runner inside the image... but still trying to enter with /ambassador/aes-plugin-runner which does not exist.

Cheers

plugin was built with a different version of package github.com/hashicorp/consul/api

Hi,

I cloned the repo and did the following (under master branch):

$ make APRO_VERSION=1.12.2 DOCKER_IMAGE=testrepo/apro-example-plugin:v1
docker run --rm --entrypoint=cat docker.io/datawire/aes:1.12.2 /ambassador/aes-abi.txt > aes-abi.txt
{ \
		sed -n 's/^# *_*/AES_/p' < aes-abi.txt; \
		echo AES_GOENV=$(sed -En 's/^# *([A-Z])/\1/p' < aes-abi.txt); \
	} > aes-abi.mk
go list ./...
go: downloading github.com/hashicorp/consul v1.4.3
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/hashicorp/go-rootcerts v1.0.0
go: downloading github.com/hashicorp/go-cleanhttp v0.5.1
go: downloading github.com/hashicorp/serf v0.8.2
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
go: downloading github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/hashicorp/golang-lru v0.5.4
github.com/datawire/apro-example-plugin
docker pull golang:1.15.0 || docker run --rm --entrypoint=true golang:1.15.0
1.15.0: Pulling from library/golang
Digest: sha256:4afdc8ea330492631e6c0b46ba04ba985e8ff494431124816aac1bc1b18ff1ce
Status: Image is up to date for golang:1.15.0
docker.io/library/golang:1.15.0
grep -v '^#' < aes-abi.txt > aes-abi.pkgs.txt
docker build -t plugin-builder --build-arg CUR_DIR=/Users/user1/git/apro-example-plugin --build-arg AES_GOVERSION=1.15.0 --build-arg UID=501 build/
[+] Building 0.1s (10/10) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                                      0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/golang:1.15.0                                                                                                                                                                         0.0s
 => [1/6] FROM docker.io/library/golang:1.15.0                                                                                                                                                                                           0.0s
 => CACHED [2/6] RUN apt update                                                                                                                                                                                                          0.0s
 => CACHED [3/6] RUN apt install rsync -y                                                                                                                                                                                                0.0s
 => CACHED [4/6] RUN mkdir -p /Users/user1/git/apro-example-plugin                                                                                                                                                                         0.0s
 => CACHED [5/6] RUN mkdir -p /mnt/goproxy                                                                                                                                                                                               0.0s
 => CACHED [6/6] WORKDIR /Users/user1/git/apro-example-plugin                                                                                                                                                                              0.0s
 => exporting to image                                                                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                                                                  0.0s
 => => writing image sha256:a1c341da9ab688d9c7552d178bc0ab14a9b23545dc6f784ae7a5600a1d8a5ff9                                                                                                                                             0.0s
 => => naming to docker.io/library/plugin-builder                                                                                                                                                                                        0.0s
docker run --rm -d --env-file=/Users/user1/git/apro-example-plugin/aes-abi.mk plugin-builder
fb7b5fda64638a77bcec9f9880a4210893f07aa881667295fa48b50e6ea823b0
rsync --blocking-io -e 'docker exec -i' --exclude-from=/Users/user1/git/apro-example-plugin/build/sync-excludes.txt -r . fb7b5fda6463:/Users/user1/git/apro-example-plugin
rsync --blocking-io -e 'docker exec -i' -r /Users/user1/go/pkg/mod/cache/download/ fb7b5fda6463:/mnt/goproxy/
docker exec -i fb7b5fda6463 go build -trimpath -buildmode=plugin -o consul-plugin.so consul-plugin.go
go: downloading github.com/hashicorp/consul v1.4.3
go: downloading github.com/hashicorp/serf v0.8.2
go: downloading github.com/hashicorp/go-cleanhttp v0.5.1
go: downloading github.com/hashicorp/go-rootcerts v1.0.0
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
go: downloading github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/hashicorp/golang-lru v0.5.4
rsync --blocking-io -e 'docker exec -i' -a fb7b5fda6463:/Users/user1/git/apro-example-plugin/consul-plugin.so .
docker exec -i fb7b5fda6463 go build -trimpath -buildmode=plugin -o method-change.so method-change.go
rsync --blocking-io -e 'docker exec -i' -a fb7b5fda6463:/Users/user1/git/apro-example-plugin/method-change.so .
docker exec -i fb7b5fda6463 go build -trimpath -buildmode=plugin -o param-plugin.so param-plugin.go
rsync --blocking-io -e 'docker exec -i' -a fb7b5fda6463:/Users/user1/git/apro-example-plugin/param-plugin.so .
docker exec -i fb7b5fda6463 go build -trimpath -buildmode=plugin -o wiki-plugin.so wiki-plugin.go
rsync --blocking-io -e 'docker exec -i' -a fb7b5fda6463:/Users/user1/git/apro-example-plugin/wiki-plugin.so .
docker exec -i fb7b5fda6463 go build -trimpath -buildmode=plugin -o x-dc-plugin.so x-dc-plugin.go
rsync --blocking-io -e 'docker exec -i' -a fb7b5fda6463:/Users/user1/git/apro-example-plugin/x-dc-plugin.so .
docker exec -i fb7b5fda6463 go build -trimpath -buildmode=plugin -o xff-plugin.so xff-plugin.go
rsync --blocking-io -e 'docker exec -i' -a fb7b5fda6463:/Users/user1/git/apro-example-plugin/xff-plugin.so .
sed 's,@AES_IMAGE@,docker.io/datawire/aes:1.12.2,' < Dockerfile.in > Dockerfile
docker build -t testrepo/apro-example-plugin:v1 .
[+] Building 2.4s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 115B                                                                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                        0.0s
 => => transferring context: 34B                                                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/datawire/aes:1.12.2                                                                                                                                                                           0.0s
 => [internal] load build context                                                                                                                                                                                                        2.3s
 => => transferring context: 54.38MB                                                                                                                                                                                                     2.2s
 => [1/2] FROM docker.io/datawire/aes:1.12.2                                                                                                                                                                                             0.0s
 => CACHED [2/2] COPY ./*.so /etc/ambassador-plugins/                                                                                                                                                                                    0.0s
 => exporting to image                                                                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                                                                  0.0s
 => => writing image sha256:3e2900ca721b83157a7476d0941fe9e977d4d35a784d092018d90eb3b0129c74                                                                                                                                             0.0s
 => => naming to docker.io/testrepo/apro-example-plugin:v1                                                                                                                                                                               0.0s
date > .docker.stamp
$
$ aes-plugin-runner :8080 ./consul-plugin.so
 > aes-plugin-runner 1.12.2 (go1.15 darwin/amd64)
 > running in Docker
 $ 'docker' 'run' '--rm' '-it' '--volume=/Users/user1/git/apro-example-plugin:/Users/user1/git/apro-example-plugin:ro' '--publish=:8080:8080' '--entrypoint=/ambassador/aes-plugin-runner' 'docker.io/datawire/aes:1.12.2' ':8080' '/Users/user1/git/apro-example-plugin/consul-plugin.so'
2021/04/08 22:27:49 AMBASSADOR_CLUSTER_ID=07eb43c8-1166-5145-a060-45e4dd907e10
 > aes-plugin-runner 1.12.2 (go1.15 linux/amd64)
 > running natively
/ambassador/aes-plugin-runner: error: load plugin file: plugin.Open("/Users/user1/git/apro-example-plugin/consul-plugin"): plugin was built with a different version of package github.com/hashicorp/consul/api
$
$ aes-plugin-runner :8080 ./x-dc-plugin.so
 > aes-plugin-runner 1.12.2 (go1.15 darwin/amd64)
 > running in Docker
 $ 'docker' 'run' '--rm' '-it' '--volume=/Users/user1/git/apro-example-plugin:/Users/user1/git/apro-example-plugin:ro' '--publish=:8080:8080' '--entrypoint=/ambassador/aes-plugin-runner' 'docker.io/datawire/aes:1.12.2' ':8080' '/Users/user1/git/apro-example-plugin/x-dc-plugin.so'
2021/04/08 22:31:34 AMBASSADOR_CLUSTER_ID=07eb43c8-1166-5145-a060-45e4dd907e10
 > aes-plugin-runner 1.12.2 (go1.15 linux/amd64)
 > running natively
/ambassador/aes-plugin-runner: error: load plugin file: plugin.Open("/Users/user1/git/apro-example-plugin/x-dc-plugin"): plugin was built with a different version of package github.com/hashicorp/consul/api
$
$

Is go.mod correct?

In my plugin I would actually like to use

  • zap logger
  • go-redis client
  • fsnotify

... but it seems even the samples don't work.

Is it possible to get a complete dependency graph of AES 1.12.2 for it seems quite impossible to successfully/correctly build any kind of non-trivial plugin?

Thx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.