Skip to content

Commit

Permalink
updated docker image building system ,cleaned unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni Moreno Gimenez committed May 10, 2020
1 parent 32bcd8d commit 070d263
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 384 deletions.
6 changes: 3 additions & 3 deletions .bra.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[run]
init_cmds = [
["scripts/build.py","--clean","-v","--race"],
["go", "build", "-race","-o", "./build/influxdb-srelay", "."],
["./build/influxdb-srelay", "-config", "./examples/influxdb-srelay.conf", "-logdir","./logs"]
]
watch_all = true
watch_dirs = [
"$WORKDIR",
]
watch_exts = [".go", ".toml"]
watch_exts = [".go", ".conf"]
build_delay = 1500
cmds = [
["scripts/build.py","--clean","-v","--race"],
["go", "build", "-race","-o", "./bin/syncflux", "./pkg/"],
["./build/influxdb-srelay","-config","./examples/influxdb-srelay.conf","-logdir","./logs"]
]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ dist/*
pkg
pkg/*
.vscode/
logs/*
dev/*
78 changes: 0 additions & 78 deletions .gitlab-ci.yml

This file was deleted.

9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# v 0.6.1 (unreleased)

## New features

* Added new building system for binary,rpm/dev packages and also docker image
* Dockerfile now build image from local sources not from remote repo
* Added new -pidfile and -logs options ( -logdir still running but will be removed in the future )

## fixes

* Fix #28,#22



# v 0.6.0 (2019-06-27)


## fixes

* Fix #19,#18


# v 0.5.0 (2019-06-13)

## New features
Expand Down
66 changes: 27 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Vente-Privée
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

FROM golang:alpine AS build-env

# Add missing git
RUN apk update && \
apk upgrade && \
apk add git

# Install
RUN go get -u github.com/toni-moreno/influxdb-srelay && \
mv /go/bin/influxdb-srelay /usr/bin/influxdb-srelay && \
chmod 755 /usr/bin/influxdb-srelay && \
mkdir /etc/influxdb-srelay && \
touch /etc/influxdb-srelay/influxdb-srelay.conf
FROM golang:1.13.4-alpine as builder

RUN apk add --no-cache gcc g++ bash git

WORKDIR $GOPATH/src/github.com/toni-moreno/influxdb-srelay

COPY go.mod go.sum ./
COPY backend/ ./backend/
COPY cluster/ ./cluster/
COPY config/ ./config/
COPY prometheus/ ./prometheus/
COPY relay/ ./relay/
COPY relayctx/ ./relayctx/
COPY relayservice/ ./relayservice/
COPY utils/ ./utils/
COPY main.go ./
COPY .git .git
COPY build.go ./

#COPY . ./
RUN ls -lisa ./
RUN go run build.go build

FROM alpine:latest

COPY --from=build-env /usr/bin/influxdb-srelay /
COPY --from=build-env /go/src/github.com/toni-moreno/influxdb-srelay/example/sample.influxdb-srelay.conf /etc/influxdb-srelay/
COPY --from=builder /go/src/github.com/toni-moreno/influxdb-srelay/bin/influxdb-srelay ./bin/
COPY ./examples/*.conf /etc/influxdb-srelay/
COPY ./examples/sample.influxdb-srelay.conf /etc/influxdb-srelay/influxdb-srelay.conf
RUN mkdir -p /var/log/influxdb-srelay

ENTRYPOINT [ "/usr/bin/influxdb-srelay" ]
ENTRYPOINT [ "/bin/influxdb-srelay" ]

CMD [ "-config", "/etc/influxdb-srelay/influxdb-srelay.conf" , "-logdir","/var/log/influxdb-srelay" ]
CMD [ "-config", "/etc/influxdb-srelay/influxdb-srelay.conf" , "-logs","/var/log/influxdb-srelay" ]
# EOF
34 changes: 34 additions & 0 deletions Makefile.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
REPO_VERSION=$(shell git describe --abbrev=0 --tag)
IMAGE_VERSION=$(REPO_VERSION)
DOCKER_FILE?=./
NETWORK_NAME?=host
REGISTRY=tonimoreno
DATE=$(shell date +%Y%m%d%H%M%S )

.PHONY: all clean-image clean build-image build push force-build-image force-build run

all: build

clean-image:
docker rmi $(REGISTRY)/influxdb-srelay:$(REPO_VERSION)

clean: clean-image


build-image:
docker build -t $(REGISTRY)/influxdb-srelay:$(IMAGE_VERSION) $(DOCKER_FILE)
docker build -t $(REGISTRY)/influxdb-srelay:latest $(DOCKER_FILE)

build: build-image

push:
docker push $(REGISTRY)/influxdb-srelay:$(IMAGE_VERSION)
docker push $(REGISTRY)/influxdb-srelay:latest

force-build-image:
docker rmi -f $(REGISTRY)/influxdb-srelay:$(IMAGE_VERSION)
docker rmi -f $(REGISTRY)/influxdb-srelay:latest
docker build --no-cache -t $(REGISTRY)/influxdb-srelay:$(IMAGE_VERSION) $(DOCKER_FILE)
docker build --no-cache -t $(REGISTRY)/influxdb-srelay:latest $(DOCKER_FILE)


32 changes: 0 additions & 32 deletions PACKAGING.md

This file was deleted.

48 changes: 10 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,30 @@ Other versions will probably work but are untested.

## Setup

### Go
### From Sources

Download the daemon into your `$GOPATH` and install it in `/usr/sbin`.

```sh
go get -u github.com/toni-moreno/influxdb-srelay
cp ${GOPATH}/bin/influxdb-srelay /usr/bin/influxdb-srelay
chmod 755 /usr/bin/influxdb-srelay
git clone https://github.com/toni-moreno/influxdb-srelay
cd influxdb-srelay
go run build.go build
./bin/influxdb-srelay -config ./examples/sample.influxdb-srelay.conf -logs ./log
```

Create the configuration file in `/etc/influxdb-srelay`.

```sh
mkdir -p /etc/influxdb-srelay
mkdir -p /var/log/influxdb-srelay
cp ${GOPATH}/src/github.com/toni-moreno/influxdb-srelay/examples/sample.influxdb-srelay.conf \
/etc/influxdb-srelay/influxdb-srelay.conf
```

### Docker

Build your own image need for docker-ce > 17.05 ( or equivalent ee version )

```sh
git clone git@github.com:toni-moreno/influxdb-srelay
git clone https://github.com/toni-moreno/influxdb-srelay
cd influxdb-srelay
docker build \
--file Dockerfile \
--rm \
--tag influxdb-srelay:latest \
.
make -f Makefile.docker

docker run \
--volume /path/to/influxdb-srelay.conf:/etc/influxdb-srelay/influxdb-srelay.conf
--rm
influxdb-srelay:latest
tonimoreno/influxdb-srelay:latest
```

or
Expand Down Expand Up @@ -264,11 +253,6 @@ This endpoint provides a quick way to get InfluxCluster Backends Data and statis








## Limitations

So far,this is compatible with Debian, RedHat, and other derivatives.
Expand All @@ -278,25 +262,13 @@ So far,this is compatible with Debian, RedHat, and other derivatives.
Please read carefully [CONTRIBUTING.md][contribute-href] before making a merge
request.

Clone repository into your `$GOPATH`.

```sh
mkdir -p ${GOPATH}/src/github.com/toni-moreno
cd ${GOPATH}/src/github.com/toni-moreno
git clone [email protected]:toni-moreno/influxdb-srelay
```

Enter the directory and build the daemon.

```sh
cd ${GOPATH}/src/github.com/toni-moreno/influxdb-srelay
go build -a -ldflags '-extldflags "-static"' -o influxdb-srelay
go run build.go build
```

## Miscellaneous


[license-img]: https://img.shields.io/badge/license-MIT-blue.svg
[license-href]: LICENSE
[overview-href]: https://github.com/influxdata/influxdb-relay
[contribute-href]: CONTRIBUTING.md
Loading

0 comments on commit 070d263

Please sign in to comment.