Initial
This commit is contained in:
commit
e6261c6c6e
36
.drone.yml
Normal file
36
.drone.yml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish_image
|
||||||
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
from_secret: registry_username
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
from_secret: registry_password
|
||||||
|
commands:
|
||||||
|
- sleep 5
|
||||||
|
- ./deploy/image-build.sh
|
||||||
|
- ./deploy/image-push.sh
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: docker
|
||||||
|
image: docker:dind
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: gopath
|
||||||
|
temp: {}
|
||||||
|
- name: docker-sock
|
||||||
|
temp: {}
|
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM rabbitmq:3-management-alpine
|
||||||
|
|
||||||
|
LABEL author="Piotr Biernat"
|
||||||
|
LABEL service="api-eventubus"
|
||||||
|
LABEL vendor="Egommerce"
|
||||||
|
LABEL version="1.0"
|
||||||
|
|
||||||
|
COPY ./api-eventbus/etc /etc/rabbitmq
|
||||||
|
|
||||||
|
RUN rabbitmq-plugins --offline enable rabbitmq_peer_discovery_consul
|
||||||
|
|
||||||
|
EXPOSE 5672
|
12
Makefile
Normal file
12
Makefile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
DEPLOY_DIR := ./deploy
|
||||||
|
SRC_DIR := ./src
|
||||||
|
|
||||||
|
## DEPLOY PART
|
||||||
|
build-image-dev:
|
||||||
|
- sh ${DEPLOY_DIR}/image-build.sh dev
|
||||||
|
|
||||||
|
build-image-prod:
|
||||||
|
- sh ${DEPLOY_DIR}/image-build.sh
|
||||||
|
|
||||||
|
push-image-prod:
|
||||||
|
- sh ${DEPLOY_DIR}/image-push.sh
|
5
api-eventbus/etc/conf.d/40-logs-syslog.conf
Normal file
5
api-eventbus/etc/conf.d/40-logs-syslog.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
log.syslog = true
|
||||||
|
log.syslog.host = api-logger
|
||||||
|
log.syslog.port = 5140
|
||||||
|
|
||||||
|
log.default.level = warning
|
7
api-eventbus/etc/conf.d/50-plugin-consul.conf
Normal file
7
api-eventbus/etc/conf.d/50-plugin-consul.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
cluster_formation.peer_discovery_backend = consul
|
||||||
|
|
||||||
|
cluster_formation.consul.host = api-registry
|
||||||
|
|
||||||
|
cluster_formation.consul.svc_addr_auto = false
|
||||||
|
cluster_formation.consul.svc = api-eventbus
|
||||||
|
cluster_formation.consul.svc_addr = api-eventbus
|
16
deploy/image-build.sh
Executable file
16
deploy/image-build.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# RUN IN REPO ROOT DIR !!
|
||||||
|
|
||||||
|
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-eventbus"
|
||||||
|
|
||||||
|
TARGET=${1:-latest}
|
||||||
|
|
||||||
|
echo "Building: $IMAGE_NAME:$TARGET"
|
||||||
|
if [ $TARGET = "dev" ]
|
||||||
|
then
|
||||||
|
docker build --rm --no-cache -t "$IMAGE_NAME:dev" . # >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
docker build --rm --cache-from "$IMAGE_NAME:$TARGET" -t "$IMAGE_NAME:$TARGET" . >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Done."
|
7
deploy/image-push.sh
Executable file
7
deploy/image-push.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# RUN IN REPO ROOT DIR !!
|
||||||
|
|
||||||
|
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-eventbus"
|
||||||
|
|
||||||
|
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin
|
||||||
|
docker push "$IMAGE_NAME:latest"
|
Loading…
Reference in New Issue
Block a user