diff --git a/apps/rust-srec/0.1.0/data.yml b/apps/rust-srec/0.1.0/data.yml new file mode 100644 index 000000000..410c94d90 --- /dev/null +++ b/apps/rust-srec/0.1.0/data.yml @@ -0,0 +1,60 @@ +additionalProperties: + formFields: + - default: "/home/rust-rec" + edit: true + envKey: RUST_REC_ROOT_PATH + labelZh: 应用持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: "/home/rust-rec" + edit: true + envKey: RUST_REC_DATA_ROOT_PATH + labelZh: 数据持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: 8088 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelZh: WebUI 端口 + labelEn: WebUI port + required: true + rule: paramPort + type: number + - default: 8080 + edit: true + envKey: PANEL_APP_PORT_API + labelZh: API 端口 + labelEn: API port + required: true + rule: paramPort + type: number + - default: "" + edit: true + envKey: JWT_SECRET + labelZh: JWT 签名密钥 + labelEn: JWT Secret + required: true + type: text + - default: "" + edit: true + envKey: SESSION_SECRET + labelZh: 会话密钥 + labelEn: Session Secret + required: true + type: text + - default: "" + edit: true + envKey: HTTP_PROXY + labelZh: 网络代理 + labelEn: Network Proxy + required: false + type: text + - default: "localhost,127.0.0.1,rust-srec-backend" + edit: true + envKey: NO_PROXY + labelZh: 忽略代理 + labelEn: Ignore Proxy + required: true + type: text diff --git a/apps/rust-srec/0.1.0/docker-compose.yml b/apps/rust-srec/0.1.0/docker-compose.yml new file mode 100644 index 000000000..eba076a27 --- /dev/null +++ b/apps/rust-srec/0.1.0/docker-compose.yml @@ -0,0 +1,70 @@ +networks: + 1panel-network: + external: true + +services: + rust-srec-backend: + image: ghcr.io/hua0512/rust-srec:v0.1.0 + container_name: backend-${CONTAINER_NAME} + restart: always + networks: + - 1panel-network + ports: + - ${PANEL_APP_PORT_API}:8080 + env_file: + - ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env} + - ${ENV_FILE:-/etc/1panel/envs/default.env} + volumes: + - ${RUST_REC_DATA_ROOT_PATH}/data:/app/data + - ${RUST_REC_DATA_ROOT_PATH}/output:/app/output + - ${RUST_REC_ROOT_PATH}/config:/app/config + - ${RUST_REC_ROOT_PATH}/logs:/app/logs + - ${RUST_REC_ROOT_PATH}/tmp:/tmp + environment: + - TZ=Asia/Shanghai + - RUST_LOG=${RUST_LOG:-info} + - DATABASE_URL=${DATABASE_URL:-sqlite:///app/data/rust-srec.db} + - API_PORT=8080 + - API_BIND_ADDRESS=0.0.0.0 + - ACCESS_TOKEN_EXPIRATION_SECS=${ACCESS_TOKEN_EXPIRATION_SECS:-3600} + - REFRESH_TOKEN_EXPIRATION_SECS=${REFRESH_TOKEN_EXPIRATION_SECS:-604800} + - MIN_PASSWORD_LENGTH=${MIN_PASSWORD_LENGTH:-8} + - HTTP_PROXY=${HTTP_PROXY:-} + - HTTPS_PROXY=${HTTP_PROXY:-} + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:8080/api/health/live" ] + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "5" + + rust-rec-frontend: + depends_on: + rust-srec-backend: + condition: service_healthy + image: ghcr.io/hua0512/rust-srec-frontend:v0.1.0 + container_name: ${CONTAINER_NAME} + labels: + createdBy: "Apps" + restart: always + networks: + - 1panel-network + ports: + - ${PANEL_APP_PORT_HTTP}:80 + env_file: + - ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env} + - ${ENV_FILE:-/etc/1panel/envs/default.env} + environment: + - TZ=Asia/Shanghai + - BACKEND_URL=${BACKEND_URL:-http://rust-srec-backend:8080} + - COOKIE_SECURE=${COOKIE_SECURE:-} + logging: + driver: "json-file" + options: + max-size: "50m" + max-file: "3" diff --git a/apps/rust-srec/0.1.0/envs/default.env b/apps/rust-srec/0.1.0/envs/default.env new file mode 100644 index 000000000..405d4f599 --- /dev/null +++ b/apps/rust-srec/0.1.0/envs/default.env @@ -0,0 +1,8 @@ +# copyright© 2024 XinJiang Ms Studio +ENV_FILE=.env +DATA_DIR=/app/data +CONFIG_DIR=/app/config +OUTPUT_DIR=/app/output +LOG_DIR=/app/logs +JWT_ISSUER=rust-srec +JWT_AUDIENCE=rust-srec-api diff --git a/apps/rust-srec/0.1.0/envs/global.env b/apps/rust-srec/0.1.0/envs/global.env new file mode 100644 index 000000000..e10989fe4 --- /dev/null +++ b/apps/rust-srec/0.1.0/envs/global.env @@ -0,0 +1,2 @@ +# copyright© 2024 XinJiang Ms Studio +TZ=Asia/Shanghai diff --git a/apps/rust-srec/0.1.0/scripts/init.sh b/apps/rust-srec/0.1.0/scripts/init.sh new file mode 100644 index 000000000..07fb8c3fe --- /dev/null +++ b/apps/rust-srec/0.1.0/scripts/init.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + sed -i '/^GLOBAL_ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + echo "GLOBAL_ENV_FILE=${CURRENT_DIR}/envs/global.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/rust-srec/0.1.0/scripts/uninstall.sh b/apps/rust-srec/0.1.0/scripts/uninstall.sh new file mode 100644 index 000000000..c86c4fbca --- /dev/null +++ b/apps/rust-srec/0.1.0/scripts/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/rust-srec/0.1.0/scripts/upgrade.sh b/apps/rust-srec/0.1.0/scripts/upgrade.sh new file mode 100644 index 000000000..07fb8c3fe --- /dev/null +++ b/apps/rust-srec/0.1.0/scripts/upgrade.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + sed -i '/^GLOBAL_ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + echo "GLOBAL_ENV_FILE=${CURRENT_DIR}/envs/global.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi