当前位置: 首页 > news >正文

我的docker随笔43:问答平台answer部署

本文介绍开源问答社区平台Answer的容器化部署。

起因

笔者一直想搭建一个类似stack overflower这样的平台,自使用了Typora,就正式全面用Markdown+Typora+git来积累自己的个人知识库,但没有做到web化,现在也还在探索更好的方法。

无意间看到了 Answer 项目,觉得可能满足需求。其实这个项目早在 2022 年就已经由 SegmentFault 团队开源了,去年就进入了Apache 软件基金会孵化器。只是我知道的晚而已。

本文直接使用官方提供的docker镜像来部署。该项目使用 Golang 编写,有时间可以研究一下,当然这是后话。

概述

Answer主要功能有(摘自官方文档):

  • 提问和回答 - 提出问题并从你的用户和团队那里获得答案。
  • 组织内容 - 将你的内容组织为分类和标签。
  • 集成 - 与你现有的工具和服务集成。
  • 游戏化 - 奖励用户的贡献。
  • 现代用户界面 - 现代且响应式的用户界面。
  • 可扩展 - 使用插件扩展 Answer。
  • 开源 - 免费且开源。

服务部署

官方有详细的安装文档,这里结合自己的实际情况给出步骤。

下载镜像

通过以下命令下载官方镜像:

docker pull apache/answer

注:也可以在docker-comose阶段自动下载。虽然自动方便,不过笔者喜欢按部就班做。

容器启动脚本

docker-compose.yaml文件:

# cat docker-compose.yaml 
version: "3"
services:answer:image: apache/answercontainer_name: answerports:- '9080:80'restart: on-failurevolumes:- ./answer-data:/data#  - /etc/localtime:/etc/localtime#environment:#  - TZ=Asia/Shanghai
#volumes:
#  answer-data:./data

docker-compose.yaml文件根据实际情况作了修改,说明如下:

  • Anserver使用目录/data存在数据,将其映射至宿主机目录。
  • 映射外部端口8090。
  • 本想自动设置时区,但经测试无效,因此保留注释。

启动:

docker-compose up -d

启动日志如下:

Attaching to answer
answer    | [upload-dir] try to install...
answer    | [upload-dir] install success, upload directory is /data/uploads
answer    | [i18n] try to install i18n bundle...
answer    | [i18n] find i18n bundle 42
answer    | [i18n] install af_ZA.yaml bundle...
answer    | [i18n] install af_ZA.yaml bundle success
answer    | [i18n] install ar_SA.yaml bundle...
...
answer    | [i18n] install zh_CN.yaml bundle...
answer    | [i18n] install zh_CN.yaml bundle success
answer    | [i18n] install zh_TW.yaml bundle...
answer    | [i18n] install zh_TW.yaml bundle success
answer    | install all initial environment done
answer    | [SUCCESS] answer installation service will run at: http://localhost:80/install/ 

使用说明

输入http://<ip>:9080/,根据提示进行安装。

页面配置

步骤1:选择语言。

在这里插入图片描述

步骤2:选择数据库。为简单起见,使用了sqlite3。
在这里插入图片描述

值得说明的是,Answer 支持MarialDB/MySQL、PostgreSQL 和 SQLite 数据库。前2者需要配置数据库信息,如数据库地址、用户、密码等,见下图。而SQLite不需要额外的配置。
在这里插入图片描述

步骤3:创建配置文件

在这里插入图片描述

步骤4:配置网站信息,注意,这里填写的用户是管理员。
在这里插入图片描述

登录后页面如下:
在这里插入图片描述

添加问题/回答

根据网页提示添加即可。需要说明的是,问题必须有对应的标签,可自定义添加,也可用管理员登录统一添加。页面示例:
在这里插入图片描述

添加用户

路径:后台管理->用户管理。

可以批量添加用户。格式为用户名,邮箱,密码,注意事项:

  • 用户名长度需大于4字符。
  • 邮箱不能与已存在用户的相同。
  • 密码长度需大于8字符。

示例如下:
在这里插入图片描述

可以修改用户状态,如停用、删除、提升至管理员,等。

网站设置

路径:后台管理->站点设置。

一般的设置较简单,根据网站提示即可。这里说一下笔者设置的地方。

登录设置,不允许用户注册。
在这里插入图片描述

特权设置,使用级别1。
在这里插入图片描述

小结

就目前情况看,即使搭建了这个平台,即使在内部推行了这个平台,使用者还是自己而已。但无论如何,还是走出了一步,还需看后续效果。

