Initial
This commit is contained in:
commit
b73b36e668
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: {}
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
FROM fluent/fluentd:v1.15.3-1.0
|
||||
|
||||
LABEL author="Piotr Biernat"
|
||||
LABEL service="api-logger"
|
||||
LABEL vendor="Egommerce"
|
||||
LABEL version="1.0"
|
||||
|
||||
USER root
|
||||
RUN ["fluent-gem", "install", "fluent-plugin-rabbitmq"]
|
||||
# RUN ["gem", "install", "fluent-plugin-rabbitmq"]
|
||||
|
||||
USER fluent
|
||||
COPY ./api-logger/etc /fluentd/etc
|
||||
|
||||
|
||||
|
||||
CMD ["fluentd"]
|
||||
# ENTRYPOINT ["/traefik"] # FIXME stack->stack config.yml
|
||||
|
||||
EXPOSE 24224
|
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
|
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
||||
# apigw-service
|
||||
|
||||
API Gateway - simple Nginx image with pre-configured reverse proxy's
|
||||
|
||||
Generowanie Klucza autoryzacji
|
||||
$ openssl rand -base64 24
|
||||
|
||||
Budowanie obrazu:
|
||||
$ sh deploy/image-build.sh
|
||||
|
||||
Opublikowanie obrazu:
|
||||
$ sh deploy/image-push.sh
|
22
api-logger/etc/fluent.conf
Normal file
22
api-logger/etc/fluent.conf
Normal file
@ -0,0 +1,22 @@
|
||||
<source>
|
||||
@type forward
|
||||
port 24224
|
||||
bind 0.0.0.0
|
||||
</source>
|
||||
<match *>
|
||||
@type stdout
|
||||
</match>
|
||||
|
||||
<source>
|
||||
@type syslog
|
||||
port 5140
|
||||
bind 0.0.0.0
|
||||
tag syslog
|
||||
</source>
|
||||
<match syslog.daemon.*>
|
||||
@type stdout
|
||||
# <parse>
|
||||
# expression /\A\<(?<pri>[0-9]{1,3})\>[1-9]\d{0,2} (?<time>[^ ]+) (?<host>[!-~]{1,255}) (?<ident>[!-~]{1,48}) (?<pid>[!-~]{1,128}) (?<msgid>[!-~]{1,32}) (?<extradata>(?:\-|(?:\[.*?(?<!\\)\])+))(?: (?<message>.+))?\z/
|
||||
# time_format "%Y-%m-%dT%H:%M:%S.%L%z"
|
||||
# </parse>
|
||||
</match>
|
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-logger"
|
||||
|
||||
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-logger"
|
||||
|
||||
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