工单系统ferry 02--本地运行ferry实例

工单系统ferry 02--本地运行ferry实例

1 介绍

工单系统ferry 01–docker部署ferry 已经介绍了如何使用docker部署ferry,本文继上文介绍如何在本地通过源码运行ferry实例,包括前端和后端服务。

2 操作

前置条件
参考 工单系统ferry 01–docker部署ferry 启动一个mysql 和redis 实例,并将host 信息更新到 config/settings.dev.yml 中。


运行后端

git clone https://github.com/lanyulei/ferry.git
git clone https://gitee.com/yllan/ferry.git
cd ferry
go get
go run main.go server -c=config/settings.dev.yml
 
交叉编译:
env GOOS=linux GOARCH=amd64 go build
实际使用的时候根据Dockerfile的方式build,否则生成的可执行文件替换docker中二进制文件后不能正常执行:
 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ferry .

在这里插入图片描述


运行前端

git clone https://github.com/lanyulei/ferry_web.git
git clone https://gitee.com/yllan/ferry_web.git
cd ferry_web
npm config set registry https://registry.npm.taobao.org
npm install
# 若npm install安装失败,可尝试使用一下命令安装
npm install --unsafe-perm --force
npm run dev

输出日志如下:
xghome:~/files/code/github/ferry_web$ npm install --unsafe-perm --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN @babel/helper-define-polyfill-provider@0.3.1 requires a peer of @babel/core@^7.4.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN ferry_web@1.0.0 No repository field.

up to date in 7.847s

81 packages are looking for funding
  run `npm fund` for details

在这里插入图片描述

启动后进入登录界面:
http://localhost:9527/#/login?redirect=%2Fdashboard
在这里插入图片描述


3 注意事项

git 报错处理

npm install --unsafe-perm --force 时候会使用git拉数据,而git当前已经提高了其安全性,因此正常情况会报错:
4537 error   The unauthenticated git protocol on port 9418 is no longer supported.
4537 error Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
解决方法:
git config --global --edit
追加如下内容,然后重新npm install 即可:
[url "https://"]
	insteadOf = ssh://
[url "https://"]
	insteadOf = git://

参考文档:
[The unauthenticated git protocol on port 9418 is no longer supported.的解决方法](https://blog.csdn.net/qq_50796105/article/details/123655483)

执行python报错

npm install --unsafe-perm --force 过程中会使用 python脚本,默认使用的是python2,因此需要 apt install python2 来安装,否则会报错

4 说明

软件环境:
ubuntu 20.04.1 LTS Desktop
Docker 20.10.7
go version go1.18 linux/amd64
node v14.13.1(笔者用16.13.1 编译报错)

参考文档:
主页/ ferry 教程文档/ 手动部署
The unauthenticated git protocol on port 9418 is no longer supported.的解决方法

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

昕光xg

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值