forgeplus/deploy.md

123 lines
2.4 KiB
Markdown
Raw Normal View History

2020-11-30 11:39:28 +08:00
2020-11-30 11:50:41 +08:00
# 本地开发部署
2020-11-26 15:16:23 +08:00
2020-11-30 11:39:28 +08:00
## Depends Versions
* Ruby 2.4.5
* Rails ~> 5.2
* MySql ~> 5.6
* Redis 5+
* NodeJS > 13.0.0
2020-11-30 11:39:28 +08:00
## Steps
2021-03-30 15:15:17 +08:00
### 1. 克隆稳定版本仓库
```
git clone -b standalone https://git.trustie.net/jasder/forgeplus.git
```
### 2. 安装依赖包
2020-11-26 15:16:23 +08:00
```bash
bundle install
```
2021-03-30 15:15:17 +08:00
### 3. 配置初始化文件
2020-11-26 15:16:23 +08:00
进入项目根目录执行一下命令:
```bash
cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml
touch config/redis.yml
touch config/elasticsearch.yml
```
2021-03-31 10:08:20 +08:00
### 4. 配置数据库
数据库配置信息请查看/config/database.yml文件
项目默认采用mysql数据库, 如需更改,请自行修改配置信息,
默认配置如下:
```bash
default: &default
adapter: mysql2
host: 127.0.0.1
encoding: utf8
username: root
password: 123456
```
### 4. 配置gitea服务(可选)
2020-11-26 15:16:23 +08:00
**如需要部署自己的gitea平台请参考gitea官方平台https://docs.gitea.io/zh-cn/install-from-binary/**
2020-12-24 10:07:36 +08:00
**因目前gitea平台api受限暂时推荐从forge平台获取gitea部署文件进行部署https://forgeplus.trustie.net/projects/jasder/gitea-binary**
2020-11-26 15:16:23 +08:00
#### 配置gitea服务步骤
1. 部署gitea服务并注册root账户
2. 修改forge平台的 config/configuration.yml中的gitea服务指向地址
```ruby
gitea:
access_key_id: 'root'
access_key_secret: 'password'
domain: 'http://www.gitea.example.com'
base_url: '/api/v1'
```
2021-03-31 10:08:20 +08:00
### 5. 安装redis环境
2020-11-26 15:16:23 +08:00
**请自行搜索各平台如何安装部署redis环境**
2021-03-31 10:08:20 +08:00
### 6. 创建数据库
2020-11-26 15:16:23 +08:00
```bash
rails db:create
```
2021-03-31 10:08:20 +08:00
### 7. 导入数据表结构
2020-11-26 15:16:23 +08:00
```bash
bundle exec rake sync_table_structure:import_csv
```
2021-03-31 10:08:20 +08:00
### 8. 执行migrate迁移文件
2020-11-26 15:16:23 +08:00
**开发环境为development 生成环境为production**
```bash
rails db:migrate RAILS_ENV=development
```
2021-03-31 10:08:20 +08:00
### 9. clone前端代码
2020-12-28 13:42:59 +08:00
**将前端代码克隆到public/react目录下目录结构应该是: public/react/build**
```bash
2021-03-30 15:15:17 +08:00
git clone -b standalone https://git.trustie.net/jasder/build.git
2020-12-28 13:42:59 +08:00
```
2021-03-31 10:08:20 +08:00
### 10. 启动redis(此处已mac系统为例)
2020-11-26 15:16:23 +08:00
```bash
redis-server&
```
2021-03-31 10:08:20 +08:00
### 11. 启动sidekiq
2020-11-26 15:16:23 +08:00
**开发环境为development 生成环境为production**
```bash
bundle exec sidekiq -C config/sidekiq.yml -e production -d
```
2021-03-31 10:08:20 +08:00
### 12. 启动rails服务
2020-11-26 15:16:23 +08:00
```bash
rails s
```
2021-03-31 10:08:20 +08:00
### 13. 浏览器访问
2020-11-26 15:16:23 +08:00
在浏览器中输入如下地址访问:
```bash
http://localhost:3000/
```
---