mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
优化部署流程
This commit is contained in:
88
README.md
88
README.md
@@ -34,18 +34,52 @@ GitLink(确实开源)是中国计算机学会(CCF)官方指定的开源
|
||||
* imagemagick
|
||||
|
||||
### 步骤
|
||||
|
||||
(1)克隆稳定版本
|
||||
(1)安装 Rails 必要的一些三方库:
|
||||
- Mac OS X
|
||||
```bash
|
||||
brew install imagemagick ghostscript libxml2 libxslt libiconv
|
||||
```
|
||||
|
||||
- Ubuntu
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y openssl libssl-dev imagemagick git ruby-dev nodejs libmariadb-dev libmysqlclient-dev shared-mime-info libpq-dev libxml2-dev libxslt-dev
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata
|
||||
sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
```
|
||||
|
||||
(2)安装 Ruby, Rails 运行环境:[如何快速正确的安装 Ruby, Rails 运行环境](https://ruby-china.org/wiki/install_ruby_guide)
|
||||
```bash
|
||||
#检验环境是否正确
|
||||
ruby -v
|
||||
#ruby 2.4.x ...
|
||||
|
||||
gem -v
|
||||
#3.x.x
|
||||
|
||||
bundle -v
|
||||
#Bundler version 2.x.x
|
||||
|
||||
rails -v
|
||||
#Rails 5.2.x
|
||||
```
|
||||
|
||||
(3)克隆稳定版本
|
||||
```bash
|
||||
git clone -b master https://gitlink.org.cn/Gitlink/forgeplus.git
|
||||
```
|
||||
|
||||
(2)安装依赖包
|
||||
(4)安装依赖包
|
||||
```bash
|
||||
cd forgeplus && bundle install
|
||||
#进入目录
|
||||
cd forgeplus
|
||||
#删除Gemfile.lock
|
||||
rm -rf Gemfile.lock
|
||||
#安装依赖包
|
||||
bundle install
|
||||
```
|
||||
|
||||
(3)配置初始化文件:进入项目根目录执行以下命令
|
||||
(5)配置初始化文件:进入项目根目录执行以下命令
|
||||
```bash
|
||||
cp config/configuration.yml.example config/configuration.yml
|
||||
cp config/database.yml.example config/database.yml
|
||||
@@ -53,8 +87,8 @@ touch config/redis.yml
|
||||
touch config/elasticsearch.yml
|
||||
```
|
||||
|
||||
(4)配置数据库:数据库配置信息请查看/config/database.yml文件,项目默认采用mysql数据库, 如需更改,请自行修改配置信息,默认配置如下
|
||||
```bash
|
||||
(6)配置数据库:数据库配置信息请查看/config/database.yml文件,项目默认采用mysql数据库, 如需更改,请自行修改配置信息,默认配置如下
|
||||
```yaml
|
||||
default: &default
|
||||
adapter: mysql2
|
||||
host: 127.0.0.1
|
||||
@@ -63,7 +97,7 @@ default: &default
|
||||
password: 123456
|
||||
```
|
||||
|
||||
(5)配置gitea服务(可选):如需要部署自己的gitea平台,请参考[gitea官方平台文档](https://docs.gitea.io/zh-cn/install-from-binary/)。因目前gitea平台api受限,暂时推荐从forge平台获取[gitea部署文件](https://www.gitlink.org.cn/Gitlink/gitea-binary)进行部署
|
||||
(7)配置gitea服务(可选):如需要部署自己的gitea平台,请参考[gitea官方平台文档](https://docs.gitea.io/zh-cn/install-from-binary/)。因目前gitea平台api受限,暂时推荐从forge平台获取[gitea部署文件](https://www.gitlink.org.cn/Gitlink/gitea-binary)进行部署
|
||||
|
||||
- 配置gitea服务步骤:
|
||||
|
||||
@@ -71,7 +105,7 @@ default: &default
|
||||
|
||||
-- 修改forge平台的 config/configuration.yml中的gitea服务指向地址,如:
|
||||
|
||||
```ruby
|
||||
```yaml
|
||||
gitea:
|
||||
access_key_id: 'root'
|
||||
access_key_secret: 'password'
|
||||
@@ -79,61 +113,59 @@ gitea:
|
||||
base_url: '/api/v1'
|
||||
```
|
||||
|
||||
(6)安装redis环境:请自行搜索各平台如何安装部署redis环境
|
||||
(8)配置/config/database.yml文件(安装redis环境:请自行搜索各平台如何安装部署redis环境)
|
||||
```yaml
|
||||
default: &default
|
||||
url: redis://localhost:6379
|
||||
db: 1
|
||||
|
||||
(7)安装imagemagick插件:
|
||||
- Mac OS X
|
||||
```bash
|
||||
brew install imagemagick ghostscript
|
||||
production:
|
||||
<<: *default
|
||||
url: redis://localhost:6379
|
||||
```
|
||||
|
||||
- Linux
|
||||
```bash
|
||||
sudo apt-get install -y imagemagick
|
||||
```
|
||||
|
||||
(8)创建数据库:开发环境为development, 生成环境为production
|
||||
(9)创建数据库:开发环境为development, 生成环境为production
|
||||
```bash
|
||||
rails db:create RAILS_ENV=development
|
||||
```
|
||||
|
||||
(9)导入数据表结构
|
||||
(10)导入数据表结构
|
||||
|
||||
```bash
|
||||
bundle exec rake sync_table_structure:import_csv
|
||||
```
|
||||
|
||||
(10)执行migrate迁移文件:开发环境为development, 生成环境为production
|
||||
(11)执行migrate迁移文件:开发环境为development, 生成环境为production
|
||||
```bash
|
||||
rails db:migrate RAILS_ENV=development
|
||||
```
|
||||
|
||||
(11)clone前端代码:将前端代码克隆到public/react目录下,目录结构应该是: public/react/build
|
||||
(12)clone前端代码:将前端代码克隆到public/react目录下,目录结构应该是: public/react/build
|
||||
```bash
|
||||
git clone -b standalone https://gitlink.org.cn/Gitlink/build.git
|
||||
```
|
||||
|
||||
(12)启动redis(此处以macOS系统为例)
|
||||
(13)启动redis(此处以macOS系统为例)
|
||||
```bash
|
||||
redis-server&
|
||||
```
|
||||
|
||||
(13)启动sidekiq:开发环境为development, 生成环境为production
|
||||
(14)启动sidekiq:开发环境为development, 生成环境为production
|
||||
```bash
|
||||
bundle exec sidekiq -C config/sidekiq.yml -e production -d
|
||||
```
|
||||
|
||||
(14)启动rails服务
|
||||
(15)启动rails服务
|
||||
```bash
|
||||
rails s
|
||||
```
|
||||
|
||||
(15)浏览器访问:在浏览器中输入如下地址访问
|
||||
(16)浏览器访问:在浏览器中输入如下地址访问
|
||||
```bash
|
||||
http://localhost:3000/
|
||||
```
|
||||
|
||||
(16)其他说明:通过页面注册以第一个用户为平台管理员用户
|
||||
(17)其他说明:通过页面注册以第一个用户为平台管理员用户
|
||||
|
||||
|
||||
## 页面展示
|
||||
|
||||
Reference in New Issue
Block a user