From 1208402d3afd487d23c4b942869f1e84d89ed920 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Fri, 3 Mar 2023 10:20:53 +0800 Subject: [PATCH] fixed sql ddl field error in p_contact/p_contact_group and optimize docker-compose.yaml --- .gitignore | 1 + Dockerfile | 6 ++--- config.yaml.sample | 14 +++++----- docker-compose.yaml | 27 ++++++++++--------- docs/deploy/local/custom/config.yaml | 39 ++++++++++++++++++++++++++++ scripts/paopao-mysql.sql | 4 +-- scripts/paopao-sqlite3.sql | 4 +-- 7 files changed, 67 insertions(+), 28 deletions(-) create mode 100644 docs/deploy/local/custom/config.yaml diff --git a/.gitignore b/.gitignore index c67a6e18..18e3b36d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store .idea .vscode !*.example diff --git a/Dockerfile b/Dockerfile index ce76dd07..8fd072db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # build frontend -FROM node:18-alpine as frontend +FROM node:19-alpine as frontend ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes @@ -11,7 +11,7 @@ RUN [ $EMBED_UI != yes ] || [ $USE_DIST != no ] || (yarn && yarn build) RUN [ $EMBED_UI = yes ] || mkdir dist || echo "" # build backend -FROM golang:1.18-alpine AS backend +FROM golang:1.20-alpine AS backend ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes @@ -28,7 +28,7 @@ ENV GOPROXY=https://goproxy.cn RUN [ $EMBED_UI != yes ] || make build TAGS='embed go_json' RUN [ $EMBED_UI = yes ] || make build TAGS='go_json' -FROM alpine:3.16 +FROM alpine:3.17 ARG API_HOST ARG USE_API_HOST=yes ARG EMBED_UI=yes diff --git a/config.yaml.sample b/config.yaml.sample index ec33d9eb..86e52b67 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -8,23 +8,23 @@ App: # APP基础设置项 Server: # 服务设置 RunMode: debug HttpIp: 0.0.0.0 - HttpPort: 8008 + HttpPort: 8010 ReadTimeout: 60 WriteTimeout: 60 Features: - Default: ["Base", "MySQL", "Option", "Zinc", "LocalOSS", "LoggerFile", "Friendship", "Deprecated"] + Default: ["Web", "Frontend:EmbedWeb", "Zinc", "LocalOSS", "MySQL", "BigCacheIndex", "LoggerZinc", "Friendship"] Develop: ["Base", "MySQL", "BigCacheIndex", "Meili", "Sms", "AliOSS", "LoggerMeili", "OSS:Retention"] Demo: ["Base", "MySQL", "Option", "Zinc", "Sms", "MinIO", "LoggerZinc", "Migration"] Slim: ["Base", "Sqlite3", "LocalOSS", "LoggerFile", "OSS:TempDir"] Base: ["Redis", "PhoneBind"] Docs: ["Docs:OpenAPI"] Deprecated: ["Deprecated:OldWeb"] - Service: ["Web", "Admin", "SpaceX", "Bot", "LocalOSS", "Mobile", "Frontend:Web", "Fronetend:EmbedWeb", "Docs"] + Service: ["Web", "Admin", "SpaceX", "Bot", "LocalOSS", "Mobile", "Frontend:Web", "Frontend:EmbedWeb", "Docs"] Option: ["SimpleCacheIndex"] Sms: "SmsJuhe" WebServer: # Web服务 HttpIp: 0.0.0.0 - HttpPort: 8010 + HttpPort: 8008 ReadTimeout: 60 WriteTimeout: 60 AdminServer: # Admin后台运维服务 @@ -84,7 +84,7 @@ BigCacheIndex: # 使用BigCache缓存泡泡广场消息流 Logger: # 日志通用配置 Level: debug # 日志级别 panic|fatal|error|warn|info|debug|trace LoggerFile: # 使用File写日志 - SavePath: data/paopao-ce/logs + SavePath: custom/data/paopao-ce/logs FileName: app FileExt: .log LoggerZinc: # 使用Zinc写日志 @@ -154,7 +154,7 @@ S3: # Amazon S3 存储配置 Bucket: paopao Domain: LocalOSS: # 本地文件OSS存储配置 - SavePath: data/paopao-ce/oss + SavePath: custom/data/paopao-ce/oss Secure: False Bucket: paopao Domain: 127.0.0.1:8008 @@ -179,7 +179,7 @@ Postgres: # PostgreSQL数据库 SSLMode: disable TimeZone: Asia/Shanghai Sqlite3: # Sqlite3数据库 - Path: data/sqlite3/paopao-ce.db + Path: custom/data/sqlite3/paopao-ce.db Redis: Host: redis:6379 Password: diff --git a/docker-compose.yaml b/docker-compose.yaml index 6f40f0eb..b96fcef5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,9 +11,9 @@ services: MYSQL_RANDOM_ROOT_PASSWORD: yes volumes: - ./scripts/paopao-mysql.sql:/docker-entrypoint-initdb.d/paopao.sql - - ./data/mysql/data:/var/lib/mysql + - ./custom/data/mysql/data:/var/lib/mysql ports: - - 127.0.0.1::3306 + - 3306:3306 networks: - paopao-network @@ -76,15 +76,15 @@ services: # networks: # - paopao-network - pyroscope: - image: pyroscope/pyroscope:latest - restart: always - ports: - - 4040:4040 - command: - - 'server' - networks: - - paopao-network + # pyroscope: + # image: pyroscope/pyroscope:latest + # restart: always + # ports: + # - 4040:4040 + # command: + # - 'server' + # networks: + # - paopao-network phpmyadmin: image: phpmyadmin:5.2 @@ -100,8 +100,7 @@ services: - paopao-network backend: - build: - context: . + image: bitbus/paopao-ce:latest restart: always depends_on: - db @@ -110,7 +109,7 @@ services: # modify below to reflect your custom configure volumes: - ./config.yaml.sample:/app/paopao-ce/config.yaml - - ./data/paopao-ce/data:/app/paopao-ce/data + - ./custom:/app/paopao-ce/custom ports: - 8008:8008 networks: diff --git a/docs/deploy/local/custom/config.yaml b/docs/deploy/local/custom/config.yaml new file mode 100644 index 00000000..66208484 --- /dev/null +++ b/docs/deploy/local/custom/config.yaml @@ -0,0 +1,39 @@ +Features: + Default: ["Sqlite3", "Zinc", "LocalOSS", "LoggerZinc", "BigCacheIndex", "Friendship", "Frontend:EmbedWeb", "Web"] +BigCacheIndex: # 使用BigCache缓存泡泡广场消息流 + MaxIndexPage: 1024 # 最大缓存页数,必须是2^n, 代表最大同时缓存多少页数据 + HardMaxCacheSize: 256 # 最大缓存大小(MB),0表示无限制 +WebServer: # Web服务 + HttpIp: 0.0.0.0 + HttpPort: 8008 + ReadTimeout: 60 + WriteTimeout: 60 +Logger: # 日志通用配置 + Level: debug # 日志级别 panic|fatal|error|warn|info|debug|trace +LoggerZinc: # 使用Zinc写日志 + Host: 127.0.0.1:4080 + Index: paopao-log + User: admin + Password: admin + Secure: False +JWT: # 鉴权加密 + Secret: 18a6413dc4fe394c66345ebe501b2f26 + Issuer: paopao-api + Expire: 86400 +Zinc: # Zinc搜索配置 + Host: 127.0.0.1:4080 + Index: paopao-data + User: admin + Password: admin + Secure: False +LocalOSS: # 本地文件OSS存储配置 + SavePath: custom/data/oss + Secure: True + Bucket: paopao + Domain: api.alimy.me +Sqlite3: # Sqlite3数据库 + Path: custom/data/sqlite3/paopao-ce.db +Redis: + Host: 127.0.0.1:6379 + Password: + DB: diff --git a/scripts/paopao-mysql.sql b/scripts/paopao-mysql.sql index 18525ab3..cb6bba55 100644 --- a/scripts/paopao-mysql.sql +++ b/scripts/paopao-mysql.sql @@ -283,7 +283,7 @@ CREATE TABLE `p_contact` ( `status` tinyint NOT NULL DEFAULT '0' COMMENT '好友状态: 1请求好友, 2已好友, 3拒绝好友, 4已删好友', `is_top` tinyint NOT NULL DEFAULT '0' COMMENT '是否置顶, 0否, 1是', `is_black` tinyint NOT NULL DEFAULT '0' COMMENT '是否为黑名单, 0否, 1是', - `is_delete` tinyint NOT NULL DEFAULT '0' COMMENT '是否删除好友, 0否, 1是', + `is_del` tinyint NOT NULL DEFAULT '0' COMMENT '是否删除好友, 0否, 1是', `notice_enable` tinyint NOT NULL DEFAULT '0' COMMENT '是否有消息提醒, 0否, 1是', `created_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `modified_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', @@ -301,7 +301,7 @@ CREATE TABLE `p_contact_group` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '联系人ID', `user_id` int NOT NULL DEFAULT '0' COMMENT '用户id', `name` varchar(32) NOT NULL DEFAULT '' COMMENT '分组名称', - `is_delete` tinyint NOT NULL DEFAULT '1' COMMENT '是否删除, 0否, 1是', + `is_del` tinyint NOT NULL DEFAULT '1' COMMENT '是否删除, 0否, 1是', `created_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `modified_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '修改时间', `deleted_on` bigint unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', diff --git a/scripts/paopao-sqlite3.sql b/scripts/paopao-sqlite3.sql index a82c4a34..2764094b 100644 --- a/scripts/paopao-sqlite3.sql +++ b/scripts/paopao-sqlite3.sql @@ -103,7 +103,7 @@ CREATE TABLE "p_contact" ( "status" integer NOT NULL, "is_top" integer NOT NULL, "is_black" integer NOT NULL, - "is_delete" integer NOT NULL, + "is_del" integer NOT NULL, "notice_enable" integer NOT NULL, "created_on" integer NOT NULL, "modified_on" integer NOT NULL, @@ -119,7 +119,7 @@ CREATE TABLE "p_contact_group" ( "id" integer NOT NULL, "user_id" integer NOT NULL, "name" text(32) NOT NULL, - "is_delete" integer NOT NULL, + "is_del" integer NOT NULL, "created_on" integer NOT NULL, "modified_on" integer NOT NULL, "deleted_on" integer NOT NULL,