官方网站:https://answer.apache.org/

源码:https://github.com/apache/incubator-answer

启动日志(有删改):

$ docker-compose logs
Attaching to answer
answer    | [upload-dir] try to install...
answer    | [upload-dir] install success, upload directory is /data/uploads
answer    | [i18n] try to install i18n bundle...
answer    | [i18n] find i18n bundle 42
answer    | install all initial environment done
answer    | [SUCCESS] answer installation service will run at: http://localhost:80/install/ 
[fengxuan@master incubator-answer]$ docker-compose logs -f
Attaching to answer
answer    | [upload-dir] try to install...
answer    | [upload-dir] install success, upload directory is /data/uploads
answer    | [i18n] try to install i18n bundle...
answer    | [i18n] find i18n bundle 42
answer    | install all initial environment done
answer    | [SUCCESS] answer installation service will run at: http://localhost:80/install/ 
answer    | [config-file] try to create at  /data/conf/config.yaml
answer    | [config-file] create directory success, config file is /data/conf/config.yaml
answer    | [config-file] install success
answer    | check table not exist
answer    | [i18n] try to install i18n bundle...
answer    | [i18n] find i18n bundle 42answer    | [i18n] install zh_CN.yaml file exist, try to replace it
answer    | [i18n] install zh_CN.yaml bundle...
answer    | [i18n] install zh_CN.yaml bundle success
answer    | [i18n] install zh_TW.yaml file exist, try to replace it
answer    | [i18n] install zh_TW.yaml bundle...
answer    | [i18n] install zh_TW.yaml bundle success
answer    | try to create cache directory /data/cache
answer    | try to load cache file from /data/cache/cache.db
answer    | open /data/cache/cache.db: no such file or directory
answer    | try to create database directory /data
answer    | try to save cache file to /data/cache/cache.db
answer    | upgrade done
answer    | config file path:  /data/conf/config.yaml
answer    | Answer is starting..........................
answer    | 2024-01-14 16:03:00.773     INFO    data/data.go:118        try to load cache file from /data/cache/cache.db
answer    | start cron
answer    | answer Version: 1.2.1  Revision: d8c5577

相关文章:

我的docker随笔43:问答平台answer部署

本文介绍开源问答社区平台Answer的容器化部署。 起因 笔者一直想搭建一个类似stack overflower这样的平台&#xff0c;自使用了Typora&#xff0c;就正式全面用MarkdownTyporagit来积累自己的个人知识库&#xff0c;但没有做到web化&#xff0c;现在也还在探索更好的方法。 无…...

17、ELK

17、ELK helm 安装 elkfk&#xff08;kafka 集群外可访问&#xff09; ES/Kibana <— Logstash <— Kafka <— Filebeat 部署顺序&#xff1a; 1、elasticsearch 2、kibana 3、kafka 4、logstash 5、filebeat kubectl create ns elkhelm3部署elkfk 1、elast…...

React+Antd+tree实现树多选功能(选中项受控+支持模糊检索)

1、先上效果 树型控件&#xff0c;选中项形成一棵新的树&#xff0c;若父选中&#xff0c;子自动选中&#xff0c;子取消&#xff0c;父不取消&#xff0c;子选中&#xff0c;所有的父节点自动取消。同时支持模糊检索&#xff0c;会检索出所有包含该内容的关联节点。 2、环境准…...

鸿蒙 WiFi 扫描流程(2)

接着上篇没有记录完的&#xff0c;我们继续梳理&#xff0c;需要上一篇做基础的请看&#xff1a;鸿蒙 WiFi 扫描流程&#xff08;1&#xff09; 上一篇我们讲到 scan_service.cpp 里面的 SingleScan 方法&#xff0c;继续这个方法往下看&#xff1a; // foundation/communicat…...

微信小程序(四十)API的封装与调用

注释很详细&#xff0c;直接上代码 上一篇 新增内容&#xff1a; 1.在单独的js文件中写js接口 2.以注册为全局wx的方式调用接口 源码&#xff1a; utils/testAPI.js const testAPI{/*** * param {*} title */simpleToast(title提示){//可传参&#xff0c;默认为‘提示’wx.sho…...

WebSocket+Http实现功能加成

WebSocketHttp实现功能加成 前言 首先&#xff0c;WebSocket和HTTP是两种不同的协议&#xff0c;它们在设计和用途上有一些显著的区别。以下是它们的主要特点和区别&#xff1a; HTTP (HyperText Transfer Protocol): 请求-响应模型&#xff1a; HTTP 是基于请求-响应模型的协…...

