Casper 2 месяцев назад
Родитель
Сommit
c54480211c

+ 24 - 0
sri-server-bg01/1.txt

@@ -0,0 +1,24 @@
+# --- for base ---
+cython==3.0.0a9
+pyinstaller==4.10
+# --- for libraries ---
+pycrypto==2.6.1
+paramiko==2.7.2
+apscheduler==3.7.0
+# --- for client ---
+requests==2.25.1
+redis==3.5.3
+pymongo==3.11.2
+influxdb==5.3.1
+pymysql==0.9.3
+peewee==3.17.0
+SQLAlchemy==1.4.30
+# --- for server ---
+aiofiles==23.2.1
+python-multipart==0.0.6
+starlette==0.32.0
+fastapi==0.108.0
+fastapi-login==1.9.2
+uvicorn==0.13.3
+werkzeug==3.0.1
+itsdangerous==1.1.0

+ 3 - 0
sri-server-bg01/README-usage-win.bash

@@ -0,0 +1,3 @@
+## USAGE
+
+pip install -r 1.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

+ 1 - 1
sri-server-bg01/README-usage.bash

@@ -1,4 +1,4 @@
-## NOTE
+## USAGE
 
 # 一、构建操作
 # 构建启动

+ 0 - 125
sri-server-bg01/README-usage.md

@@ -1,125 +0,0 @@
-#### usage
-```
-sudo docker restart fra-component-interface && sudo docker logs -f fra-component-interface
-```
-```
-# --- 试运行 ---
-echo "Test-Run-And-Check-Build:" \
-&& project_path="/home/server/projects/taiwuict/cscec-8bur-vms/component-interface" \
-&& cd ${project_path} \
-&& sudo docker-compose --file compose_test.yml down \
-&& sudo docker-compose --file compose_test.yml up --detach --build \
-&& sudo docker logs --follow test-component-interface
-```
-```
-# --- 试运行 ---
-echo "Test-Run-And-Check-Build:" \
-&& project_path="/home/server/projects/taiwuict/cscec-8bur-vms/component-interface" \
-&& cd ${project_path} \
-&& sudo docker-compose --file compose_test.yml down \
-&& sudo docker-compose --file compose_test.yml up --detach --build \
-&& sudo docker exec -it test-component-interface bash
-```
-```
-# --- 试运行 ---
-echo "Test-Run:" \
-&& project_path="/home/server/projects/taiwuict/cscec-8bur-vms/component-interface" \
-&& cd ${project_path} \
-&& sudo docker-compose --file compose_test.yml down \
-&& sudo docker-compose --file compose_test.yml up --detach \
-&& sudo docker-compose --file compose_test.yml logs --follow
-```
-```
-# --- 打包方式运行(压缩) ---
-echo "Wrap-Application:" \
-&& sudo docker rm -f fra-component-interface \
-&& sudo docker run \
-    --tty \
-    --env TZ=Asia/Shanghai \
-    --volume /home:/home \
-    --publish 8891:8000 \
-    --network node_network \
-    --name fra-component-interface \
-    fra-component-interface:u20 \
-    /bin/bash /home/server/projects/taiwuict/cscec-8bur-vms/component-interface/run-exe-wrap.sh
-```
-```
-# --- 打包方式运行(测试) ---
-echo "Run-Test:" \
-&& sudo docker rm -f fra-component-interface \
-&& sudo docker run \
-    --tty \
-    --env TZ=Asia/Shanghai \
-    --volume /home:/home \
-    --publish 8891:8000 \
-    --network node_network \
-    --name fra-component-interface \
-    ubuntu:20.04 \
-    /bin/bash /home/server/projects/taiwuict/cscec-8bur-vms/component-interface/run-exe.sh
-```
-```
-# --- 构建镜像并上传镜像仓库(构建) ---
-echo "step-1: 收集代码" \
-&& project_path="/home/server/projects/taiwuict/cscec-8bur-vms" \
-&& cd ${project_path} \
-&& sudo rm -rf build \
-&& sudo mkdir build \
-&& cd build \
-&& sudo cp -rf ../supplement-python . \
-&& sudo cp -rf ../component-interface . \
-&& sudo rm -rf component-interface/__pycache__ \
-&& sudo rm -rf component-interface/test \
-&& sudo rm -rf component-interface/*.tar \
-&& echo "step-2: 编译源码" \
-&& sudo docker run \
-    --tty \
-    --volume /home:/home \
-    fra-component-interface:u20 \
-    /bin/bash /home/server/projects/taiwuict/cscec-8bur-vms/build/component-interface/run-c.sh \
-&& echo "step-3: 制作镜像" \
-&& sudo docker build \
-    --tag fra-component-interface:new \
-    --file component-interface/build.Dockerfile \
-    --no-cache \
-    --rm \
-    . \
-&& echo "End."
-```
-```
-# --- 容器方式运行(测试) ---
-echo "Run-Test:" \
-&& sudo docker rm -f fra-component-interface \
-&& sudo docker run \
-    --detach \
-    --env TZ=Asia/Shanghai \
-    --volume /home:/home \
-    --publish 8891:8000 \
-    --network node_network \
-    --restart always \
-    --name fra-component-interface \
-    fra-component-interface:new \
-&& sudo docker logs -f fra-component-interface
-```
-```
-# --- 构建镜像并上传镜像仓库(上传) ---
-echo "Upload-Image:" \
-&& locale_name="fra-component-interface:new" \
-&& remote_name_1="casperz/fra-component-interface:arm64" \
-&& remote_name_2="casperz/fra-component-interface:amd64" \
-&& bash /home/server/resources/HostNecessities/2022/scripts/dockerhub_login.sh \
-&& sudo docker tag ${locale_name} ${remote_name_1} \
-&& sudo docker push ${remote_name_1}
-```
-```
-# --- 启动容器(下载) ---
-sudo docker rm -f fra-component-interface \
-&& sudo docker run \
-    --detach \
-    --env TZ=Asia/Shanghai \
-    --publish 8891:8000 \
-    --network node_network \
-    --restart always \
-    --name fra-component-interface \
-    casperz/fra-component-interface:arm64 \
-&& sudo docker logs -f fra-component-interface
-```

