visuddhinanda f0b7343639 create 8 months ago
..
.env-global 7770367ff5 :truck: move background source codes into api-v8 1 year ago
app f0b7343639 create 8 months ago
bootstrap 7770367ff5 :truck: move background source codes into api-v8 1 year ago
config ee80a59ee3 :fire: ai_translate_cn add ai_translate_v2 10 months ago
database 976bc90641 create 1 year ago
deploy 7770367ff5 :truck: move background source codes into api-v8 1 year ago
docker 7770367ff5 :truck: move background source codes into api-v8 1 year ago
documents 0a9c1d4463 create 1 year ago
grpc 7770367ff5 :truck: move background source codes into api-v8 1 year ago
patch 6b883dab85 :fire: 1 year ago
public 9f9b62468d black color 10 months ago
resources a649509192 create 10 months ago
routes 7a9a0f2dd8 MockOpenAIController 10 months ago
storage 095a29e2b0 页面图变成链接 10 months ago
tests 26a633b102 create 10 months ago
v1 7770367ff5 :truck: move background source codes into api-v8 1 year ago
.editorconfig 7770367ff5 :truck: move background source codes into api-v8 1 year ago
.env.example 45df98946f add MQ_LOOP_LIMIT_AI_TRANSLATE 1 year ago
.gitattributes 7770367ff5 :truck: move background source codes into api-v8 1 year ago
.gitignore 7770367ff5 :truck: move background source codes into api-v8 1 year ago
.styleci.yml 7770367ff5 :truck: move background source codes into api-v8 1 year ago
README.md 917d1e5a46 :fire: mv api usage into v8 1 year ago
about.md 7770367ff5 :truck: move background source codes into api-v8 1 year ago
artisan 7770367ff5 :truck: move background source codes into api-v8 1 year ago
change-logs.md 7770367ff5 :truck: move background source codes into api-v8 1 year ago
composer.json 7770367ff5 :truck: move background source codes into api-v8 1 year ago
package.json 7770367ff5 :truck: move background source codes into api-v8 1 year ago
phpunit.xml 7770367ff5 :truck: move background source codes into api-v8 1 year ago
server.php 7770367ff5 :truck: move background source codes into api-v8 1 year ago
webpack.mix.js 7770367ff5 :truck: move background source codes into api-v8 1 year ago

README.md

IAPT Pali Canon Platform

About

这是一个开放的基于语料库的巴利语学习和翻译平台。

后端:

  • PHP 8.0+
  • laravel 8.x
  • PostgreSQL v12+
  • Redis

前端

  • jQuery

工具

  • git
  • composer
  • npm or yarn
  • vscode

目录

目录遵从Laravel目录设置。有以下几点差别

  • public/ 包含旧版php程序的全部文件
  • public/tmp 旧版资源文件夹,含有sqlite数据文件 对于旧版到新版的迁移。应该将旧版 /tmp 拷贝到 /public
  • v1 旧版数据迁移任务脚本
  • deploy 运维代码

开发环境

请注意。此安装方法只针对开发人员。生产线请参考deploy/README.md

使用 Linux 的开发者请参阅 <项目文件夹>/docker/readme.md 容器中包含了全部开发环境。请忽略下面关于开发环境的安装。

PostgreSQL

最小版本v12。下载链接 https://www.postgresql.org/download/

温馨提示:windows环境安装完之后 将 安装目录/bin加入环境变量 PATH。重启电脑。在命令行输入 psql -v 查看版本号。

建立新的数据库,例如 数据库名为iapt: 在命令行输入

psql -U postgres -h localhost
create database iapt

createdb

\q 退出psql

PHP 8

编辑 php.ini 文件,打开pgsql和sqlite的PDO扩展,以及fileinfo

extension=pdo_pgsql
extension=pdo_sqlite
extension=fileinfo

Redis

最新版的Redis不支持Windows平台,可以安装第三方修改的Windows版Redis5.0

composer

npm

Rabbitmq

Downloading and Installing RabbitMQ

Fork

Fork https://github.com/iapt-platform/mint 到你自己的仓库

Clone

git clone https://github.com/<your>/mint.git

安装依赖

项目根目录下运行

composer install
npm install

/public 目录下运行

composer install
npm install

修改配置文件

.env

复制 <项目目录>/.env.example 的一个副本。改文件名为 .env

修改.env

db配置

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=你的数据库名
DB_USERNAME=postgres
DB_PASSWORD=你的数据库密码

ASSETS_SERVER

ASSETS_SERVER :网站资源文件,非用户的图片,音频,视频

public/app/config.php

复制 <项目目录>/public/app/config.example.php 改文件名为config.php

修改config.php

db 设置

define("Database",[
	"type"=>"pgsql",
	"server"=>"localhost",
	"port"=>5432,
	"name"=>"<database name>",
	"sslmode" => "disable",
	"user" => "<user name>",
	"password" => "<your db password>"
]);

Redis 设置

define("Redis",[
	"host" => "<host ip>",
	"port" => <port>,
	"password" => "<redis password>",
	"prefix"=>"aaa://"
]);

ASSETS_SERVER

HELP_SERVER

GRAMMAR_SERVER

参照下文 config.js

public/app/config.js

复制 <项目目录>/public/app/config.example.js 改文件名为config.js

修改config.js

ASSETS_SERVER

ASSETS_SERVER :网站资源文件,非用户的图片,音频,视频

范例:

ip port根据你的dev server修改

var ASSETS_SERVER = "http://127.0.0.1:8000/tmp";

HELP_SERVER

网站帮助文档

  • 直接引用离您最近的 help server

范例:

ip port根据你的 dev server 修改

var HELP_SERVER = "https://help-hk.wikipali.org";

GRAMMAR_SERVER

语法手册文档

  • 直接引用离您最近的 help server

范例:

ip port根据你的 dev server 修改

var GRAMMAR_SERVER = "https://grammar-hk.wikipali.org";

复制巴利语全文搜索单词表

获取pg share dir 在命令行窗口运行

pg_config --sharedir

程序会输出 shardir. createdb

Liunx 把下面/usr/share/postgresql/14替换为你自己的shardir

sudo cp ./public/app/fts/pali.stop /usr/share/postgresql/14/tsearch_data/
sudo cp ./public/app/fts/pali.syn /usr/share/postgresql/14/tsearch_data/

Windows

复制

  • ./public/app/fts/pali.stop
  • ./public/app/fts/pali.syn

到你的 shardir/tsearch_data 目录下

application encryption key

在<工程目录>下运行

php artisan key:generate

数据库迁移

在根目录下运行

php artisan migrate

Redis数据库填充

在命令行运行<项目目录>下面的命令

Liunx

cd ./v1/scripts
sh ./upgrade_redis.sh

Window

cd ./v1/scripts
./upgrade_redis.bat

语料数据库填充

Liunx

cd ./v1/scripts
sh ./install.sh

Window

cd ./v1/scripts
./install.bat

运行时间较长。本地开发环境大约4小时。

如果不想等待,可以导入其他人已经部署好的postgresql数据库

启动消息队列works

php artisan mq:discussion
php artisan mq:pr
php artisan mq:progress
php artisan mq:wbw.analyses

运行dev server

php artisan serve

createdb

在浏览器中访问

http://127.0.0.1:8000

应该出现网站首页

createdb