-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connector): add connector as a ShellHub service
- Loading branch information
1 parent
7087045
commit c8243f2
Showing
19 changed files
with
590 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ agent/shellhub.key | |
cli/cli | ||
go.work | ||
go.work.sum | ||
connector/.keys | ||
connector/connector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# base stage | ||
FROM golang:1.20.4-alpine3.16 AS base | ||
|
||
ARG GOPROXY | ||
|
||
RUN apk add --update git ca-certificates build-base bash util-linux perl xz | ||
|
||
# We are using libxcrypt to support yescrypt password hashing method | ||
# Since libxcrypt package is not available in Alpine, so we need to build libxcrypt from source code | ||
RUN wget -q https://github.com/besser82/libxcrypt/releases/download/v4.4.27/libxcrypt-4.4.27.tar.xz && \ | ||
tar xvf libxcrypt-4.4.27.tar.xz && cd libxcrypt-4.4.27 && \ | ||
./configure --prefix /usr && make -j$(nproc) && make install && \ | ||
cd .. && rm -rf libxcrypt-4.4.27* | ||
|
||
RUN ln -sf /bin/bash /bin/sh | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub | ||
|
||
COPY ./go.mod ./ | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/connector | ||
|
||
COPY ./connector/go.mod ./connector/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
# builder stage | ||
FROM base AS builder | ||
|
||
ARG SHELLHUB_VERSION=latest | ||
ARG GOPROXY | ||
|
||
COPY ./pkg $GOPATH/src/github.com/shellhub-io/shellhub/pkg | ||
COPY ./connector . | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub | ||
|
||
RUN go mod download | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/connector | ||
|
||
RUN go build -tags docker | ||
|
||
# development stage | ||
FROM base AS development | ||
|
||
ARG GOPROXY | ||
ENV GOPROXY ${GOPROXY} | ||
|
||
RUN apk add --update openssl openssh-client | ||
RUN go install github.com/markbates/[email protected] && \ | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub | ||
|
||
RUN go mod download | ||
|
||
COPY ./connector/entrypoint-dev.sh /entrypoint.sh | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub/connector | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
# production stage | ||
FROM alpine:3.18.4 AS production | ||
|
||
WORKDIR /app | ||
COPY --from=builder /connector /app/ | ||
|
||
ENTRYPOINT ./connector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
refresh run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module github.com/shellhub-io/shellhub/connector | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/kelseyhightower/envconfig v1.4.0 | ||
github.com/shellhub-io/shellhub v0.13.0-rc.3.0.20231016135144-7087045b3877 | ||
github.com/shellhub-io/shellhub/agent v0.0.0-20231016135144-7087045b3877 | ||
github.com/sirupsen/logrus v1.9.3 | ||
github.com/spf13/cobra v1.7.0 | ||
) | ||
|
||
require ( | ||
github.com/GehirnInc/crypt v0.0.0-20230320061759-8cc1b52080c5 // indirect | ||
github.com/Masterminds/semver v1.5.0 // indirect | ||
github.com/Microsoft/go-winio v0.6.1 // indirect | ||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect | ||
github.com/creack/pty v1.1.18 // indirect | ||
github.com/distribution/reference v0.5.0 // indirect | ||
github.com/docker/distribution v2.8.3+incompatible // indirect | ||
github.com/docker/docker v24.0.6+incompatible // indirect | ||
github.com/docker/go-connections v0.4.0 // indirect | ||
github.com/docker/go-units v0.5.0 // indirect | ||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect | ||
github.com/gliderlabs/ssh v0.3.5 // indirect | ||
github.com/go-playground/locales v0.14.1 // indirect | ||
github.com/go-playground/universal-translator v0.18.1 // indirect | ||
github.com/go-playground/validator/v10 v10.15.5 // indirect | ||
github.com/go-resty/resty/v2 v2.10.0 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect | ||
github.com/gorilla/websocket v1.5.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/kr/fs v0.1.0 // indirect | ||
github.com/labstack/echo/v4 v4.11.2 // indirect | ||
github.com/labstack/gommon v0.4.0 // indirect | ||
github.com/leodido/go-urn v1.2.4 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mattn/go-shellwords v1.0.12 // indirect | ||
github.com/opencontainers/go-digest v1.0.0 // indirect | ||
github.com/opencontainers/image-spec v1.0.2 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/pkg/sftp v1.13.6 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
github.com/valyala/fasttemplate v1.2.2 // indirect | ||
golang.org/x/crypto v0.14.0 // indirect | ||
golang.org/x/mod v0.13.0 // indirect | ||
golang.org/x/net v0.17.0 // indirect | ||
golang.org/x/sys v0.13.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
golang.org/x/tools v0.14.0 // indirect | ||
gotest.tools/v3 v3.5.1 // indirect | ||
) |
Oops, something went wrong.