deployment

This commit is contained in:
skeris 2024-04-23 16:14:22 +03:00
parent 49b5acacc7
commit abf125a3de
7 changed files with 128 additions and 12 deletions

@ -1,13 +1,25 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
stages:
- test
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml
- project: "devops/pena-continuous-integration"
file: "/templates/docker/build-template.gitlab-ci.yml"
- project: "devops/pena-continuous-integration"
file: "/templates/docker/deploy-template.gitlab-ci.yml"
stages:
- build
- deploy
build-app:
extends: .build_template
deploy-to-staging:
extends: .deploy_template
rules:
- if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH"
after_script:
- ls
deploy-to-prod:
rules:
- if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
tags:
- prod
extends: .deploy_template

29
Dockerfile Normal file

@ -0,0 +1,29 @@
# BUILD
FROM golang:1.22.0-alpine AS build
# Update packages and clear cache
RUN apk add --no-cache curl
# Set work directory
WORKDIR /app
RUN apk add git
# Create binary directory
RUN mkdir /app/bin -p
# Add main files to app
ADD . .
RUN git config --global url."https://buildToken:glpat-axA8ttckx3aPf_xd2Dym@penahub.gitlab.yandexcloud.net/".insteadOf "https://penahub.gitlab.yandexcloud.net/"
# Download go depences
RUN go mod download
# Build app
RUN GOOS=linux go build -o bin ./...
# PRODUCTION
FROM alpine:3.18.3 AS production
# Install packages
RUN apk --no-cache add ca-certificates
# Create home directory
WORKDIR /app
# Copy build file
COPY --from=build /app/bin ./app
# CMD
CMD ["./app"]

@ -0,0 +1,27 @@
version: "3.3"
services:
mailnotifier:
hostname: mailnotifier
container_name: mailnotifier
image: $CI_REGISTRY_IMAGE/staging:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
tty: true
environment:
- MONGO_HOST=10.8.0.6
- MONGO_PORT=27017
- MONGO_USER=mailnotifier
- MONGO_PASSWORD=vWwbCSg4bf0p
- MONGO_DB=mailnotifier
- MONGO_AUTH=mailnotifier
- KAFKA_BROKERS=10.8.0.6:9092
- KAFKA_TOPIC_TARIFF=tariffs
- SMTP_API_URL=https://api.smtp.bz/v1/smtp/send
- SMTP_HOST=connect.mailclient.bz
- SMTP_PORT=587
- SMTP_UNAME=kotilion.95@gmail.com
- SMTP_PASS=vWwbCSg4bf0p
- SMTP_API_KEY=P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev
- SMTP_SENDER=noreply@mailing.pena.digital
- CUSTOMER_URL=http://10.8.0.6:8086
- QUIZ_RPC_URL=http://10.8.0.5:9000

@ -0,0 +1,48 @@
version: "3.3"
services:
customer-app-staging:
hostname: customer-service-staging
container_name: customer-service-staging
image: $CI_REGISTRY_IMAGE/staging:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
tty: true
environment:
- HTTP_HOST=0.0.0.0
- HTTP_PORT=8065
- GRPC_HOST=0.0.0.0
- GRPC_PORT=9065
- GRPC_DOMEN=10.8.0.6:9065
- MONGO_HOST=10.8.0.6
- MONGO_PORT=27017
- MONGO_USER=$MONGO_USER
- MONGO_PASSWORD=$MONGO_PASSWORD
- MONGO_DB_NAME=customer
- MONGO_AUTH=customer
- KAFKA_BROKERS=10.8.0.6:9092
- KAFKA_TOPIC_TARIFF=tariffs
- AUTH_MICROSERVICE_USER_URL=http://10.8.0.6:59300/user
- HUBADMIN_MICROSERVICE_TARIFF_URL=http://10.8.0.6:59303/tariff
- CURRENCY_MICROSERVICE_TRANSLATE_URL=http://10.8.0.6:3131/change
- DISCOUNT_MICROSERVICE_GRPC_HOST=10.8.0.6:9001
- PAYMENT_MICROSERVICE_GRPC_HOST=10.8.0.6:9085
- VERIFICATION_MICROSERVICE_USER_URL=http://10.8.0.6:7035/verification
- TEMPLATEGEN_MICROSERVICE_URL=10.6.0.17
- API_URL=https://api.smtp.bz/v1/smtp/send
- MAIL_SENDER=noreply@mailing.pena.digital
- MAIL_API_KEY=P0YsjUB137upXrr1NiJefHmXVKW1hmBWlpev
- MAIL_AUTH_USERNAME=kotilion.95@gmail.com
- MAIL_AUTH_PASSWORD=vWwbCSg4bf0p
- MAIL_ADDRESS=sells@pena.digital
- JWT_PUBLIC_KEY=$JWT_PUBLIC_KEY
- JWT_ISSUER=pena-auth-service
- JWT_AUDIENCE=pena
ports:
- 10.8.0.6:8065:8065
- 10.8.0.6:9065:9065
networks:
- default