This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
部署流程
依赖库
-
Ruby 2.4.5
-
Rails ~> 5.2
-
MySql ~> 5.6
-
Redis 5+
-
imagemagick
Windows 部署Tips(可选)
注:本Tips来自王骏儒同学
1. Ruby
(1)建议从官网下载rubyinstaller-devkit-xxx.exe,避免bundle install问题。
(2)MSYS2存在无法引用Windows环境变量的问题,可做如下配置:
- 右键我的电脑->属性->高级系统设置
- 点击环境变量
- 添加新的环境变量
MSYS2_PATH_TYPE = inherit
- 重启MSYS2
2. MySql
(1)在./mysqld.exe时遇到找不到xxx.dll,无法启动mysql server的情况。
- 进入dll官网
- 搜索缺失的dll文件
- 根据Architecture选择位数对应的最新版本zip,并下载
- 解压后,将dll文件复制指定路径:C:\windows\System32 下
步骤
(1)克隆稳定版本
git clone -b standalone https://git.trustie.net/jasder/forgeplus.git
(2)安装依赖包
cd forgeplus && bundle install
(3)配置初始化文件 进入项目根目录执行以下命令:
cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml
touch config/redis.yml
touch config/elasticsearch.yml
(4)配置数据库 数据库配置信息请查看/config/database.yml文件, 项目默认采用mysql数据库, 如需更改,请自行修改配置信息, 默认配置如下:
default: &default
adapter: mysql2
host: 127.0.0.1
encoding: utf8
username: root
password: 123456
(5)配置gitea服务(可选) 如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/
因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/Trustie/gitea-binary
配置gitea服务步骤 1)部署gitea服务,并注册root账户 2)修改forge平台的 config/configuration.yml中的gitea服务指向地址,如:
gitea:
access_key_id: 'root'
access_key_secret: 'password'
domain: 'http://www.gitea.example.com'
base_url: '/api/v1'
(6)安装redis环境 请自行搜索各平台如何安装部署redis环境
(7)安装imagemagick插件
- Mac OS X
brew install imagemagick ghostscript
- Linux
sudo apt-get install -y imagemagick
(8)创建数据库 开发环境为development, 生成环境为production
rails db:create RAILS_ENV=development
(9)导入数据表结构
bundle exec rake sync_table_structure:import_csv
(10)执行migrate迁移文件 开发环境为development, 生成环境为production
rails db:migrate RAILS_ENV=development
(11)clone前端代码 将前端代码克隆到public/react目录下,目录结构应该是: public/react/build
git clone -b standalone https://git.trustie.net/jasder/build.git
(12)启动redis(此处以macOS系统为例)
redis-server&
(13)启动sidekiq 开发环境为development, 生成环境为production
bundle exec sidekiq -C config/sidekiq.yml -e production -d
(14)启动rails服务。
rails s
(15)浏览器访问 在浏览器中输入如下地址访问:
http://localhost:3000/
(16)其他说明 通过页面注册都第一个用户为平台管理员用户。