ci prod deployment
This commit is contained in:
parent
b8081b6bde
commit
ea46112737
26
.gitea/workflows/deployProd.yml
Normal file
26
.gitea/workflows/deployProd.yml
Normal file
@ -0,0 +1,26 @@
|
||||
name: Deploy
|
||||
run-name: ${{ gitea.actor }} build image and push to container registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
CreateImage:
|
||||
runs-on: [squizstaging]
|
||||
uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
|
||||
with:
|
||||
runner: hubstaging
|
||||
secrets:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
DeployService:
|
||||
runs-on: [squizprod]
|
||||
needs: CreateImage
|
||||
uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7
|
||||
with:
|
||||
runner: hubprod
|
||||
actionid: ${{ gitea.run_id }}
|
||||
|
||||
|
26
.gitea/workflows/deployStaging.yml
Normal file
26
.gitea/workflows/deployStaging.yml
Normal file
@ -0,0 +1,26 @@
|
||||
name: Deploy
|
||||
run-name: ${{ gitea.actor }} build image and push to container registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'staging'
|
||||
|
||||
jobs:
|
||||
CreateImage:
|
||||
runs-on: [hubstaging]
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
|
||||
with:
|
||||
runner: hubstaging
|
||||
secrets:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
DeployService:
|
||||
runs-on: [hubstaging]
|
||||
needs: CreateImage
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7
|
||||
with:
|
||||
runner: hubstaging
|
||||
actionid: ${{ gitea.run_id }}
|
||||
|
||||
|
14
.gitea/workflows/lint.yml
Normal file
14
.gitea/workflows/lint.yml
Normal file
@ -0,0 +1,14 @@
|
||||
name: Lint
|
||||
run-name: ${{ gitea.actor }} produce linting
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'dev'
|
||||
|
||||
jobs:
|
||||
Lint:
|
||||
runs-on: [hubstaging]
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/lint.yml@v1.1.0
|
||||
with:
|
||||
runner: hubstaging
|
@ -1,34 +0,0 @@
|
||||
include:
|
||||
- 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:
|
||||
stage: build
|
||||
extends: .build_template
|
||||
rules:
|
||||
- if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH || $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
|
||||
script:
|
||||
- docker build -t $CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH-storer:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID --build-arg GITLAB_TOKEN=$GITLAB_TOKEN $CI_PROJECT_DIR
|
||||
- docker push $CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH-storer:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
|
||||
|
||||
deploy-staging:
|
||||
stage: deploy
|
||||
tags:
|
||||
- staging
|
||||
extends: .deploy_template
|
||||
rules:
|
||||
- if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH"
|
||||
|
||||
deploy-prod:
|
||||
stage: deploy
|
||||
tags:
|
||||
- prod
|
||||
extends: .deploy_template
|
||||
rules:
|
||||
- if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
|
13
Dockerfile
13
Dockerfile
@ -1,18 +1,9 @@
|
||||
FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/golang as build
|
||||
FROM gitea.pena/penadevops/container-images/golang:main as build
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
ARG GITLAB_TOKEN
|
||||
ENV GOPRIVATE=penahub.gitlab.yandexcloud.net/backend/penahub_common
|
||||
RUN apk add git
|
||||
RUN git config --global url."https://buildToken:glpat-axA8ttckx3aPf_xd2Dym@penahub.gitlab.yandexcloud.net/".insteadOf "https://penahub.gitlab.yandexcloud.net/"
|
||||
RUN go mod download
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o stor ./main.go
|
||||
|
||||
FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/alpine as prod
|
||||
FROM gitea.pena/penadevops/container-images/alpine:main as prod
|
||||
COPY --from=build /app/stor .
|
||||
EXPOSE 1489
|
||||
ENV IS_PROD_LOG=false
|
||||
ENV IS_PROD=false
|
||||
ENV PORT=1489
|
||||
ENV PG_CRED="host=postgres port=5432 user=squiz password=Redalert2 dbname=squiz sslmode=disable"
|
||||
CMD ["/stor"]
|
||||
|
@ -1,18 +1,15 @@
|
||||
version: "3"
|
||||
services:
|
||||
storerv1.0.0:
|
||||
hostname: squiz-storerv1.0.0
|
||||
container_name: squiz-storerv1.0.0
|
||||
image: $CI_REGISTRY_IMAGE/main-storer:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
|
||||
image: gitea.pena/squiz/storer/main:$GITHUB_RUN_NUMBER
|
||||
tty: true
|
||||
environment:
|
||||
IS_PROD_LOG: 'false'
|
||||
IS_PROD: 'false'
|
||||
PUBLIC_ACCESS_SECRET_KEY: $JWT_PUBLIC_KEY
|
||||
PUBLIC_ACCESS_SECRET_KEY: "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLW1tlHyKC9AG0hGpmkksET2DE\nr7ojSPemxFWAgFgcPJWQ7x3uNbsdJ3bIZFoA/FClaWKMCZmjnH9tv0bKZtY/CDhM\nZEyHpMruRSn6IKrxjtQZWy4uv/w6MzUeyBYG0OvNCiYpdvz5SkAGAUHD5ZNFqn2w\nKKFD0I2Dr59BFVSGJwIDAQAB\n-----END PUBLIC KEY-----"
|
||||
PORT: 1489
|
||||
MINIO_EP: s3.timeweb.cloud
|
||||
MINIO_AK: 5CV77KVDUU9H0II9R24M
|
||||
MINIO_SK: 0W0m8DyvdAKRJnsAy6mB5zndQ7RouJBLhqhtThcu
|
||||
PG_CRED: 'host=10.8.0.9 port=5433 user=squiz password=Redalert2 dbname=squiz sslmode=disable'
|
||||
PG_CRED: 'host=10.8.0.122 port=5433 user=squiz password=Redalert2 dbname=squiz sslmode=disable'
|
||||
ports:
|
||||
- 10.6.0.26:1589:1489
|
||||
- 10.8.0.12:1589:1489
|
||||
|
Loading…
Reference in New Issue
Block a user