Commit b66913c8 authored by 钟尚武's avatar 钟尚武

Merge branch 'master' into 'deploy/like-stage'

调整CICD

See merge request !403
parents fc57d6e6 9ce32a51
Pipeline #4835 passed with stage
kind: pipeline
name: like-sun
steps:
- name: build-test
image: plugins/docker
when:
branch: deploy/like-test
settings:
dockerfile: deploy/test/Dockerfile
registry: ccr.ccs.tencentyun.com
username: 100009168942
password: 3m4V#TMrUTSIebv1
repo: ccr.ccs.tencentyun.com/gm-ai/like-sun
tags:
- ${DRONE_COMMIT}
- name: build-stage
image: plugins/docker
when:
branch: deploy/like-stage
settings:
dockerfile: deploy/stage/Dockerfile
registry: ccr.ccs.tencentyun.com
username: 100009168942
password: 3m4V#TMrUTSIebv1
repo: ccr.ccs.tencentyun.com/gm-ai/like-sun
tags:
- ${DRONE_COMMIT}
- name: build-prod
image: plugins/docker
when:
branch: deploy/like-prod
settings:
dockerfile: deploy/prod/Dockerfile
registry: ccr.ccs.tencentyun.com
dockerfile: deploy/prod/Dockerfile
username: 100009168942
password: 3m4V#TMrUTSIebv1
repo: ccr.ccs.tencentyun.com/gm-ai/like-sun
tags:
- ${DRONE_COMMIT}
- name: deploy-app
image: ccr.ccs.tencentyun.com/gm-ai/drone-kube:pre
environment:
repo: alpha/sun
when:
instance:
exclude:
- aidrone.iyanzhi.com
settings:
namespace: ${DRONE_BRANCH}
template: deploy.yaml
tag: ${DRONE_COMMIT}
- name: deploy-celery
image: ccr.ccs.tencentyun.com/gm-ai/drone-kube:pre
environment:
repo: alpha/sun
when:
instance:
exclude:
- aidrone.iyanzhi.com
- cicd.gmapp.env
settings:
namespace: ${DRONE_BRANCH}
template: deploy.celery.yaml
tag: ${DRONE_COMMIT}
trigger:
branch:
- deploy/*
image_pull_secrets:
- dockerconfig
# deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: sun-celery
release: sun-celery
name: sun-celery
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: sun-celery
release: sun-celery
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: sun-celery
release: sun-celery
spec:
containers:
- args:
- worker
- -A
- api
- -c8
- --loglevel=INFO
- --maxtasksperchild
- "500"
command:
- celery
image: ccr.ccs.tencentyun.com/gm-ai/like-sun:<IMAGE_TAG>
imagePullPolicy: Always
name: sun
imagePullSecrets:
- name: gm-secret
restartPolicy: Always
# service
apiVersion: v1
kind: Service
metadata:
name: sun
spec:
ports:
- name: tcp-80-80
port: 80
protocol: TCP
targetPort: 80
selector:
release: sun
sessionAffinity: None
type: ClusterIP
---
# deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: sun
release: sun
name: sun
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: sun
release: sun
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: sun
release: sun
spec:
containers:
- command:
- /bin/bash
- -c
- gunicorn sun.wsgi:application --bind=0.0.0.0:80 --workers=8 --worker-class=gevent
--worker-connections=1024 --timeout 600
image: ccr.ccs.tencentyun.com/gm-ai/like-sun:<IMAGE_TAG>
imagePullPolicy: Always
name: sun
ports:
- containerPort: 80
name: http
protocol: TCP
imagePullSecrets:
- name: gm-secret
restartPolicy: Always
FROM ccr.ccs.tencentyun.com/gm-ai/like-configs:prod as configs
FROM ccr.ccs.tencentyun.com/gm-ai/alpha-python:3.6
COPY --from=configs /etc/gm-config /etc/gm-config
RUN mkdir -p /data/log/sun/app
COPY ./requirements.txt /srv/apps/sun/
WORKDIR /srv/apps/sun/
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
COPY . .
ENV PROJECT_ENV=prod
COPY ./deploy/prod/settings_local.py ./sun/
CMD bash -c 'source ~/.bashrc && gunicorn sun.wsgi:application -w 4 -b 0.0.0.0:80 -k gevent'
SENTRY_CELERY_ENDPOINT = 'http://c976ba71bc454119a3ba4bfe79495976:944088e9c6fb4a21b2ecb555cc86ebbe@sentry.igengmei.com/137'
DEBUG = False
BROKER_URL = 'redis://:zi1jlhVHtH8MGNqB@172.17.40.145:6379/4'
CELERY_ACCEPT_CONTENT = ['pickle', 'json']
CELERY_TASK_SERIALIZER = 'pickle'
CELERY_RESULT_SERIALIZER = 'pickle'
\ No newline at end of file
FROM ccr.ccs.tencentyun.com/gm-ai/like-configs:stage as configs
FROM ccr.ccs.tencentyun.com/gm-ai/alpha-python:3.6
COPY --from=configs /etc/gm-config /etc/gm-config
RUN mkdir -p /data/log/sun/app
COPY ./requirements.txt /srv/apps/sun/
WORKDIR /srv/apps/sun/
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
COPY . .
ENV PROJECT_ENV=stage
COPY ./deploy/stage/settings_local.py ./sun/
CMD bash -c 'source ~/.bashrc && gunicorn sun.wsgi:application -w 4 -b 0.0.0.0:80 -k gevent'
SENTRY_CELERY_ENDPOINT = 'http://c976ba71bc454119a3ba4bfe79495976:944088e9c6fb4a21b2ecb555cc86ebbe@sentry.igengmei.com/137'
DEBUG = False
BROKER_URL = 'redis://:zi1jlhVHtH8MGNqB@172.17.40.145:6379/4'
CELERY_ACCEPT_CONTENT = ['pickle', 'json']
CELERY_TASK_SERIALIZER = 'pickle'
CELERY_RESULT_SERIALIZER = 'pickle'
\ No newline at end of file
FROM ccr.ccs.tencentyun.com/gm-ai/like-configs:test as configs
FROM ccr.ccs.tencentyun.com/gm-ai/alpha-python:3.6
COPY --from=configs /etc/gm-config /etc/gm-config
RUN mkdir -p /data/log/sun/app
COPY ./requirements.txt /srv/apps/sun/
WORKDIR /srv/apps/sun/
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
COPY . .
ENV PROJECT_ENV=test
COPY ./deploy/test/settings_local.py ./sun/
CMD bash -c 'source ~/.bashrc && gunicorn sun.wsgi:application -w 4 -b 0.0.0.0:80 -k gevent'
BROKER_URL = 'redis://:Gengmei123@172.21.52.8:6379/2'
CELERY_BROKER_URL = 'redis://:Gengmei123@172.21.52.8:6379/2'
CELERY_ACCEPT_CONTENT = ['pickle', 'json']
CELERY_TASK_SERIALIZER = 'pickle'
CELERY_RESULT_SERIALIZER = 'pickle'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment