Skip to content

Commit

Permalink
Merge pull request #48 from WeBankPartners/dev
Browse files Browse the repository at this point in the history
urlencode db password
  • Loading branch information
zgyzgyhero authored Nov 15, 2024
2 parents 077021e + db76ab1 commit 6bd8a38
Show file tree
Hide file tree
Showing 13 changed files with 21,070 additions and 137 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM python:3.7-slim
FROM python:3.8-slim-buster
LABEL maintainer = "Webank CTB Team"
# Install logrotate
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/deb.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list
# RUN apt update && apt -y install --no-install-recommends logrotate
# Copy logrotate configuration
# COPY build/logrotate.d/itsdangerous /etc/logrotate.d/
Expand All @@ -11,14 +11,15 @@ COPY requirements.txt /tmp/requirements.txt
COPY dist/* /tmp/
# Install && Clean up
RUN apt update && apt-get -y install gcc python3-dev swig libssl-dev && \
pip3 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r /tmp/requirements.txt && \
pip3 install -i http://mirrors.tencentyun.com/pypi/simple/ --trusted-host mirrors.tencentyun.com -r /tmp/requirements.txt && \
pip3 install /tmp/*.whl && \
rm -rf /root/.cache && apt autoclean && \
rm -rf /tmp/* /var/lib/apt/* /var/cache/* && \
apt purge -y `cat /var/log/apt/history.log|grep 'Install: '|tail -1| sed 's/Install://'| sed 's/\ /\n/g' | sed '/(/d' | sed '/)/d' | sed ':l;N;s/\n/ /;b l'`
# Use app:app to run gunicorn
RUN mkdir -p /etc/itsdangerous/
RUN mkdir -p /var/log/itsdangerous/
RUN mkdir -p /tmp/artifacts/
COPY etc /etc/itsdangerous
# RUN adduser --disabled-password app
# RUN chown -R app:app /etc/itsdangerous/
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clean:
build: clean
pip3 install wheel
python3 setup.py bdist_wheel
cd ui && npm --registry https://registry.npm.taobao.org install --unsafe-perm
cd ui && npm --registry https://mirrors.cloud.tencent.com/npm/ install --unsafe-perm
cd ui && npm rebuild node-sass
cd ui && npm run plugin

Expand Down
3 changes: 2 additions & 1 deletion build/register.xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<!-- 4.系统参数 - 描述运行本插件包需要的系统参数 -->
<systemParameters>
<systemParameter name="ITSDANGEROUS_LOG_LEVEL" scopeType="plugins" defaultValue="info" />
<systemParameter name="ITSDANGEROUS_CACHE_CLEANUP_INTERVAL_MIN" scopeType="plugins" defaultValue="10" />
</systemParameters>

<!-- 5.权限设定 -->
Expand All @@ -27,7 +28,7 @@

<!-- 6.运行资源 - 描述部署运行本插件包需要的基础资源(如主机、虚拟机、容器、数据库等) -->
<resourceDependencies>
<docker imageName="{{IMAGENAME}}" containerName="{{CONTAINERNAME}}" portBindings="{{ALLOCATE_PORT}}:9000" volumeBindings="/etc/localtime:/etc/localtime,{{BASE_MOUNT_PATH}}/itsdangerous/logs:/var/log/itsdangerous,{{BASE_MOUNT_PATH}}/certs:/certs" envVariables="ITSDANGEROUS_DB_USERNAME={{DB_USER}},ITSDANGEROUS_DB_PASSWORD={{DB_PWD}},ITSDANGEROUS_DB_HOSTIP={{DB_HOST}},ITSDANGEROUS_DB_HOSTPORT={{DB_PORT}},ITSDANGEROUS_DB_SCHEMA={{DB_SCHEMA}},GATEWAY_URL={{GATEWAY_URL}},JWT_SIGNING_KEY={{JWT_SIGNING_KEY}},WECUBE_S3_ACCESS_KEY={{S3_ACCESS_KEY}},WECUBE_S3_SECRET_KEY={{S3_SECRET_KEY}},SUB_SYSTEM_CODE={{SUB_SYSTEM_CODE}},SUB_SYSTEM_KEY={{SUB_SYSTEM_KEY}},ITSDANGEROUS_LOG_LEVEL={{ITSDANGEROUS_LOG_LEVEL}}" />
<docker imageName="{{IMAGENAME}}" containerName="{{CONTAINERNAME}}" portBindings="{{ALLOCATE_PORT}}:9000" volumeBindings="{{BASE_MOUNT_PATH}}/itsdangerous/cachedir:/tmp/artifacts,/etc/localtime:/etc/localtime,{{BASE_MOUNT_PATH}}/itsdangerous/logs:/var/log/itsdangerous,{{BASE_MOUNT_PATH}}/certs:/certs" envVariables="ITSDANGEROUS_DB_USERNAME={{DB_USER}},ITSDANGEROUS_DB_PASSWORD={{DB_PWD}},ITSDANGEROUS_DB_HOSTIP={{DB_HOST}},ITSDANGEROUS_DB_HOSTPORT={{DB_PORT}},ITSDANGEROUS_DB_SCHEMA={{DB_SCHEMA}},GATEWAY_URL={{GATEWAY_URL}},JWT_SIGNING_KEY={{JWT_SIGNING_KEY}},WECUBE_S3_ACCESS_KEY={{S3_ACCESS_KEY}},WECUBE_S3_SECRET_KEY={{S3_SECRET_KEY}},SUB_SYSTEM_CODE={{SUB_SYSTEM_CODE}},SUB_SYSTEM_KEY={{SUB_SYSTEM_KEY}},ITSDANGEROUS_LOG_LEVEL={{ITSDANGEROUS_LOG_LEVEL}},ITSDANGEROUS_CACHE_CLEANUP_INTERVAL_MIN={{ITSDANGEROUS_CACHE_CLEANUP_INTERVAL_MIN}}" />
<mysql schema="itsdangerous" initFileName="init.sql" upgradeFileName="upgrade.sql" />
</resourceDependencies>

Expand Down
4 changes: 3 additions & 1 deletion etc/wecube_plugins_itsdangerous.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"sub_system_code": "ENV@SUB_SYSTEM_CODE",
"sub_system_key": "ENV@SUB_SYSTEM_KEY",
"platform_timezone": "ENV@TZ",
"log_level": "ENV@ITSDANGEROUS_LOG_LEVEL"
"log_level": "ENV@ITSDANGEROUS_LOG_LEVEL",
"cache_cleanup_interval_min": "ENV@ITSDANGEROUS_CACHE_CLEANUP_INTERVAL_MIN"
},
"log": {
"gunicorn_access": "/var/log/itsdangerous/access.log",
Expand Down Expand Up @@ -58,6 +59,7 @@
"global_limits": null
},
"pakcage_cache_dir": "/tmp/artifacts/",
"pakcage_cache_cleanup_interval_min": "${cache_cleanup_interval_min}",
"wecube": {
"s3": {
"access_key": "${s3_access_key}",
Expand Down
Loading

0 comments on commit 6bd8a38

Please sign in to comment.