-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add docker-compose.yml #14
Draft
iloveyou11
wants to merge
1
commit into
X-Profiler:master
Choose a base branch
from
iloveyou11:feature-dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: '3.6' | ||
services: | ||
|
||
nodejs: | ||
image: node # 镜像名 | ||
container_name: node # 容器名 | ||
restart: always # 在容器退出时总是重启容器 | ||
ports: #容器的端口映射到宿主机上 | ||
- "8080:8080" | ||
|
||
mysql: | ||
image: mysql | ||
container_name: mysql | ||
restart: always | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=root | ||
volumes: # 将容器的目录映射到宿主机上目录中 | ||
- "./db:/docker-entrypoint-initdb.d/" # 启动时自动执行db下的sql文件 | ||
ports: | ||
- '3306:3306' | ||
|
||
redis: | ||
image: redis | ||
container_name: redis | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- ./redis/redis.conf:/usr/local/etc/redis/redis.conf |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里会提示
ERROR 1046 (3D000) at line 3: No database selected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议整合db下的init.sql文件为以下内容,因为这里"./db:/docker-entrypoint-initdb.d/"是指定在启动mysql时自动执行db下的sql文件,我看你初始数据库的操作在init_unittest_db.sh文件中
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- 创建数据库
DROP DATABASE IF EXISTS
xprofiler_console_unittest
;CREATE DATABASE
xprofiler_console_unittest
;DROP DATABASE IF EXISTS
xprofiler_logs_unittest
;CREATE DATABASE
xprofiler_logs_unittest
;-- 切换到数据库
use xprofiler_console_unittest;
-- 在数据库中建表
DROP TABLE IF EXISTS
user
;CREATE TABLE
user
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',name
VARCHAR(100) NOT NULL COMMENT 'user name',nick
VARCHAR(100) NOT NULL COMMENT 'user nick name',pass
VARCHAR(200) NOT NULL COMMENT 'user pass key',identity
VARCHAR(20) NOT NULL COMMENT 'user identity sign',mail
VARCHAR(250) NOT NULL COMMENT 'user mail address',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),UNIQUE KEY (
name
),UNIQUE KEY (
identity
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'user info table';
DROP TABLE IF EXISTS
apps
;CREATE TABLE
apps
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',name
VARCHAR(50) NOT NULL COMMENT 'app name',owner
INT UNSIGNED NOT NULL COMMENT 'owner user unique id',secret
VARCHAR(50) NOT NULL COMMENT 'app secret key',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),UNIQUE KEY (
owner
,name
),INDEX (
owner
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'app info table';
DROP TABLE IF EXISTS
members
;CREATE TABLE
members
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',app
INT UNSIGNED NOT NULL COMMENT 'app unique id',user
INT UNSIGNED NOT NULL COMMENT 'user unique id',status
INT UNSIGNED NOT NULL COMMENT '1: inviting, 2: joined',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),UNIQUE KEY (
app
,user
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'app members info table';
DROP TABLE IF EXISTS
files
;CREATE TABLE
files
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',app
INT NOT NULL COMMENT 'app unique id',agent
VARCHAR(50) NOT NULL COMMENT 'agent name',type
VARCHAR(50) NOT NULL COMMENT 'file type',file
VARCHAR(250) NOT NULL COMMENT 'file path',storage
VARCHAR(250) DEFAULT "" COMMENT 'file storage path with custom',user
INT UNSIGNED NOT NULL COMMENT 'user unique id',status
TINYINT UNSIGNED DEFAULT 0 COMMENT '0:creating, 1:created, 2:transferring, 3:transferred',favor
TINYINT UNSIGNED DEFAULT 0 COMMENT '0:not favor, 1:has favor',token
VARCHAR(50) DEFAULT "" COMMENT 'file token',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),UNIQUE KEY (
app
,agent
,file
,storage
),INDEX (
id
,app
,type
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'analyse file info table';
DROP TABLE IF EXISTS
coredumps
;CREATE TABLE
coredumps
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',app
INT NOT NULL COMMENT 'app unique id',agent
VARCHAR(50) NOT NULL COMMENT 'agent name',file
VARCHAR(250) NOT NULL COMMENT 'file path',file_storage
VARCHAR(250) DEFAULT "" COMMENT 'file storage with custom',file_status
TINYINT UNSIGNED DEFAULT 0 COMMENT '0:creating, 1:created, 2:transferring, 3:transferred',node
VARCHAR(250) NOT NULL COMMENT 'node path',node_storage
VARCHAR(250) DEFAULT "" COMMENT 'node name',node_status
TINYINT UNSIGNED DEFAULT 0 COMMENT '0:creating, 1:created, 2:transferring, 3:transferred',user
INT UNSIGNED NOT NULL COMMENT 'user unique id',favor
TINYINT UNSIGNED DEFAULT 0 COMMENT '0:not favor, 1:has favor',token
VARCHAR(50) DEFAULT "" COMMENT 'file token',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),UNIQUE KEY (
app
,agent
,file
,file_storage
),INDEX (
id
,app
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'coredumps info table';
DROP TABLE IF EXISTS
strategies
;CREATE TABLE
strategies
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',app
INT NOT NULL COMMENT 'app unique id',context
VARCHAR(50) NOT NULL COMMENT 'context type',push
VARCHAR(50) NOT NULL COMMENT 'push level',webhook
TINYINT UNSIGNED DEFAULT 0 COMMENT '0:close, 1:open',wtype
VARCHAR(20) DEFAULT '' COMMENT 'webhook type',waddress
VARCHAR(200) DEFAULT '' COMMENT 'webhook address',wsign
VARCHAR(100) DEFAULT '' COMMENT 'webhook sign',expression
VARCHAR(150) NOT NULL COMMENT 'alarm expression',content
VARCHAR(150) NOT NULL COMMENT 'alarm content',status
TINYINT UNSIGNED DEFAULT 1 COMMENT '0:disable, 1:enable',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),INDEX (
id
,app
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'strategies info table';
DROP TABLE IF EXISTS
contacts
;CREATE TABLE
contacts
(id
INT UNSIGNED AUTO_INCREMENT COMMENT 'unique auto increment id',strategy
INT UNSIGNED NOT NULL COMMENT 'strategy unique id',user
INT UNSIGNED NOT NULL COMMENT 'user unique id',gm_modified
DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'system modify timestamp',gm_create
DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'system create timestamp',PRIMARY KEY (
id
),UNIQUE KEY (
strategy
,user
),INDEX (
strategy
))ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'strategy contacts info table';