diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8af186f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +#Author:YANCHAO +FROM centos +MAINTAINER yanchao@jieyuechina.com +ENV EZ_DIR=/opt/ +ENV PROJECT_DIR=/opt/PWM +ENV PIP_DIR=/opt/pip-19.1.1 +ENV CONSUL_IP="10.50.182.65" +ENV MONTIOR_REDIS="10.50.182.65" +ENV ALERTMANAGER_HTTP="10.50.182.65:9093" +ADD PWM.tar.gz /opt/ +ADD 19.1.1.tar.gz /opt/ +ADD ez_setup.py /opt/ +ADD install.sh /opt/ +WORKDIR $EZ_DIR +RUN python ez_setup.py +WORKDIR $PIP_DIR +RUN python setup.py install +WORKDIR $PROJECT_DIR +RUN pip install -r requirements.txt +RUN python manage.py makemigrations +RUN python manage.py migrate +RUN chmod +x /opt/install.sh +EXPOSE 888 +#CMD ["python manage.py runserver 0.0.0.0:888"] +#ENTRYPOINT ["/bin/bash","-c"] +ENTRYPOINT /opt/install.sh ${CONSUL_IP} ${MONTIOR_REDIS} ${ALERTMANAGER_HTTP} diff --git a/PWM/settings.py b/PWM/settings.py index bef014e..56cf2d1 100644 --- a/PWM/settings.py +++ b/PWM/settings.py @@ -200,15 +200,15 @@ CONSUL_PROMETHEUS_RULES_DIR = 'prometheus-rules' CONSUL_ALERTMANAGER_DIR = 'alertmanager-config' -SMS_URL = 'http://172.18.100.168:20019/esbsmstrue/api/sms/general/send' -SENDMAIL_SMTP = 'smtp.jieyuechina.com:25' -SENDMAIL_SENDER = 'chaoyan1@jieyuechina.com' -SENDMAIL_SENDER_PASSWORD = 'Chinayc19880510#' +SMS_URL = '' +SENDMAIL_SMTP = '' +SENDMAIL_SENDER = '' +SENDMAIL_SENDER_PASSWORD = '' MONTIOR_REDIS = '10.50.182.65' MONTIOR_PORT = 6379 -WX_URL = 'http://outrel.jieyue.com/outrel/api/externalplatform/interfaceRest/extInterface/v2' +WX_URL = '' ALERTMANAGER_HTTP = 'http://10.50.182.65:9093' ALERTMANAGER_SILENCES_URI = '/api/v2/silences' diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..85fe65c --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +#!/bin/bash +BASE_DIR=/opt/PWM + +cd $BASE_DIR && sed -i '/CONSUL_IP/d' PWM/settings.py +cd $BASE_DIR && echo "CONSUL_IP = '$1'" >> PWM/settings.py + +cd $BASE_DIR && sed -i '/MONTIOR_REDIS/d' PWM/settings.py +cd $BASE_DIR && echo "MONTIOR_REDIS = '$2'" >> PWM/settings.py + +cd $BASE_DIR && sed -i 's/10.50.182.65:9093/'$3'/g' PWM/settings.py + +cd $BASE_DIR && python manage.py runserver 0.0.0.0:888 diff --git a/monitor/utils/police.py b/monitor/utils/police.py index 0603e1d..8d32303 100644 --- a/monitor/utils/police.py +++ b/monitor/utils/police.py @@ -168,7 +168,7 @@ def wx(self,data): "sysCode": "weChat", "funcType": "weChat", "funcPointType": "skynetEarlyWarning", - "frontTransNo": "Q1001F3D7BB211111afgdsafs1", + "frontTransNo": "", "frontTransTime": time1, "interfaceNo": "skynetEarlyWarning", "prod": "weChat", @@ -182,4 +182,4 @@ def wx(self,data): } } r = requests.post(settings.WX_URL, headers=headers,data=json.dumps(data),verify=False) - return 'ok' \ No newline at end of file + return 'ok' diff --git a/requirements.txt b/requirements.txt index 49dac4d..337ac88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,33 +5,21 @@ decorator==3.4.0 Django==1.11.22 django-cors-headers==3.0.2 djangorestframework==3.9.4 -futures==3.2.0 grpc==0.3.post19 idna==2.8 iniparse==0.4 IPy==0.75 kitchen==1.1.1 msgpack-python==0.5.6 -perf==0.1 -policycoreutils-default-encoding==0.1 prometheus-client==0.6.0 pycurl==7.19.0 pygobject==3.22.0 pygpgme==0.3 pyliblzma==0.5.3 python-consul==1.1.0 -python-linux-procfs==0.4.9 pytz==2019.1 pyudev==0.15 pyxattr==0.5.1 redis==3.3.2 requests==2.22.0 -schedutils==0.4 -seobject==0.1 -sepolicy==1.1 -six==1.12.0 -slip==0.4.0 -slip.dbus==0.4.0 -urlgrabber==3.10 urllib3==1.25.3 -yum-metadata-parser==1.1.4