Loading .gitlab-ci.yml +11 −126 Original line number Diff line number Diff line include: - project: 'redmic-project/gitlab-ci-templates' ref: master file: '/packaging.yml' - project: 'redmic-project/gitlab-ci-templates' ref: master file: '/deployment.yml' stages: - package - test-package - deploy variables: DOCKER_DRIVER: overlay2 FLUENTD_VERSION: '1.3' ES_PLUGIN_VERSION: '3.4.0' ES_PLUGIN_VERSION: '3.5.0' DOCKER_BUILD_ARGS: --build-arg FLUENTD_VERSION=${FLUENTD_VERSION} --build-arg ES_PLUGIN_VERSION=${ES_PLUGIN_VERSION} STACK: log SERVICES_TO_CHECK: log_${CI_PROJECT_NAME} IMAGE_NAME: ${CI_REGISTRY_IMAGE} IMAGE_TAG: ${CI_COMMIT_SHA} services: - docker:dind docker-build-commit-non-master-branches: stage: package image: docker:stable only: - branches except: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - > docker build --build-arg FLUENTD_VERSION=${FLUENTD_VERSION} --build-arg ES_PLUGIN_VERSION=${ES_PLUGIN_VERSION} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-latest . - docker push ${CI_REGISTRY_IMAGE} docker-build-commit-master-branch: stage: package image: docker:stable only: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - > docker build --build-arg FLUENTD_VERSION=${FLUENTD_VERSION} --build-arg ES_PLUGIN_VERSION=${ES_PLUGIN_VERSION} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:latest . - docker push ${CI_REGISTRY_IMAGE} docker-tag-already-built-image: stage: package image: docker:stable only: - tags script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} - docker tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} - docker push ${CI_REGISTRY_IMAGE} container-scanning: stage: test-package image: docker:stable allow_failure: true only: - branches script: - docker run -d --name db arminc/clair-db:latest - docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1 - apk add -U wget ca-certificates - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} - wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 - mv clair-scanner_linux_amd64 clair-scanner - chmod +x clair-scanner - touch clair-whitelist.yml - > ./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-sast-container-report.json -l clair.log -w clair-whitelist.yml ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} || true artifacts: paths: [gl-sast-container-report.json] deploy-supporting-branch-develop: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${DEV_SSH_REMOTE} script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: dev only: - branches except: - master when: manual deploy-stable-branch-develop: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${DEV_SSH_REMOTE} script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: dev only: - master when: manual deploy-supporting-branch-production: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${PRO_SSH_REMOTE} script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: pro only: - branches except: - master when: manual deploy-stable-branch-production: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${PRO_SSH_REMOTE} .deploy: script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: pro only: - master when: manual Dockerfile +3 −2 Original line number Diff line number Diff line Loading @@ -4,9 +4,10 @@ FROM fluent/fluentd:v${FLUENTD_VERSION} LABEL maintainer="info@redmic.es" ARG ES_PLUGIN_VERSION=3.4.0 ARG ES_PLUGIN_VERSION=3.5.0 RUN apk add --update --no-cache --virtual .build-deps \ RUN apk add --update --no-cache \ --virtual .build-deps \ build-base \ ruby-dev && \ gem install --no-document \ Loading LICENSE 0 → 100644 +21 −0 Original line number Diff line number Diff line MIT License Copyright (c) 2019 REDMIC Project / Log 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. deploy/conf/fluent.conf +2 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ logstash_prefix fluentd logstash_dateformat %Y%m request_timeout 15s reconnect_on_error true reload_on_failure true reconnect_on_error false reload_on_failure false reload_connections false <buffer> total_limit_size 128MB Loading deploy/docker-compose.dev.yml 0 → 100644 +1 −0 Original line number Diff line number Diff line version: '3.5' Loading
.gitlab-ci.yml +11 −126 Original line number Diff line number Diff line include: - project: 'redmic-project/gitlab-ci-templates' ref: master file: '/packaging.yml' - project: 'redmic-project/gitlab-ci-templates' ref: master file: '/deployment.yml' stages: - package - test-package - deploy variables: DOCKER_DRIVER: overlay2 FLUENTD_VERSION: '1.3' ES_PLUGIN_VERSION: '3.4.0' ES_PLUGIN_VERSION: '3.5.0' DOCKER_BUILD_ARGS: --build-arg FLUENTD_VERSION=${FLUENTD_VERSION} --build-arg ES_PLUGIN_VERSION=${ES_PLUGIN_VERSION} STACK: log SERVICES_TO_CHECK: log_${CI_PROJECT_NAME} IMAGE_NAME: ${CI_REGISTRY_IMAGE} IMAGE_TAG: ${CI_COMMIT_SHA} services: - docker:dind docker-build-commit-non-master-branches: stage: package image: docker:stable only: - branches except: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - > docker build --build-arg FLUENTD_VERSION=${FLUENTD_VERSION} --build-arg ES_PLUGIN_VERSION=${ES_PLUGIN_VERSION} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-latest . - docker push ${CI_REGISTRY_IMAGE} docker-build-commit-master-branch: stage: package image: docker:stable only: - master script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - > docker build --build-arg FLUENTD_VERSION=${FLUENTD_VERSION} --build-arg ES_PLUGIN_VERSION=${ES_PLUGIN_VERSION} -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} -t ${CI_REGISTRY_IMAGE}:latest . - docker push ${CI_REGISTRY_IMAGE} docker-tag-already-built-image: stage: package image: docker:stable only: - tags script: - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} - docker tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} - docker push ${CI_REGISTRY_IMAGE} container-scanning: stage: test-package image: docker:stable allow_failure: true only: - branches script: - docker run -d --name db arminc/clair-db:latest - docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1 - apk add -U wget ca-certificates - docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY} - docker pull ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} - wget https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 - mv clair-scanner_linux_amd64 clair-scanner - chmod +x clair-scanner - touch clair-whitelist.yml - > ./clair-scanner -c http://docker:6060 --ip $(hostname -i) -r gl-sast-container-report.json -l clair.log -w clair-whitelist.yml ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} || true artifacts: paths: [gl-sast-container-report.json] deploy-supporting-branch-develop: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${DEV_SSH_REMOTE} script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: dev only: - branches except: - master when: manual deploy-stable-branch-develop: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${DEV_SSH_REMOTE} script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: dev only: - master when: manual deploy-supporting-branch-production: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${PRO_SSH_REMOTE} script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: pro only: - branches except: - master when: manual deploy-stable-branch-production: stage: deploy image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG} variables: SSH_REMOTE: ${PRO_SSH_REMOTE} .deploy: script: - > deploy.sh IMAGE_NAME=${IMAGE_NAME} IMAGE_TAG=${IMAGE_TAG} ES_HOSTS=${ES_HOSTS} ES_USER=${ES_USER} ES_PASS=${ES_PASS} environment: name: pro only: - master when: manual
Dockerfile +3 −2 Original line number Diff line number Diff line Loading @@ -4,9 +4,10 @@ FROM fluent/fluentd:v${FLUENTD_VERSION} LABEL maintainer="info@redmic.es" ARG ES_PLUGIN_VERSION=3.4.0 ARG ES_PLUGIN_VERSION=3.5.0 RUN apk add --update --no-cache --virtual .build-deps \ RUN apk add --update --no-cache \ --virtual .build-deps \ build-base \ ruby-dev && \ gem install --no-document \ Loading
LICENSE 0 → 100644 +21 −0 Original line number Diff line number Diff line MIT License Copyright (c) 2019 REDMIC Project / Log 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.
deploy/conf/fluent.conf +2 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ logstash_prefix fluentd logstash_dateformat %Y%m request_timeout 15s reconnect_on_error true reload_on_failure true reconnect_on_error false reload_on_failure false reload_connections false <buffer> total_limit_size 128MB Loading
deploy/docker-compose.dev.yml 0 → 100644 +1 −0 Original line number Diff line number Diff line version: '3.5'