surveyking(卷王)问卷调查系统是一个非常棒的问卷和考试系统,能完全满足我的需求。
安装jdk、git、maven
api maven git
编译
- 下载源码
git clone https://gitee.com/surveyking/surveyking.git
- 开始构建
> * 在源码的server目录中构建
> * 生成的 jar 包位于 ./api/target/surveyking-v1.2.0.jar)
mvn clean package -DskipTests -Ppro
......
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for survey-server v1.2.0:
[INFO]
[INFO] survey-server ...................................... SUCCESS [ 5.781 s]
[INFO] shared ............................................. SUCCESS [02:55 min]
[INFO] rdbms .............................................. SUCCESS [ 23.148 s]
[INFO] api ................................................ SUCCESS [ 24.390 s]
[INFO] flow ............................................... SUCCESS [ 38.706 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:43 min
[INFO] Finished at: 2022-10-19T14:25:23+08:00
[INFO] ------------------------------------------------------------------------
创建数据库
- 数据库字符编码是utf8mb4
- 建议对该数据库设置专用的账号并设置对应权限,以保证安全
- 开发者的数据库结构1.2.0版本的与之前版本不同,导入数据库表格时,现在最新的数据库初始化文件init-mysql.sql
mysql> create database exam default character set utf8mb4 collate utf8mb4_general_ci;
Query OK, 1 row affected (0.09 sec)
mysql> CREATE USER 'exam'@'%' IDENTIFIED BY '-hrzone.cn-';
Query OK, 0 rows affected (0.04 sec)
mysql> GRANT ALL ON exam.* TO 'exam'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> use exam;
Database changed
mysql> source init-mysql.sql
Query OK, 0 rows affected (0.00 sec)
启动服务
第一次启动服务需要指定数据库参数和系统端口,后面在无需指定参数,初始化后系统会生成配置文件。
java -jar surveyking-v1.2.0.jar --server.port=9527 --spring.datasource.url=jdbc:mysql://localhost:3306/exam --spring.datasource.username=exam --spring.datasource.password=-hrzone.cn-
其他
- 启动服务后,系统会一直占据终端,可以使用screen专门开启一个终端窗口使用,这样退出终端,服务不会停止;
- 服务器上已经有apache2在跑,因此需要用其他的端口,然后用apache在前端做proxy转发
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName t.eduez.cn
# ServerAlias hotpod.cn
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ProxyPass "/" "http://127.0.0.1:9527/"
ProxyPassReverse "/" "http://127.0.0.1:9527/"
ErrorLog {APACHE_LOG_DIR}/error.log
CustomLog{APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>