diff --git a/.devops/REPO流水线.yml b/.devops/REPO流水线.yml new file mode 100644 index 000000000..45341c20c --- /dev/null +++ b/.devops/REPO流水线.yml @@ -0,0 +1,68 @@ +version: 2 +name: REPO流水线 +description: 取消了自动触发,手动触发,有时候网络可能不好,镜像那里需要重试。 +global: + concurrent: 1 +trigger: + webhook: gitlink@1.0.0 + event: + - ref: push + ruleset: + - param-ref: branch + operator: EQ + value: '"develop"' + ruleset-operator: AND +workflow: + - ref: start + name: 开始 + task: start + - ref: end + name: 结束 + task: end + needs: + - ssh_cmd_0 + - ref: git_clone_0 + name: git clone + task: git_clone@1.2.9 + input: + remote_url: '"https://gitlink.org.cn/Eazzy/reposync.git"' + ref: '"refs/heads/develop"' + commit_id: '""' + depth: 1 + needs: + - start + - ref: docker_image_build_0 + name: docker镜像构建 + task: docker_image_build@1.6.0 + input: + docker_username: ((docker.username)) + docker_password: ((docker.key)) + image_name: '"registry.cn-guangzhou.aliyuncs.com/nudt_devops/reposync_eazzy"' + image_tag: '"latest"' + registry_address: '"registry.cn-guangzhou.aliyuncs.com"' + docker_file: '"Dockerfile"' + docker_build_path: '"."' + workspace: git_clone_0.git_path + image_push: true + build_args: '""' + needs: + - git_clone_0 + - ref: ssh_cmd_0 + name: ssh执行命令 + task: ssh_cmd@1.1.1 + input: + ssh_pass: ((ssh.key)) + ssh_ip: '"121.43.168.217"' + ssh_port: '"22"' + ssh_user: '"root"' + ssh_cmd: "\"docker stop reposyncer_app && docker rm reposyncer_app && docker + pull + registry.cn-guangzhou.aliyuncs.com/nudt_devops/reposync_eazzy:latest && + docker run -it -d -e CEROBOT_MYSQL_HOST='121.43.168.217' -e + CEROBOT_MYSQL_PORT=3306 -e CEROBOT_MYSQL_USER=root -e + CEROBOT_MYSQL_PWD='Zcq123456.' -e CEROBOT_MYSQL_DB='repo' -e + BOOT_MODE='app' -p 8089:8000 --name reposyncer_app + registry.cn-guangzhou.aliyuncs.com/nudt_devops/reposync_eazzy:latest\"" + needs: + - docker_image_build_0 + diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..26d33521a --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..d56657add --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..0226e89ac --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/reposync.iml b/.idea/reposync.iml new file mode 100644 index 000000000..8b8c39547 --- /dev/null +++ b/.idea/reposync.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 24a7ae2bd..c91eaca28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,11 @@ RUN cd /data/ob-tool && tar xzf Python-3.9.6.tgz RUN cd /data/ob-tool/Python-3.9.6 && ./configure --enable-optimizations && make altinstall ADD ./ /data/ob-robot/ -RUN cd /data/ob-robot/ && \ +RUN wget https://github.com/encode/uvicorn/archive/refs/tags/0.14.0.tar.gz && \ + tar -zvxf 0.14.0.tar.gz && \ + cd uvicorn-0.14.0 && \ + pip3.9 install . && \ + cd /data/ob-robot/ && \ pip3.9 install -r /data/ob-robot/requirement.txt RUN yum install -y git openssh-server @@ -21,7 +25,8 @@ RUN yum install -y autoconf gettext && \ make configure && \ ./configure --prefix=/usr && \ make -j16 && \ - make install - + make install + + WORKDIR /data/ob-robot CMD if [ "$BOOT_MODE" = "app" ] ; then python3.9 main.py; fi diff --git a/main.py b/main.py index 990b276be..2137653ad 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,7 @@ app.include_router(LOG) app.include_router(AUTH) app.include_router(SYNC_CONFIG) -app.mount("/", StaticFiles(directory="web/dist"), name="static") +# app.mount("/", StaticFiles(directory="web/dist"), name="static") if __name__ == '__main__': # workers 参数仅在命令行使用uvicorn启动时有效 或使用环境变量 WEB_CONCURRENCY diff --git a/src/base/config.py b/src/base/config.py index d930e9a1e..d96c00abf 100644 --- a/src/base/config.py +++ b/src/base/config.py @@ -33,11 +33,11 @@ buc_key and ConfigsUtil.set_obfastapi_config('buc_key', buc_key) DB_ENV = getenv('DB_ENV', 'test_env') DB = { 'test_env': { - 'host': getenv('CEROBOT_MYSQL_HOST', ''), - 'port': getenv('CEROBOT_MYSQL_PORT', 2883, int), - 'user': getenv('CEROBOT_MYSQL_USER', ''), - 'passwd': getenv('CEROBOT_MYSQL_PWD', ''), - 'dbname': getenv('CEROBOT_MYSQL_DB', '') + 'host': getenv('CEROBOT_MYSQL_HOST', '8.134.99.218'), + 'port': getenv('CEROBOT_MYSQL_PORT', 3306, int), + 'user': getenv('CEROBOT_MYSQL_USER', 'root'), + 'passwd': getenv('CEROBOT_MYSQL_PWD', '951623847'), + 'dbname': getenv('CEROBOT_MYSQL_DB', 'reposyncer') }, 'local': { 'host': getenv('CEROBOT_MYSQL_HOST', ''), diff --git a/src/do/account.py b/src/do/account.py index 17a5121d6..ae2984738 100644 --- a/src/do/account.py +++ b/src/do/account.py @@ -10,8 +10,8 @@ class GithubAccountDO(DataObject): account = Column(String(20)) email = Column(String(20)) create_time = Column(DateTime) - update_time = Column(DateTime) + update_time = Column(DateTime) class GiteeAccountDO(DataObject): __tablename__ = 'gitee_account'