Skip to content

Commit

Permalink
A request collector
Browse files Browse the repository at this point in the history
places received requests into a queue for executor servers

this comes together fairly quickly based on everything learned
from the creation of the executor and the demo-client.
  • Loading branch information
ThatsAMorais committed Sep 1, 2020
1 parent c101410 commit 9181722
Show file tree
Hide file tree
Showing 6 changed files with 538 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Use the official Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.13 as builder

# Create and change to the app directory.
WORKDIR /app

# Retrieve application dependencies using go modules.
# Allows container builds to reuse downloaded dependencies.
ARG user
ARG personal_access_token
RUN echo "machine github.com login ${user} password ${personal_access_token}" > ~/.netrc
RUN GOPRIVATE=github.com/moraisworkrunner
COPY go.* ./
RUN go mod download

# Copy local code to the container image.
COPY . ./

# Build the binary.
# -mod=readonly ensures immutable go.mod and go.sum in container builds.
RUN CGO_ENABLED=0 GOOS=linux go build -v -o server

# Use the official Alpine image for a lean production container.
# https://hub.docker.com/_/alpine
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine:3
RUN apk add --no-cache ca-certificates

# Copy the binary to the production image from the builder stage.
COPY --from=builder /app/server /server

# Run the web service on container startup.
CMD ["/server"]
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# collector

Collects work requests and queues them to be executed

## build and Run

```bash
go build
./collector
```

## docker build

```bash
docker build -t ${GCP_GCR_HOSTNAME}/${GCP_PROJECT_ID}/collector:{VERSION} -f Dockerfile . --build-arg user=${user} --build-arg personal_access_token=${personal_access_token}
```

## docker push

```bash
docker push ${GCP_GCR_HOSTNAME}/${GCP_PROJECT_ID}/collector:{VERSION}
```
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/moraisworkrunner/collector

go 1.13

require (
cloud.google.com/go v0.65.0
github.com/moraisworkrunner/work-messages v0.0.0-20200901020349-70f9c3a9d8ac
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103
)
Loading

0 comments on commit 9181722

Please sign in to comment.