go语言实现LRU缓存

go语言实现LRU Cache 题目描述详细代码 题目描述 设计和构建一个“最近最少使用”缓存&#xff0c;该缓存会删除最近最少使用的项目。缓存应该从键映射到值(允许你插入和检索特定键对应的值)&#xff0c;并在初始化时指定最大容量。当缓存被填满时&#xff0c;它应该删除最近最…...

git的奇特知识点

展示帮助信息 git help -gThe common Git guides are:attributes Defining attributes per pathcli Git command-line interface and conventionscore-tutorial A Git core tutorial for developerscvs-migration Git for CVS usersdiff…...

按键扫描16Hz-单片机通用模板

按键扫描16Hz-单片机通用模板 一、按键扫描的原理1、直接检测高低电平类型2、矩阵扫描类型3、ADC检测类型二、key.c的实现1、void keyScan(void) 按键扫描函数①void FHiKey(void) 按键按下功能②void FSameKey(void) 按键长按功能③void FLowKey(void) 按键释放功能三、key.h的…...

在容器镜像中为了安全为什么要删除 setuid 和 setgid?

在容器镜像中删除 setuid&#xff08;set user ID&#xff09;和 setgid&#xff08;set group ID&#xff09;权限通常是出于安全考虑。这两个权限位允许进程在执行时以文件所有者或文件所属组的身份运行&#xff0c;而不是以调用进程的用户身份运行。 删除 setuid 和 setgid…...

Flink 动态表 (Dynamic Table) 解读

博主历时三年精心创作的《大数据平台架构与原型实现&#xff1a;数据中台建设实战》一书现已由知名IT图书品牌电子工业出版社博文视点出版发行&#xff0c;点击《重磅推荐&#xff1a;建大数据平台太难了&#xff01;给我发个工程原型吧&#xff01;》了解图书详情&#xff0c;…...

【原创 附源码】Flutter海外登录--Google登录最详细流程

最近接触了几个海外登录的平台&#xff0c;踩了很多坑&#xff0c;也总结了很多东西&#xff0c;决定记录下来给路过的兄弟坐个参考&#xff0c;也留着以后留着回顾。更新时间为2024年2月8日&#xff0c;后续集成方式可能会有变动&#xff0c;所以目前的集成流程仅供参考&#…...

第70讲axios后端请求工具类封装

axios工具类封装&#xff1a; // 引入axios import axios from axios;// 创建axios实例 const httpService axios.create({// url前缀-http:xxx.xxx// baseURL: process.env.BASE_API, // 需自定义baseURL:http://localhost:80/,// 请求超时时间timeout: 3000 // 需自定义 })…...

【数学建模】【2024年】【第40届】【MCM/ICM】【F题 减少非法野生动物贸易】【解题思路】

一、题目 &#xff08;一&#xff09; 赛题原文 2024 ICM Problem F: Reducing Illegal Wildlife Trade Illegal wildlife trade negatively impacts our environment and threatens global biodiversity. It is estimated to involve up to 26.5 billion US dollars per y…...

第3节、电机定速转动【51单片机+L298N步进电机系列教程】

↑↑↑点击上方【目录】&#xff0c;查看本系列全部文章 摘要&#xff1a;本节介绍用定时器定时的方式&#xff0c;精准控制脉冲时间&#xff0c;从而控制步进电机速度。 一、计算过程 电机每一步的角速度等于走这一步所花费的时间&#xff0c;走一步角度等于步距角&#xff…...

【51单片机】LCD1602(可视化液晶屏)调试工具的使用

前言 大家好吖&#xff0c;欢迎来到 YY 滴 单片机系列 &#xff0c;热烈欢迎&#xff01; 本章主要内容面向接触过单片机的老铁 主要内容含&#xff1a; 欢迎订阅 YY滴C专栏&#xff01;更多干货持续更新&#xff01;以下是传送门&#xff01; YY的《C》专栏YY的《C11》专栏YY…...

Netty应用(四) 之 Reactor模型 零拷贝

目录 6.Reactor模型 6.1 单线程Reactor 6.2 主从多线程Reactor (主--->Boss | 从--->Worker | 一主多从机制) 7.扩展与补充 8.Reactor模型的实现 8.1 多线程Reactor模型的实现&#xff08;一个Boss线程&#xff0c;一个Worker线程&#xff09; 8.2 多线程Reactor模…...

Huggingface上传模型

