7 快速开始
young edited this page 2022-07-11 17:42:09 +08:00
This file contains ambiguous Unicode characters

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问题。

2MSYS2存在无法引用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

11clone前端代码 将前端代码克隆到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其他说明 通过页面注册都第一个用户为平台管理员用户。