phonkee / goexpose Goto Github PK
View Code? Open in Web Editor NEWExpose shellscripts, postgres queries, redis commands and other as rest server endpoints
License: MIT License
Expose shellscripts, postgres queries, redis commands and other as rest server endpoints
License: MIT License
YAML is easier to maintain than json format.
Instead of defining all tasks in one config file, can we support tasks in different files in one directory that can be read as a glob? Sort of how conf.d (http://www.confd.io/) works? When there are dozens of tasks, editing a single file becomes unwieldy. :-)
Thanks for a great project.
Obviously there is something I am missing after I do go install .. it does not create any binaries under $GOBIN. Is this program not meant to be used as a standalone program or needs to be called only as a library. I simply want to run it in standalone mode.
Tried installing directly on my machine:
can't load package: package github.com/phonkee/goexpose: cannot find package "github.com/phonkee/goexpose" in any of:
/usr/local/go/src/github.com/phonkee/goexpose (from $GOROOT)
/Users/sriramvenkat/work/src/github.com/phonkee/goexpose (from $GOPATH)
Can you share a bit more about your build process?
I tried to dockerize this and am getting:
=> ERROR [builder 8/8] RUN echo "Compiling for darwin-amd64..." && glide novendor && env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-1.0.0 ./cmd/goexpose 0.3s
------
> [builder 8/8] RUN echo "Compiling for darwin-amd64..." && glide novendor && env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-1.0.0 ./cmd/goexpose:
#15 0.153 Compiling for darwin-amd64...
#15 0.244 ./cmd/...
#15 0.244 .
#15 0.253 go: cannot find main module, but found glide.lock in /go/src/app
#15 0.253 to create a module there, run:
#15 0.253 go mod init
------
Heres my Dockerfile
# Build stage
FROM golang:latest as builder
RUN apt-get update && \
apt-get install -y git
WORKDIR /go/src/app
# Install Glide
RUN curl -sL https://github.com/Masterminds/glide/releases/download/v0.13.2/glide-v0.13.2-linux-amd64.tar.gz | tar -xz && \
mv linux-amd64/glide /usr/local/bin/glide
# Copy the source code and Glide files
COPY . .
COPY glide.* ./
# Install the project dependencies
RUN glide install
# Set environment variables
ARG version=1.0.0
# Run the build script
#RUN echo "Compiling for darwin-amd64..." && \
# env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-$version ./cmd/goexpose
# Run the build script with Glide
RUN echo "Compiling for darwin-amd64..." && \
glide novendor && \
env GOOS=darwin GOARCH=amd64 go build -ldflags "-s" -o build/goexpose-darwin-amd64-$version ./cmd/goexpose
# Final stage
FROM alpine:latest
WORKDIR /root/
# Copy the binary from the builder stage
COPY --from=builder /go/src/app/build/goexpose-darwin-amd64-$version .
# Add any other necessary setup or runtime dependencies here
# Run the binary
CMD ["./goexpose-darwin-amd64-$version"]
Using the following configuration
{
"host": "127.0.0.1",
"port": 9900,
"reload_env": true,
"endpoints": [
{
"path": "/test",
"methods": {
"GET": {
"type": "shell",
"config": {
"shell": "/bin/bash",
"commands": [
{
"command": "./error.sh",
"format": "json"
}
]
}
}
}
}
]
}
and the following test script
#!/bin/sh
echo 'some error response' 1>&2
exit 1
I see the output of stderr is base64 encoded.
Is this expected?
[vagrant@localhost ~]$ ./goexpose-linux-amd64-1.0.0 --config test.json &
[1] 28404
[vagrant@localhost ~]$ curl http://localhost:9900/test
{"message":"OK","result":[{"error":{"Stderr":"c29tZSBlcnJvciByZXNwb25zZQo="},"message":"OK"}],"status":200}
[vagrant@localhost ~]$ echo c29tZSBlcnJvciByZXNwb25zZQo= | base64 --decode
some error response
What would you like to see in version 2.0?
Yo there :)
was just coming here after reading about nigit.
I googled goexpose
to reach the github repo and I must admit that the google results weren't great -- check yourself :)
Would suggest to rename the project to avoid confusion! ;-)
Hi,
When I try to install goexpose I get:
go get -v github.com/phonkee/goexpose
Fetching https://gopkg.in/inf.v0?go-get=1
Parsing meta tags from https://gopkg.in/inf.v0?go-get=1 (status code 200)
get "gopkg.in/inf.v0": found meta tag main.metaImport{Prefix:"gopkg.in/inf.v0", VCS:"git",
RepoRoot:"https://gopkg.in/inf.v0"} at https://gopkg.in/inf.v0?go-get=1
gopkg.in/inf.v0 (download)
And it hangs there forever.
go version go1.6.2 linux/amd64
Is there any workaround for this?
Many thanks in advance.
Best
Hi I love goexpose!
Could you please build the binaries and upload them as a release? That would be much appreciated.
Thanks!
go install github.com/phonkee/goexpose
server.go:17:2: cannot find package "github.com/phonkee/wheedle/errors" in any of:
/home/golang/go/src/github.com/phonkee/wheedle/errors (from $GOROOT)
/home/golang/src/github.com/phonkee/wheedle/errors (from $GOPATH)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.