Huggingface上传自己的模型 参考 https://juejin.cn/post/7081452948550746148https://huggingface.co/blog/password-git-deprecationAdding your model to the Hugging Face Hub&#xff0c; huggingface.co/docs/hub/ad…Welcome&#xff0c;huggingface.co/welcome三句指…...

kyuubi 接入starrocks | doris

kyuubi 接入starrocks 一、环境 Hadoop集群 组件版本Hadoop3.1.1spark3.Xzookeeper3.XHive3.X kyuubi 版本 1.7.1 starrocks 2.X   已将kyuubi部署到yarn上&#xff0c;并且接入了spark3引擎&#xff0c;并通过Ambari进行kyuubi组件的管理&#xff0c;下面步骤为新增对sta…...

notepad++成功安装后默认显示英文怎么设置中文界面?

前几天使用电脑华为管家清理电脑后&#xff0c;发现一直使用的notepad软件变回了英文界面&#xff0c;跟刚成功安装的时候一样&#xff0c;那么应该怎么设置为中文界面呢&#xff1f;具体操作如下&#xff1a; 1、打开notepad软件&#xff0c;点击菜单栏“Settings – Prefere…...

Linux应用开发之网络套接字编程(实例篇)

服务端与客户端单连接 服务端代码 #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <pthread.h> …...

微软PowerBI考试 PL300-选择 Power BI 模型框架【附练习数据】

微软PowerBI考试 PL300-选择 Power BI 模型框架 20 多年来&#xff0c;Microsoft 持续对企业商业智能 (BI) 进行大量投资。 Azure Analysis Services (AAS) 和 SQL Server Analysis Services (SSAS) 基于无数企业使用的成熟的 BI 数据建模技术。 同样的技术也是 Power BI 数据…...

无法与IP建立连接,未能下载VSCode服务器

如题&#xff0c;在远程连接服务器的时候突然遇到了这个提示。 查阅了一圈&#xff0c;发现是VSCode版本自动更新惹的祸&#xff01;&#xff01;&#xff01; 在VSCode的帮助->关于这里发现前几天VSCode自动更新了&#xff0c;我的版本号变成了1.100.3 才导致了远程连接出…...

postgresql|数据库|只读用户的创建和删除(备忘)

CREATE USER read_only WITH PASSWORD 密码 -- 连接到xxx数据库 \c xxx -- 授予对xxx数据库的只读权限 GRANT CONNECT ON DATABASE xxx TO read_only; GRANT USAGE ON SCHEMA public TO read_only; GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_only; GRANT EXECUTE O…...

[10-3]软件I2C读写MPU6050 江协科技学习笔记(16个知识点)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16...

Matlab | matlab常用命令总结

常用命令 一、 基础操作与环境二、 矩阵与数组操作(核心)三、 绘图与可视化四、 编程与控制流五、 符号计算 (Symbolic Math Toolbox)六、 文件与数据 I/O七、 常用函数类别重要提示这是一份 MATLAB 常用命令和功能的总结,涵盖了基础操作、矩阵运算、绘图、编程和文件处理等…...

Pinocchio 库详解及其在足式机器人上的应用

Pinocchio 库详解及其在足式机器人上的应用 Pinocchio (Pinocchio is not only a nose) 是一个开源的 C 库&#xff0c;专门用于快速计算机器人模型的正向运动学、逆向运动学、雅可比矩阵、动力学和动力学导数。它主要关注效率和准确性&#xff0c;并提供了一个通用的框架&…...

Java + Spring Boot + Mybatis 实现批量插入

在 Java 中使用 Spring Boot 和 MyBatis 实现批量插入可以通过以下步骤完成。这里提供两种常用方法&#xff1a;使用 MyBatis 的 <foreach> 标签和批处理模式&#xff08;ExecutorType.BATCH&#xff09;。 方法一&#xff1a;使用 XML 的 <foreach> 标签&#xff…...

Python Einops库:深度学习中的张量操作革命

Einops&#xff08;爱因斯坦操作库&#xff09;就像给张量操作戴上了一副"语义眼镜"——让你用人类能理解的方式告诉计算机如何操作多维数组。这个基于爱因斯坦求和约定的库&#xff0c;用类似自然语言的表达式替代了晦涩的API调用&#xff0c;彻底改变了深度学习工程…...

jmeter聚合报告中参数详解

sample、average、min、max、90%line、95%line,99%line、Error错误率、吞吐量Thoughput、KB/sec每秒传输的数据量 sample&#xff08;样本数&#xff09; 表示测试中发送的请求数量&#xff0c;即测试执行了多少次请求。 单位&#xff0c;以个或者次数表示。 示例&#xff1a;…...