Code Monkey home page Code Monkey logo

message's Introduction

消息服务

简单又好用的消息服务。快来给你"项目"添加消息功能。

启动

如果您需要测试该项目。我推荐您使用DockerCompose方法使用。

使用编译好的文件

打开releases页面。

1.下载other.zip文件(启动消息服务需要的文件)

解压other.zip文件夹。修改config/config.yamlmysql配置。

2.下载并启动消息服务(使用linux演示)

启动./message-linux-amd64

测试是否启动成功curl localhost:1204。如果返回OK表示启动消息服务成功。

Docker

您可以使用以下命令来拉取Docker镜像:

docker pull webbl1/message

然后,您可以修改config.yaml文件中的MySQL配置。

app:
  # 网站标题
  title: Message
  # 是否为调试模式
  debug: true
  # 网站语言
  language: zh
  # 文件存储设置,设置上传文件的存储路径以及路由前缀
  store:
    path: ./uploads
    prefix: uploads

  # 开发环境:本地 EnvLocal / 测试 EnvTest / 生产 EnvProd
  env: local

  # 日志本地存储路径
  log:
    info: logs/info.log
    error: logs/error.log
    access: logs/access.log

database:
  host: 127.0.0.1
  port: 3306
  user: message
  pwd: message
  name: message
  max_idle_con: 5
  max_open_con: 10
  # params为驱动需要的额外的传参
  params:
    character: utf8mb4

api:
  # 是否开启SwaggerApi
  test: true
  # 返回最多数量
  maxLimit: 15

接下来,您可以使用以下命令在容器中运行该镜像,并将容器的端口1204映射到主机的端口1204上,并将容器命名为message:

docker run -p 1204:1204 -d --name message webbl1/message

然后,您可以使用以下命令将修改后的config.yaml文件复制到正在运行的容器中的/app/config/config.yaml位置:

docker cp config.yaml message:/app/config/config.yaml

最后,您可以使用curl命令来测试应用程序是否正常运行,例如检查/ping端点:

curl localhost:1204/ping

DockerCompose

编辑config.yaml配置文件,把config.yaml文件中的 host: 127.0.0.1替换成 host: mysql

app:
  # 网站标题
  title: Message
  # 是否为调试模式
  debug: true
  # 网站语言
  language: zh
  # 文件存储设置,设置上传文件的存储路径以及路由前缀
  store:
    path: ./uploads
    prefix: uploads

  # 开发环境:本地 EnvLocal / 测试 EnvTest / 生产 EnvProd
  env: local

  # 日志本地存储路径
  log:
    info: logs/info.log
    error: logs/error.log
    access: logs/access.log

database:
  host: 192.168.200.136
  port: 3306
  user: message
  pwd: message
  name: message
  max_idle_con: 5
  max_open_con: 10
  # params为驱动需要的额外的传参
  params:
    character: utf8mb4

api:
  # 是否开启SwaggerApi
  test: true
  # 返回最多数量
  maxLimit: 15

新建一个docker-compose.yml文件把下方的内容写入到文件中。

version: '3'
services:
  app:
    image: webbl1/message:latest
    networks:
      - default
    links:
      - mysql
    ports:
      - "1204:1204"
    depends_on:
      - mysql
  mysql:
    image: mysql:8.0
    command: --default-authentication-plugin=mysql_native_password
    networks:
      - default
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
      MYSQL_DATABASE: 'message'
      MYSQL_USER: 'message'
      MYSQL_PASSWORD: 'message'
    volumes:
      - mysql-data:/var/lib/mysql
    ports:
      - "3306:3306"
volumes:
  mysql-data:
networks:
  default:

启动容器。

docker-compose up -d

把我们的文件修改好的config.yaml文件复制到message_app_1容器中。

docker cp config.yaml message_app_1:/app/config/config.yaml

重启消息服务

docker restart message_app_1

最后,您可以使用curl命令来测试应用程序是否正常运行,例如检查/ping端点:

curl localhost:1204/ping

开发

访问SwaggerApi文档http://localhost:1204/swagger/index.html

过滤语法

格式:

列 比较 值

例子:

title = 标题

title = 标题,content = 简易内容

status = 0|1|2

big_content = %内容%

列:

介绍
created_at 创建时间
updated_at 修改时间
sender_ids 发送者的id
title 标题
content 简短内容
category 类别
big_content 长内容
introducer_ids 接受者的id
status 状态

比较:

介绍
> 大于
= 等于
< 小于
>= 大于等于
<= 小于等于
!= 不等于
like 模糊比较
in 多个值比较

message's People

Contributors

webb-l avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.