您好,登錄后才能下訂單哦!
如果是局域網,部署的電腦擁有固定ip(下文叫宿主機,切記)。電腦能打開cup的虛擬功能。如果部署到云主機,道理是一樣的。
環(huán)境是win7以上,win10以下。Win10區(qū)別就是安裝的docker軟件不同而已。
第一步:確定電腦打開了cpu虛擬打開。https://jingyan.baidu.com/article/22fe7ced3b4c003002617f17.html
第二步:下載和安裝docker toolbox,默認安裝即可。下載地址http://get.daocloud.io/,下載支持舊版windows的docker toolbox,win10就直接下載docker了。
第三步:啟動docker后在里面拉取Onlyoffice Document Server 的Docker鏡像
拉取鏡像sudo docker pull onlyoffice/documentserver
建議用離線的:
(存出命令Administrator@604TFALNDKDKJWCMINGW64 ~/winfont
$ dockersave -o onlyofficedocumentserver.tar onlyoffice/documentserver)
dockerload < onlyofficedocumentserver.tar
docker run-i-t-d-p9000:80onlyoffice/documentserver
//進入容器(運行的鏡像)內
$ dockerexec -it 38e27 /bin/bash
root@38e27823ae92:/#dir或者ls –al
root@6dfa5705aaef:~#cd /usr/share/fonts/
root@6dfa5705aaef:/usr/share/fonts#ls
truetype X11
//刪除文件夾X11
root@6dfa5705aaef:/usr/share/fonts#rm -R dir X11
rm:cannot remove dir: No such file or directory
root@6dfa5705aaef:/usr/share/fonts#ls
truetype
root@6dfa5705aaef:/usr/share/fonts#cd truetype
root@6dfa5705aaef:/usr/share/fonts/truetype#ls –al
root@6dfa5705aaef:/usr/share/fonts/truetype#ls -al
total462392
drwxr-xr-x11 root root 4096 Feb 19 04:17 .
………………
//刪除trutype文件夾下所有文件
root@6dfa5705aaef:/usr/share/fonts/truetype#rm -R dir *.*
rm:cannot remove dir: No such file or directory
root@6dfa5705aaef:/usr/share/fonts/truetype#rm -R dir *
rm:cannot remove dir: No such file or directory
rm:cannot remove custom: Device or resource busy
root@6dfa5705aaef:/usr/share/fonts/truetype#ls
custom
root@6dfa5705aaef:/usr/share/fonts/truetype#ls -al
total 12
drwxr-xr-x10 root root 4096 Feb 19 10:14 .
drwxr-xr-x 6 root root 4096 Feb 19 10:12 ..
drwxr-xr-x 2 root root 4096 Feb 19 03:48 custom
……
root@6dfa5705aaef:/usr/share/fonts/truetype#exit
exit
Administrator@604TFALNDKDKJWCMINGW64 ~/winfont
//將當前文件夾C:\Users\Administrator\下的winfont文件夾內的字體全部拷貝到容器的文件夾/usr/share/fonts/truetype中
$ tar -cv* | docker exec -i 6df tar x -C /usr/share/fonts/truetype
kaiu.ttf
msjh.ttc
msjhbd.ttc
msjhl.ttc
msyh.ttc
msyh.ttf
msyhbd.ttc
msyhl.ttc
simfang.ttf
simhei.ttf
simkai.ttf
simli.ttf
simsun.ttc
simsunb.ttf
simyou.ttf
……
Administrator@604TFALNDKDKJWCMINGW64 ~/winfont
//進入容器內
$ dockerexec -it 6df /bin/bash
root@6dfa5705aaef:/#sudo mkfontscale
root@6dfa5705aaef:/#sudo mkfontdir
root@6dfa5705aaef:/#sudo fc-cache -fv
/usr/share/fonts:caching, new cache contents: 0 fonts, 1 dirs
…………
fc-cache:succeeded
root@6dfa5705aaef:/#exit
exit
//退出容器
Administrator@604TFALNDKDKJWCMINGW64 ~/winfont
$ dockerexec 6df /usr/bin/documentserver-generate-allfonts.sh
GeneratingAllFonts.js, please wait...Done
onlyoffice-documentserver:docservice:stopped
onlyoffice-documentserver:docservice:started
onlyoffice-documentserver:converter:stopped
onlyoffice-documentserver:converter:started
[html] view plain copy
<!DOCTYPE html>
<html style="height: 100%;">
<head>
<title>fei-OnlyOffice</title>
</head>
<body style="height: 100%; margin: 0;">
<dividdivid="placeholder" style="height: 100%"></div>
<script type="text/javascript"src="http://安裝docker電腦的ip:9000/web-apps/apps/api/documents/api.js"></script>
<scripttypescripttype="text/javascript">
//alert({{.Doc.FileName}});
window.docEditor = newDocsAPI.DocEditor("placeholder",
{
"document": {
"fileType": "{{.fileType}}",
"key": "{{.Key}}",//"Khirz6zTPdfd7"
"title": "{{.Doc.FileName}}",
"url": "http://運行engineercms電腦的ip/attachment/onlyoffice/{{.Doc.FileName}}"
},
"documentType":"{{.documentType}}",
"editorConfig": {
"callbackUrl": "http:// 運行engineercms電腦的ip /url-to-callback?id={{.Doc.Id}}",
"user": {
"id": "{{.Uid}}",
"name": "{{.Uname}}"
},
"lang": "zh-CN",//"en-US",
},
"height": "100%",
"width": "100%"
});
</script>
</body>
</html>
[plain] view plain copy
type Callback struct {
Key string `json:"key"`
Status int `json:"status"`
Url string `json:"url"`
Changesurl string `json:"changesurl"`
History history `json:"history"`
Users []string `json:"users"`
Actions []action `json:"actions"`
Lastsave string `json:"lastsave"`
Notmodifiedbool `json:"notmodified"`
}
type action struct {
Type int
userid string
}
type history struct {
changes []change
serverVersionstring
}
type change struct {
created string
User User1
}
type User1 struct {
id string
name string
}
//關閉瀏覽器標簽后獲取最新文檔保存到文件夾
func (c *OnlyController) UrltoCallback() {
// pk1 :=c.Ctx.Input.RequestBody
id :=c.Input().Get("id")
//pid轉成64為
idNum, err :=strconv.ParseInt(id, 10, 64)
if err != nil {
beego.Error(err)
}
//根據附件id取得附件的prodid,路徑
onlyattachment,err := models.GetOnlyAttachbyId(idNum)
if err != nil {
beego.Error(err)
}
var callbackCallback
json.Unmarshal(c.Ctx.Input.RequestBody,&callback)
ifcallback.Status == 1 || callback.Status == 4 {
c.Data["json"]= map[string]interface{}{"error": 0}
c.ServeJSON()
} else ifcallback.Status == 2 {
resp, err :=http.Get(callback.Url)
if err != nil{
beego.Error(err)
}
body, err :=ioutil.ReadAll(resp.Body)
if err != nil{
beego.Error(err)
}
deferresp.Body.Close()
if err != nil{
beego.Error(err)
}
f, err :=os.OpenFile(".\\attachment\\onlyoffice\\"+onlyattachment.FileName,os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
if err != nil{
beego.Error(err)
}
deferf.Close()
_, err =f.Write(body)
if err != nil{
beego.Error(err)
} else {
err =models.UpdateOnlyAttachment(idNum)
if err !=nil {
beego.Error(err)
}
}
c.Data["json"]= map[string]interface{}{"error": 0}
c.ServeJSON()
}
}
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。