-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from insidieux/1.0.0
Version 1.0.0
- Loading branch information
Showing
15 changed files
with
658 additions
and
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM alpine:3.7 | ||
|
||
ARG APP | ||
|
||
COPY "${APP}" /usr/local/bin/slack-duty-bot | ||
COPY .docker/docker-entrypoint /usr/local/bin/ | ||
|
||
RUN apk --no-cache add ca-certificates | ||
|
||
ENTRYPOINT ["docker-entrypoint"] | ||
|
||
CMD ["slack-duty-bot"] |
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,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ "${1#-}" != "$1" ]; then | ||
set -- slack-duty-bot "$@" | ||
fi | ||
|
||
exec "$@" |
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,7 @@ | ||
*.md | ||
Gopkg* | ||
Makefile | ||
LICENSE | ||
/vendor | ||
/idea | ||
config.yaml |
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,4 +14,9 @@ | |
.glide/ | ||
/.idea | ||
!/bin/.gitkeep | ||
/bin/* | ||
/bin/* | ||
|
||
/vendor | ||
slack-duty-bot | ||
config.yaml | ||
.kubernetes/deploy.yaml |
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,69 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: slack-duty-bot-${SDB_NAME}-secret | ||
type: Opaque | ||
data: | ||
token: ${SDB_SLACK_TOKEN_BASE64} | ||
--- | ||
|
||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: slack-duty-bot-${SDB_NAME}-config-map | ||
data: | ||
config.yaml: |- | ||
slack: | ||
keyword: | ||
- ${SDB_KEYWORD} | ||
group: | ||
id: ${SDB_SLACK_GROUP_ID} | ||
name: ${SDB_SLACK_GROUP_NAME} | ||
duties: | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
- [${SDB_SLACK_DEFAULT_USER}] | ||
--- | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: slack-duty-bot-${SDB_NAME} | ||
labels: | ||
app: slack-duty-bot-${SDB_NAME} | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxUnavailable: 50% | ||
maxSurge: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: slack-duty-bot-${SDB_NAME} | ||
spec: | ||
containers: | ||
- name: slack-duty-bot-${SDB_NAME} | ||
image: insidieux/slack-duty-bot:${SDB_TAG} | ||
imagePullPolicy: Always | ||
args: ["--config.path=/etc/slack-duty-bot"] | ||
env: | ||
- name: SDB_SLACK_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: slack-duty-bot-${SDB_NAME}-secret | ||
key: token | ||
volumeMounts: | ||
- name: slack-duty-bot-${SDB_NAME}-config-volume | ||
mountPath: /etc/slack-duty-bot | ||
volumes: | ||
- name: slack-duty-bot-${SDB_NAME}-config-volume | ||
configMap: | ||
name: slack-duty-bot-${SDB_NAME}-config-map | ||
restartPolicy: Always | ||
terminationGracePeriodSeconds: 30 |
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,14 @@ | ||
CHANGELOG | ||
========= | ||
|
||
1.0.0 | ||
----- | ||
* Using Slack RTM | ||
* Configuration with config file, environment variables and flags | ||
* Live reload config file | ||
* Docker image | ||
* Simple Kubernetes deploy | ||
|
||
Init | ||
---- | ||
* Simple slack-duty-bot working with http outgoing slack webhook |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,38 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
name = "github.com/spf13/pflag" | ||
version = "1.0.1" | ||
|
||
[[constraint]] | ||
name = "github.com/spf13/viper" | ||
version = "1.0.2" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
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,49 @@ | ||
all: build | ||
|
||
APP?=slack-duty-bot | ||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
BUILD_OS?=linux | ||
BUILD_ARCH?=amd64 | ||
DOCKER_IMAGE?=insidieux/${APP} | ||
DOCKER_TAG?=1.0.0 | ||
DOCKER_USER?=user | ||
DOCKER_PASSWORD?=password | ||
SDB_SLACK_TOKEN?=some-token | ||
SDB_SLACK_KEYWORD?=keyword | ||
|
||
clean: | ||
rm -f ${APP} | ||
|
||
dep-install: | ||
go get -v -u github.com/golang/dep/cmd/dep | ||
|
||
dep-ensure: dep-install | ||
rm -rf vendor | ||
dep ensure | ||
|
||
test: dep-ensure | ||
go test -v -race ./... | ||
|
||
build: clean dep-ensure | ||
env GOOS=${BUILD_OS} GOARCH=${BUILD_ARCH} CGO_ENABLED=0 go build -v -o ${APP} | ||
|
||
container: build | ||
docker rmi ${DOCKER_IMAGE}:${DOCKER_TAG} || true | ||
docker build \ | ||
--build-arg APP=${APP} \ | ||
-f .docker/Dockerfile \ | ||
-t ${DOCKER_IMAGE}:${DOCKER_TAG} \ | ||
. | ||
|
||
run: container | ||
docker stop ${APP} || true && docker rm ${APP} || true | ||
docker run \ | ||
--name ${APP} \ | ||
--rm \ | ||
-e SDB_SLACK_TOKEN=${SDB_SLACK_TOKEN} \ | ||
${DOCKER_IMAGE}:${DOCKER_TAG} \ | ||
--slack.keyword ${SDB_SLACK_KEYWORD} | ||
|
||
push: container | ||
docker login docker.io -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} | ||
docker push ${DOCKER_IMAGE}:${DOCKER_TAG} |
Oops, something went wrong.