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

Merge branch 'refactor' into 'master'

调整CICD

See merge request !585
parents c4f49827 9dd3ec57
Pipeline #4802 passed with stage
kind: pipeline
name: like-physical
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-physical
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-physical
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-physical
tags:
- ${DRONE_COMMIT}
- name: deploy-app
image: ccr.ccs.tencentyun.com/gm-ai/drone-kube:pre
environment:
repo: alpha/physical
when:
instance:
exclude:
- aidrone.iyanzhi.com
settings:
namespace: ${DRONE_BRANCH}
template: deploy.yaml
tag: ${DRONE_COMMIT}
trigger:
branch:
- deploy/*
image_pull_secrets:
- dockerconfig
...@@ -59,7 +59,7 @@ docs/_build/ ...@@ -59,7 +59,7 @@ docs/_build/
fabfile.py fabfile.py
settings.online.py settings.online.py
/gaia/settings.py /gaia/settings.py
settings_local.py /physical/settings_local.py
media/ media/
log/ log/
crawldata/ crawldata/
......
# service
apiVersion: v1
kind: Service
metadata:
name: physical
spec:
ports:
- name: tcp-80-80
port: 80
protocol: TCP
targetPort: 80
selector:
release: physical
sessionAffinity: None
type: ClusterIP
---
# deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: physical
release: physical
name: physical
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: physical
release: physical
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: physical
release: physical
spec:
containers:
- command:
- /bin/bash
- -c
- gunicorn gm_rpcd.wsgi:application --bind=0.0.0.0:80 --workers=16 --worker-class=gevent
--worker-connections=1024 --timeout 600 --chdir /srv/apps/physical/
image: ccr.ccs.tencentyun.com/gm-ai/like-physical:<IMAGE_TAG>
imagePullPolicy: Always
name: physical
ports:
- containerPort: 80
name: http
protocol: TCP
imagePullSecrets:
- name: gm-secret
restartPolicy: Always
\ No newline at end of file
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/physical/app
COPY ./requirements.txt /srv/apps/physical/
WORKDIR /srv/apps/physical/
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
COPY . .
ENV GM_RPCD_DEPLOY_CONF_PATH="/srv/apps/physical/app_conf.xml"
ENV PROJECT_ENV=prod
COPY ./deploy/prod/app_conf.xml .
COPY ./deploy/prod/settings_local.py ./settings/
CMD bash -c 'source ~/.bashrc && gunicorn physical.wsgi:application --workers=8 --worker-class=gevent --worker-connections=1024 --bind=0.0.0.0:80 --timeout 600 --log-level=debug--error-logfile=/data/log/physical/app/gunicorn_error.log --access-logfile=/data/log/physical/app/gunicorn_access.log'
<?xml version="1.0" encoding="utf-8"?>
<gm_rpcd_config>
<info config_name="app" version="1.0"/>
<config name="log_dir" value="/data/log/physical/app"/>
<config name="application_name" value="physical"/>
<config name="service_list">
<element value="physical"/>
</config>
<config name="initializer_list">
<element value="physical.django_init"/>
<element value="search.views.topic"/>
<element value="search.views.business_topic"/>
<element value="search.views.pick"/>
<element value="search.views.group"/>
<element value="search.views.user"/>
<element value="search.views.tag"/>
<element value="search.views.contrast_similar"/>
<element value="injection.data_sync.tasks"/>
<element value="search.views.contrast_similar"/>
<element value="search.views.search_hotword"/>
<element value="search.views.product"/>
</config>
</gm_rpcd_config>
\ No newline at end of file
# coding=utf-8
import os
from datetime import timedelta
# from log_settings import *
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '^j3sg)sj8rc@du74%fb$c2926tv!!4g(kp-=rx1)c5!1&1(dq='
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = []
SENTRY_CELERY_ENDPOINT = "http://60b0004c8884420f8067fb32fc3ed244:20f97fc73ffa4aad9735d0e6542a6d78@sentry.igengmei.com/140"
RAVEN_CONFIG = {
'dsn': 'http://60b0004c8884420f8067fb32fc3ed244:20f97fc73ffa4aad9735d0e6542a6d78@sentry.igengmei.com/140'
}
# Application definition
BROKER_URL = "redis://:gHtmeIqBhVHtH8MG@172.17.40.140:6379/8"
CELERY_BROKER_URL = "redis://:gHtmeIqBhVHtH8MG@172.17.40.140:6379/8"
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_ROUTES = ['physical.celery_task_router.CeleryTaskRouter']
DATABASE_ROUTERS = ['physical.DBRouter.DBRouter']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'raven.contrib.django.raven_compat',
'trans2es',
'search',
'injection.data_sync'
]
CELERYBEAT_SCHEDULE = {
'sync_face_similar_data_to_redis': {
'task': 'injection.data_sync.tasks.sync_face_similar_data_to_redis',
'schedule': timedelta(seconds=120),
'args': ()
},
'set_tag_count': {
'task': 'injection.data_sync.tasks.get_tag_count',
'schedule': timedelta(seconds=120),
'args': ()
},
}
ROOT_URLCONF = 'physical.urls'
WSGI_APPLICATION = 'physical.wsgi.application'
REDIS_URL = "redis://:gHtmeIqBhVHtH8MG@172.17.40.140:6379/1"
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
LOGIN_URL = "http://earth.iyanzhi.com/api/account/login_pwd"
AUTO_CLICK_URL = "http://earth.iyanzhi.com/api/v1/like"
AUTO_VOTE_URL = "http://earth.iyanzhi.com/api/v1/ballot"
AUTO_REPLY_URL = "http://earth.iyanzhi.com/api/v1/reply/create"
AUTO_FOLLOW_URL = "http://earth.iyanzhi.com/api/v1/follow"
AUTO_URGE_URL = "http://earth.iyanzhi.com/api/v1/user/urge"
AUTO_INNER_REPLY_URL = "http://saturn.iyanzhi.com/api/v1/reply/create_for_inner"
SERVICE_NAME = "线上"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.144',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'master': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.141',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'slave': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.144',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'slave1': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.147',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'slave2': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.163',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'face': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'face',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.141',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'commodity': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'commodity',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.144',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
}
ES_INFO_LIST = [
{
"host": "172.17.32.22",
"port": 9200
},
{
"host": "172.17.32.25",
"port": 9200
},
{
"host": "172.17.32.19",
"port": 9200
},
{
"host": "172.17.32.32",
"port": 9200
},
{
"host": "172.17.32.47",
"port": 9200
},
{
"host": "172.17.32.18",
"port": 9200
},
{
"host": "172.17.32.39",
"port": 9200
},
{
"host": "172.17.32.23",
"port": 9200
}
]
TAG_ES_INFO_LIST = [
{
"host": "172.17.32.27",
"port": 9200
}
]
KAFKA_BROKER_LIST = "172.17.32.49:9092,172.17.32.46:9092,172.17.32.58:9092"
KAFKA_TOPIC_NAME = "gm-maidian-data"
KAFKA_GM_LOGGING_TOPIC_NAME = "gm-logging-prod"
SLAVE_DB_NAME = 'slave'
SLAVE1_DB_NAME = 'slave1'
\ 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/physical/app
COPY ./requirements.txt /srv/apps/physical/
WORKDIR /srv/apps/physical/
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
COPY . .
ENV GM_RPCD_DEPLOY_CONF_PATH="/srv/apps/physical/app_conf.xml"
ENV PROJECT_ENV=stage
COPY ./deploy/stage/app_conf.xml .
COPY ./deploy/stage/settings_local.py ./settings/
CMD bash -c 'source ~/.bashrc && gunicorn physical.wsgi:application --workers=8 --worker-class=gevent --worker-connections=1024 --bind=0.0.0.0:80 --timeout 600 --log-level=debug--error-logfile=/data/log/physical/app/gunicorn_error.log --access-logfile=/data/log/physical/app/gunicorn_access.log'
<?xml version="1.0" encoding="utf-8"?>
<gm_rpcd_config>
<info config_name="app" version="1.0"/>
<config name="log_dir" value="/data/log/physical/app"/>
<config name="application_name" value="physical"/>
<config name="service_list">
<element value="physical"/>
</config>
<config name="initializer_list">
<element value="physical.django_init"/>
<element value="search.views.topic"/>
<element value="search.views.business_topic"/>
<element value="search.views.pick"/>
<element value="search.views.group"/>
<element value="search.views.user"/>
<element value="search.views.tag"/>
<element value="search.views.contrast_similar"/>
<element value="injection.data_sync.tasks"/>
<element value="search.views.contrast_similar"/>
<element value="search.views.search_hotword"/>
<element value="search.views.product"/>
</config>
</gm_rpcd_config>
\ No newline at end of file
# coding=utf-8
import os
from datetime import timedelta
# from log_settings import *
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '^j3sg)sj8rc@du74%fb$c2926tv!!4g(kp-=rx1)c5!1&1(dq='
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = []
SENTRY_CELERY_ENDPOINT = "http://60b0004c8884420f8067fb32fc3ed244:20f97fc73ffa4aad9735d0e6542a6d78@sentry.igengmei.com/140"
RAVEN_CONFIG = {
'dsn': 'http://60b0004c8884420f8067fb32fc3ed244:20f97fc73ffa4aad9735d0e6542a6d78@sentry.igengmei.com/140'
}
# Application definition
BROKER_URL = "redis://:gHtmeIqBhVHtH8MG@172.17.40.140:6379/8"
CELERY_BROKER_URL = "redis://:gHtmeIqBhVHtH8MG@172.17.40.140:6379/8"
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_ROUTES = ['physical.celery_task_router.CeleryTaskRouter']
DATABASE_ROUTERS = ['physical.DBRouter.DBRouter']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'raven.contrib.django.raven_compat',
'trans2es',
'search',
'injection.data_sync'
]
CELERYBEAT_SCHEDULE = {
'sync_face_similar_data_to_redis': {
'task': 'injection.data_sync.tasks.sync_face_similar_data_to_redis',
'schedule': timedelta(seconds=120),
'args': ()
},
'set_tag_count': {
'task': 'injection.data_sync.tasks.get_tag_count',
'schedule': timedelta(seconds=120),
'args': ()
},
}
ROOT_URLCONF = 'physical.urls'
WSGI_APPLICATION = 'physical.wsgi.application'
REDIS_URL = "redis://:gHtmeIqBhVHtH8MG@172.17.40.140:6379/1"
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
LOGIN_URL = "http://earth.iyanzhi.com/api/account/login_pwd"
AUTO_CLICK_URL = "http://earth.iyanzhi.com/api/v1/like"
AUTO_VOTE_URL = "http://earth.iyanzhi.com/api/v1/ballot"
AUTO_REPLY_URL = "http://earth.iyanzhi.com/api/v1/reply/create"
AUTO_FOLLOW_URL = "http://earth.iyanzhi.com/api/v1/follow"
AUTO_URGE_URL = "http://earth.iyanzhi.com/api/v1/user/urge"
AUTO_INNER_REPLY_URL = "http://saturn.iyanzhi.com/api/v1/reply/create_for_inner"
SERVICE_NAME = "线上"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.144',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'master': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.141',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'slave': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.144',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'slave1': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.147',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'slave2': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.163',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'face': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'face',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.141',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'commodity': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'commodity',
'USER': 'work',
'PASSWORD': 'oars152!traipseize738',
'HOST': '172.17.40.144',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
}
ES_INFO_LIST = [
{
"host": "172.17.32.22",
"port": 9200
},
{
"host": "172.17.32.25",
"port": 9200
},
{
"host": "172.17.32.19",
"port": 9200
},
{
"host": "172.17.32.32",
"port": 9200
},
{
"host": "172.17.32.47",
"port": 9200
},
{
"host": "172.17.32.18",
"port": 9200
},
{
"host": "172.17.32.39",
"port": 9200
},
{
"host": "172.17.32.23",
"port": 9200
}
]
TAG_ES_INFO_LIST = [
{
"host": "172.17.32.27",
"port": 9200
}
]
KAFKA_BROKER_LIST = "172.17.32.49:9092,172.17.32.46:9092,172.17.32.58:9092"
KAFKA_TOPIC_NAME = "gm-maidian-data"
KAFKA_GM_LOGGING_TOPIC_NAME = "gm-logging-prod"
SLAVE_DB_NAME = 'slave'
SLAVE1_DB_NAME = 'slave1'
\ 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/physical/app
COPY ./requirements.txt /srv/apps/physical/
WORKDIR /srv/apps/physical/
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
COPY . .
ENV GM_RPCD_DEPLOY_CONF_PATH="/srv/apps/physical/app_conf.xml"
ENV PROJECT_ENV=test
COPY ./deploy/test/app_conf.xml .
COPY ./deploy/test/settings_local.py ./settings/
CMD bash -c 'source ~/.bashrc && gunicorn physical.wsgi:application --workers=8 --worker-class=gevent --worker-connections=1024 --bind=0.0.0.0:80 --timeout 600 --log-level=debug--error-logfile=/data/log/physical/app/gunicorn_error.log --access-logfile=/data/log/physical/app/gunicorn_access.log'
<?xml version="1.0" encoding="utf-8"?>
<gm_rpcd_config>
<info config_name="app" version="1.0"/>
<config name="log_dir" value="/data/log/physical/app"/>
<config name="application_name" value="physical"/>
<config name="service_list">
<element value="physical"/>
</config>
<config name="initializer_list">
<element value="physical.django_init"/>
<element value="search.views.topic"/>
<element value="search.views.business_topic"/>
<element value="search.views.pick"/>
<element value="search.views.group"/>
<element value="search.views.user"/>
<element value="search.views.tag"/>
<element value="search.views.contrast_similar"/>
<element value="injection.data_sync.tasks"/>
<element value="search.views.contrast_similar"/>
<element value="search.views.search_hotword"/>
<element value="search.views.product"/>
</config>
</gm_rpcd_config>
\ No newline at end of file
# coding=utf-8
import os
# from log_settings import *
from datetime import timedelta
from celery.schedules import crontab
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '^j3sg)sj8rc@du74%fb$c2926tv!!4g(kp-=rx1)c5!1&1(dq='
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = []
# Application definition
SENTRY_CELERY_ENDPOINT = "http://45b0ef6a79204d6988b59c32c9dd4bef:fa018677fb4f49be88d2ba61cdc7ee32@sentry.igengmei.com/135"
BROKER_URL = "redis://:Gengmei123@172.21.52.16:6379/8"
# CELERY_SEND_EVENTS = True
# CELERY_SEND_TASK_SENT_EVENT = True
#
# CELERY_DEFAULT_EXCHANGE = 'celery'
# CELERY_DEFAULT_EXCHANGE_TYPE = 'direct'
# CELERY_DEFAULT_ROUTING_KEY = 'celery'
#
# CELERY_QUEUES = {
# 'celery': {
# 'exchange': CELERY_DEFAULT_EXCHANGE,
# 'routing_key': CELERY_DEFAULT_ROUTING_KEY,
# },
# 'order': {
# 'exchange': 'order',
# 'routing_key': 'order',
# },
# }
LOGIN_URL = "http://earth.gmapp.env/api/account/login_pwd"
AUTO_CLICK_URL = "http://earth.gmapp.env/api/v1/like"
AUTO_VOTE_URL = "http://earth.gmapp.env/api/v1/ballot"
AUTO_REPLY_URL = "http://earth.gmapp.env/api/v1/reply/create"
AUTO_FOLLOW_URL = "http://earth.gmapp.env/api/v1/follow"
AUTO_URGE_URL = "http://earth.gmapp.env/api/v1/user/urge"
SERVICE_NAME = "测试"
AUTO_INNER_REPLY_URL = "http://saturn.iyanzhi.com/api/v1/reply/create_for_inner"
CELERY_BROKER_URL = "redis://:Gengmei123@172.21.52.16:6379/8"
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_ROUTES = ['physical.celery_task_router.CeleryTaskRouter']
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'trans2es',
'search',
'injection.data_sync',
)
CELERYBEAT_SCHEDULE = {
'sync_face_similar_data_to_redis': {
'task': 'injection.data_sync.tasks.sync_face_similar_data_to_redis',
'schedule': timedelta(seconds=120),
'args': ()
},
'set_tag_count': {
'task': 'injection.data_sync.tasks.get_tag_count',
'schedule': timedelta(seconds=1),
'args': ()
},
}
"""
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
"""
ROOT_URLCONF = 'physical.urls'
WSGI_APPLICATION = 'physical.wsgi.application'
DATABASE_ROUTERS = ['physical.DBRouter.DBRouter']
REDIS_URL = "redis://:Gengmei123@172.21.52.16:6379"
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.16',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'master': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'alpha',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.6',
'PORT': '3306',
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'face': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'face',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.16',
'PORT': '3306',
# 'CONN_MAX_AGE': None,
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
},
'commodity': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'commodity',
'USER': 'work',
'PASSWORD': 'Gengmei123!',
'HOST': '172.21.36.16',
'PORT': '3306',
# 'CONN_MAX_AGE': None,
'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4",
},
}
}
ES_INFO_LIST = [
{
"host": "172.21.40.14",
"port": 9200
}
]
TAG_ES_INFO_LIST = [
{
"host": "172.21.40.14",
"port": 9200
}
]
# KAFKA_BROKER_LIST = "192.168.13.114:9092,192.168.13.116:9092,192.168.13.115:9092"
# KAFKA_TOPIC_NAME = "alpha-maidian-data"
KAFKA_BROKER_LIST = "172.21.40.14:9092"
KAFKA_TOPIC_NAME = "gm-maidian-data"
KAFKA_GM_LOGGING_TOPIC_NAME = "gm-logging-test"
ES_INDEX_PREFIX = "gm-dbmw"
SLAVE_DB_NAME = 'default'
SLAVE1_DB_NAME = 'default'
MASTER_DB_NAME = 'master'
MIDDLEWARE_CLASSES = (
'gm_tracer.middleware.TracerMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'helios.DjangoL5dMiddleware',
)
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
# LANGUAGE_CODE = 'en-us'
#
TIME_ZONE = 'Asia/Shanghai'
#
USE_I18N = True
USE_L10N = True
#
# USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
CACHE_SECONDS = 60 * 60 * 24 * 2
REDIS_HOST = '172.21.52.16'
REDIS_PW = 'Gengmei123'
REDIS_TOPIC = {
'reply_cache': {'host': REDIS_HOST, 'port': 6379, 'db': 9, 'password': REDIS_PW},
'follow_cache': {'host': REDIS_HOST, 'port': 6379, 'db': 10, 'password': REDIS_PW},
'click_cache': {'host': REDIS_HOST, 'port': 6379, 'db': 11, 'password': REDIS_PW},
}
\ 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