+ 0 - 19
sri-server-bg01/README-usage.txt

@@ -1,19 +0,0 @@
-## NOTE
-
-# 一、构建镜像
-# 构建并运行
-echo "BEGIN:" \
-&& project_path="/home/server/repositories/repositories/sri-robot.cn/project.mccbts-ar-py/module-backend-fastapi" \
-&& cd ${project_path} \
-&& sudo docker-compose --file compose_test.yml down \
-&& sudo docker-compose --file compose_test.yml up --detach --build \
-&& sudo docker logs --follow sri-module-backend-fastapi
-
-# 二、日常调试命令
-sudo docker restart sri-module-backend-fastapi && sudo docker logs -f sri-module-backend-fastapi
-
-# 三、在win上运行命令
-# 1
-cd module-backend-fastapi
-# 2
-python main.py

+ 0 - 22
sri-server-bg01/build.Dockerfile

@@ -1,22 +0,0 @@
-FROM ubuntu:20.04
-ENV DEBIAN_FRONTEND noninteractive
-
-RUN echo "Support Time Zone" \
-    && set -x \
-    && apt-get dist-upgrade  \
-    && apt-get update \
-    && apt-get install -y tzdata
-
-# --- put file ---
-COPY ./component-interface /opt/cscec-8bur-vms/component-interface
-COPY ./supplement-python /opt/cscec-8bur-vms/supplement-python
-
-# --- clean ---
-RUN rm -rf /opt/cscec-8bur-vms/component-interface/*Dockerfile
-RUN rm -rf /opt/cscec-8bur-vms/component-interface/*spec
-RUN rm -rf /opt/cscec-8bur-vms/component-interface/*md
-RUN rm -rf /opt/cscec-8bur-vms/component-interface/*sh
-
-# --- run file ---
-WORKDIR /opt/cscec-8bur-vms/component-interface
-CMD ["/bin/bash", "-c", "./main"]

+ 0 - 54
sri-server-bg01/cythonize.py

@@ -1,54 +0,0 @@
-"""
-用于python源码打包成so文件,python解释器运行main.py
-"""
-from distutils.core import setup
-from Cython.Build import cythonize
-import os
-
-py_dir = [
-    '/home/server/projects/taiwuict/cscec-8bur-vms/build/component-interface',
-    '/home/server/projects/taiwuict/cscec-8bur-vms/build/supplement-python',
-]
-
-
-def get_file_path_list(dir_path, path_list=None):
-    if not path_list:
-        path_list = []
-    for path, folders, files in os.walk(dir_path):
-
-        for file_name in files:
-            if file_name[-2:] != 'py':
-                continue
-            if 'cythonize' in file_name:
-                continue
-            # if '__init__' in file_name:
-            #     continue
-            file_path = os.path.join(path, file_name)
-            if file_path in path_list:
-                continue
-            path_list.append(file_path)
-
-        for folder_name in folders:
-            get_file_path_list(os.path.join(path, folder_name), path_list)
-
-    return path_list
-
-
-py_list = []
-for dir in py_dir:
-    py_list += get_file_path_list(dir)
-print(py_list)
-
-# setup(ext_modules=cythonize(module_list=py_list,
-#                             compiler_directives=dict(c_string_encoding="utf-8", language_level=3)))
-
-# --- one by one ---
-for py_file in py_list:
-    setup(
-        name='fra',
-        package_dir={
-            'v3': '',
-            'base_original': '',
-        },
-        ext_modules=cythonize(module_list=[py_file],
-                              compiler_directives=dict(c_string_encoding="utf-8", language_level=3)))

+ 0 - 82
sri-server-bg01/main.spec

@@ -1,82 +0,0 @@
-# 用于pyinstaller打包用的配置文件
-# -*- mode: python ; coding: utf-8 -*-
-block_cipher = None
-a = Analysis(
-    [
-        'main.py',
-    ],
-    pathex = [
-
-        '../supplement-python',
-
-    ],
-    binaries = [
-
-        # find / -name "*_dl.cpython-36m-aarch64-linux-gnu.so*"
-        ('/usr/lib/aarch64-linux-gnu/libxcb.so.1', '.'),
-        ('/usr/lib/aarch64-linux-gnu/libdrm.so.2', '.'),
-
-    ],
-    datas = [
-
-    ],
-    hiddenimports = [
-
-        # --- for component ---
-        'actions',
-        'api',
-
-        # --- for supplement ---
-        'libraries.base_original',
-        'libraries.base_external.loop_by_aps',
-        'libraries.base_external.camera_by_cv2',
-        'libraries.base_external.data_by_numpy',
-        'clients.l4_ssh_by_paramiko',
-        'clients.db_mongo',
-        'clients.db_redis',
-        'clients.db_influx',
-        'apis.local.api',
-        'decorators',
-
-        # --- for middleware ---
-        'uvicorn.logging',
-        'uvicorn.loops',
-        'uvicorn.loops.auto',
-        'uvicorn.protocols',
-        'uvicorn.protocols.http',
-        'uvicorn.protocols.http.auto',
-        'uvicorn.protocols.websockets',
-        'uvicorn.protocols.websockets.auto',
-        'uvicorn.lifespan',
-        'uvicorn.lifespan.on',
-        'redis',
-        'pymongo',
-        'paramiko',
-        'apscheduler',
-
-    ],
-    hookspath = [],
-    runtime_hooks = [],
-    excludes = [],
-    win_no_prefer_redirects = False,
-    win_private_assemblies = False,
-    cipher = block_cipher,
-    noarchive = False,
-)
-pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
-exe = EXE(
-    pyz,
-    a.scripts,
-    a.binaries,
-    a.zipfiles,
-    a.datas,
-    [],
-    name = 'main',  # <可执行文件名>
-    debug = False,
-    bootloader_ignore_signals = False,
-    strip = False,
-    upx = True,
-    upx_exclude = [],
-    runtime_tmpdir = None,
-    console = True,
-)

+ 0 - 8
sri-server-bg01/run-c.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-echo "Run-Commands(将py文件编译成so文件):" \
-&& set -x \
-&& cd /home/server/projects/taiwuict/cscec-8bur-vms/build/component-interface \
-&& python3 cythonize.py build_ext --inplace \
-&& find /home/server/projects/taiwuict/cscec-8bur-vms/build -name "*.py" -type f | xargs rm -rf \
-&& echo "End."

+ 0 - 10
sri-server-bg01/run-exe-wrap.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-echo "Run-Commands(打包,打成可执行文件):" \
-&& set -x \
-&& cd /home/server/projects/taiwuict/cscec-8bur-vms/component-interface \
-&& pyinstaller main.spec \
-    --onefile \
-    --distpath . \
-&& tar -cf main.tar main \
-&& ./main

+ 0 - 6
sri-server-bg01/run-exe.sh

@@ -1,6 +0,0 @@
-#!/bin/bash
-
-echo "Run-Commands(可执行文件方式运行):" \
-&& set -x \
-&& cd /home/server/projects/taiwuict/cscec-8bur-vms/component-interface \
-&& ./main

+ 1 - 1
sri-server-bg01/run.sh

@@ -3,5 +3,5 @@
 #echo "BEGIN:" \
 #&& python3 api.py
 
-echo "BEGIN(源码方式运行):" \
+echo "执行:启动(源码方式运行):" \
 && python3 main.py

+ 16 - 0
sri-server-bg02/1.txt

@@ -0,0 +1,16 @@
+# --- for base ---
+cython==3.0.0a9
+pyinstaller==4.10
+# --- for libraries ---
+pycrypto==2.6.1
+paramiko==2.7.2
+apscheduler==3.7.0
+# --- for client ---
+requests==2.25.1
+redis==3.5.3
+pymongo==3.11.2
+influxdb==5.3.1
+pymysql==0.9.3
+peewee==3.17.0
+SQLAlchemy==1.4.30
+paho-mqtt==1.6.1

+ 3 - 0
sri-server-bg02/README-usage-win.bash

@@ -0,0 +1,3 @@
+## USAGE
+
+pip install -r 1.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

+ 0 - 0
sri-server-bg03/1.txt


+ 3 - 0
sri-server-bg03/README-usage-win.bash

@@ -0,0 +1,3 @@
+## USAGE
+
+pip install -r 1.txt -i https://pypi.tuna.tsinghua.edu.cn/simple