tankywoo / simiki

Simiki is a simple wiki framework, written in Python.
simiki.org
MIT License
1.15k stars 155 forks source link

能否提供一个小白的部署方法或其它类似参考文章? #23

Closed huangkewang closed 8 years ago

huangkewang commented 10 years ago

如题,我想部署在自己的服务器上。

tankywoo commented 10 years ago

http://simiki.org/quickstart.html

有官方文档。

如果还有疑问可以具体指出来,我来解释。

lord63 commented 10 years ago

@tankywoo 在自己的vps上运行 $ simiki preview 是可以在本地的浏览器通过 http://wiki.example.com:8000 来访问的 那么如果想通过 http://wiki.example.com 就可以访问该如何操作呢?

tankywoo commented 10 years ago

simiki preview 一般情况下仅用于 调试预览 的作用

如果想对外提供 http://wiki.example.com 的web服务,你需要使用web服务器,如Apache或Nginx

lord63 commented 10 years ago

或许可以在文档中增加 Deployment Options

tankywoo commented 10 years ago

@lord63 恩,这个在考虑中,后续会完善文档的

hominlinx commented 9 years ago

可不可以用github部署啊?

lord63 commented 9 years ago

@hominlinx Yep, have a look: http://simiki.org/docs/deploy.html

hominlinx commented 9 years ago

谢谢 但是我的咋这样啊?? 也用了yasimple主题了啊 ?? http://hominlinx.github.io/wiki/

hominlinx commented 9 years ago

还有你的那几个例子的域名是从哪弄得 买的吗? 谢谢

tankywoo commented 9 years ago

@hominlinx CSS路径有问题,你这里用到了二级目录

主题里配置CSS文件路径应该改为:

    <link rel="Stylesheet" type="text/css" href="{{ site.root }}/static/css/style.css">
    <link rel="Stylesheet" type="text/css" href="{{ site.root }}/static/css/tango.css">

且在 _config.yml 中配置:

root: /wiki

域名是在 NameCheap 上买的

hominlinx commented 9 years ago

` 主题里配置CSS文件路径应该改为:

<link rel="Stylesheet" type="text/css" href="{{ site.root }}/static/css/style.css">
<link rel="Stylesheet" type="text/css" href="{{ site.root }}/static/css/tango.css">

` 这个跟我的themes/yasimple/base.html 一样的啊啊 ??

tankywoo commented 9 years ago

@hominlinx 配置了url和root吗?wiki的项目在哪?我去看看。

hominlinx commented 9 years ago

https://github.com/hominlinx/hominlinxwiki.github.io/tree/source

tankywoo commented 9 years ago

@hominlinx In _config.yml, add:

root: /wiki

If you modified and test ok, tell me, thx.

hominlinx commented 9 years ago

已经ok,另外我现在使用gitcafe帮我部署了(monkey.gitcafe.com),非常感谢你的开源,不过想问问你为啥使用两个.git ?使用一个.git 达到两个分支的目的 和你这个区别是啥啊? 谢谢

tankywoo commented 9 years ago

@hominlinx

source分支只维护源文件, 生成的output目录是一直动态变化的,没必要污染干净的source分支;

github pages需要的也仅仅是output里的文件

这里不能简单的通过两个分支来维护,因为output是source目录中的一个子目录。按你说的,output和source应该是同一内容的不同状态

另外你可以看看Octopress的部署方式,我也是参考的他们,这种方式非常好。

hominlinx commented 9 years ago

@tankywoo 这种方式确实不错,但是如果我换一台机子, 比如我使用家里的机子, 使用 git clone git@gitcafe.com:monkey/monkey.git 后 拉下来是两个分支, 这样又要重新在output下面git init 重新建立一个本地仓库, 对吧??

hominlinx commented 9 years ago

@tankywoo 非常感谢。 你说的这个方式 我理解了,其实我以前就是这个方式,只是当时没理解 ,唉。。。 工作了 好久也没有在维护自己的blog:http://hominlinx.github.io 现在打算继续起来

lord63 commented 9 years ago

@tankywoo

我们可以把 output 加入 gitignore 来忽略每次生成时的变化,master 分支托管源文件(markdown什么的),gh-pages 分支放 output 的静态文件。如果我们使用的是 Project Pages,过程十分简单,你使用 git push -u origin master 把你的源文件 push 上去,而你要更新你的网站的时候,使用 ghp-import -p output 推送你的 output 中的静态文件就行了,它会自动帮你新建分支并推送到 github,第一次和以后每次都是这样。

we need ghp-import to help us do it more efficiently.

Usage: ghp-import [OPTIONS] DIRECTORY                                       
Options:                                                                    
  -n          Include a .nojekyll file in the branch.                       
  -m MESG     The commit message to use on the target branch.               
  -p          Push the branch to origin/{branch} after committing.          
  -r REMOTE   The name of the remote to push to. [origin]                   
  -b BRANCH   Name of the branch to write to. [gh-pages]                    
  -h, --help  show this help message and exit                               

once you have generate your wiki, pushing the static files to github is esay:

$ pip install ghp-import                                                    
$ ghp-import -p output 
tankywoo commented 9 years ago

@hominlinx 不需要,以github pages with domain 为例,master分支保存源文件、gh-pages分支保存生成的output内容。换一台电脑clone:

git clone -b master git@github.com:username/projectname.git
cd projectname/
git clone -b gh-pages git@github.com:username/projectname.git output

就可以了。

这块我会补充到文档中。

tankywoo commented 9 years ago

@lord63 我晚上回去试试 :)

tankywoo commented 9 years ago

@lord63 赞!这个工具确实很方便,后续我把这个工具补充到文档里。

DandiWong commented 9 years ago

加一个: root: /wiki后,远程pages服务theme效果正常,但本地simiki preview时又会丢失theme渲染效果。

lord63 commented 9 years ago

@siton, have you ever try simiki generate --ignore-root?

NOTE:

If root is setted in _config.yml, you should use --ignore-root when you want to preview in local environment. And regenerate without --ignore-root when you prepare to deploy to remote server.

simiki generate --ignore-root

Documentation: http://simiki.org/docs/deploy.html

tankywoo commented 9 years ago

@lord63 :+1:

tankywoo commented 9 years ago

@lord63 @siton 这块其实应该有更好的方式去解决, 但是暂时还没找到方法。这个问题我一直记录着在。

--ignore-root 算是一个现阶段的临时解决办法,但是不够优美智能。

MForever78 commented 9 years ago

@tankywoo Nice work!

可不可增加一个布署的命令,类似于 hexo deploy。在 _config.yaml 里指定 deploy 的方法,github, git, rsync 之类。

tankywoo commented 9 years ago

@MForever78 :+1: add to todo, 这个功能很重要,后续会加入

zyearn commented 9 years ago

@tankywoo

  1. preview的时候,如果有一个文档修改了,现在是不是需要手动control C然后重新起命令?Octopress是直接监控到变化的文件然后自动显示这个变化的。是不是应该加个这个功能?
  2. 文档的title里是不是还不支持书名号?我写在title里,比如title: "<<linux内核开发>>笔记",generate然后preview,显示的是空title。
tankywoo commented 9 years ago

@zyearn

  1. 恩,这个功能还没有去实现,后续会加上
  2. 如果你的title是"笔记",generate后preview应该显示的是"笔记"吧。这个是html转义的问题。实际的html是:
<div><abc>笔记</div>

html会认为是abc是一个html标签。

这个涉及到Jinja2模板的转义配置,我暂时还没考虑好是否要做这个处理。

如果你需要在title上使用到<, >这类符号,可以修改模板,grep page.titlepage_v.title,并改为page.title|epage_v.title|e,使其在generate时转义。

zyearn commented 9 years ago

@tankywoo 好的,多谢!

tankywoo commented 9 years ago

@lord63 @siton

See 8c472dfd , removed --ignore-root, setting root when preview is no difference on local or remote.

zvving commented 8 years ago

附上一篇自动部署到 github pages 的介绍 http://www.jianshu.com/p/d56008e6c2e1

tankywoo commented 8 years ago

@zvving Cool! 我看了两遍,具体还没去测试。

我看现在你那个项目的分支和文件还有些混乱(比如gh-pages分支没用,master包含了源文件等),如果可以的话,你可以整理下,另开一个issue。

zvving commented 8 years ago

@tankywoo

还有希望在生成的 Wiki 页面(如果判断是部署到 Github Page)增加编辑按钮。如:https://github.com/zvving/zvving.github.io/edit/source/content/mac/ruby-env.md 这样全部通过 web 浏览编辑又方便一层。

Xuanwo commented 8 years ago

@zvving 这个可以用 travis 的命令行工具来生成

gem install travis
travis encrypt-file ssh_key --add

可以参考 https://xuanwo.org/2015/02/07/Travis-CI-Hexo-Autodeploy/ 以及 我用于simiki的travis.yml

不过在授权travis的时候,只需要勾选push,就可以规避这个问题。

tankywoo commented 8 years ago

@zvving

还有希望在生成的 Wiki 页面(如果判断是部署到 Github Page)增加编辑按钮。如:https://github.com/zvving/zvving.github.io/edit/source/content/mac/ruby-env.md 这样全部通过 web 浏览编辑又方便一层。

你是指页面上增加一个编辑托管在github上源文件的链接?

tankywoo commented 8 years ago

@zvving 你的 --force 的问题我解决了,这个原因比较坑,本质是:

Travis CI 做clone时加了--depth操作,这个是克隆单分支的;所以你push时,生成的gh-pages分支和之前的gh-pages分支没有连接起来。

最简单的是加上--no-single-branch选项,但是travis ci不支持做除了depth层级外的其它选项。

所以我只能加了一些hack操作,手动把分支fetch下来:

# hack for git clone with `--depth` only single branch
- git fetch origin gh-pages:refs/remotes/origin/gh-pages
- git branch gh-pages origin/gh-pages

可以看看我的这个生成log: https://travis-ci.org/tankywoo/wiki.tankywoo.com/builds/109810430


另外, @zvving @Xuanwo 我这边发现clone的是https的地址,需要输入username/password,不是走的ssh/git协议,所以我额外hack:

- git remote set-url origin git@github.com:tankywoo/wiki.tankywoo.com.git

我看你们没有遇到,你们那边是怎么解决的?

Xuanwo commented 8 years ago

我用于部署的gh-pages分支是自己手动clone的,所以没有遇到这个问题

Tanky Woo notifications@github.com于2016年2月17日周三 下午4:49写道:

@zvving https://github.com/zvving 你的 --force 的问题我解决了,这个原因比较坑,本质是:

Travis CI 做clone时加了--depth 操作,这个是克隆单分支的;所以你push时,生成的gh-pages分支和之前的gh-pages分支没有连接起来。

最简单的是加上--no-single-branch选项,但是travis ci不支持做除了depth层级外的其它选项。

所以我只能加了一些hack操作,手动把分支fetch下来:

hack for git clone with --depth only single branch

  • git fetch origin gh-pages:refs/remotes/origin/gh-pages
  • git branch gh-pages origin/gh-pages

可以看看我的这个生成log

另外, @zvving https://github.com/zvving @Xuanwo https://github.com/Xuanwo 我这边发现clone的是https的地址,需要输入username/password,不是走的ssh/git协议,所以我额外hack:

  • git remote set-url origin git@github.com:tankywoo/wiki.tankywoo.com.git

我看你们没有遇到,你们那边是怎么解决的?

— Reply to this email directly or view it on GitHub https://github.com/tankywoo/simiki/issues/23#issuecomment-185101650.

zvving commented 8 years ago

@tankywoo

Xuanwo commented 8 years ago

@zvving 能做到这个的话,就不是静态网页啦,不过可以提供本地的前端UI,就看有没有接手这项工作了,233

tankywoo commented 8 years ago

@zvving 这个功能目前不会考虑;你也可以在页面增加一个链接,直接指向github上源文件的edit链接也可以。

格式:

https://github.com/<username>/<project name>/edit/master/path/to/file

另外,这个帖子我先Close了,后续有其它问题可以另开相关的Issue

TheMechanic-K commented 7 years ago

@tankywoo 你好,我是一个行业新人,使用您的作品。老是无法发表文章。您的帮助文档实在太简单了,我也google了好多,而且。想法联系过很多使用者,希望解决。

[root@centos-linux ~]# simiki new | n -c "Simiki" -t "linux" -f "xx" -bash: n: command not found Traceback (most recent call last): File "/usr/bin/simiki", line 11, in sys.exit(main()) File "/usr/lib/python2.6/site-packages/simiki/cli.py", line 403, in main create_new_wiki(args["-c"], args["-t"], args["-f"]) File "/usr/lib/python2.6/site-packages/simiki/cli.py", line 92, in create_new_wiki _title = title.replace(os.sep, " slash ").lower() AttributeError: 'NoneType' object has no attribute 'replace' [root@centos-linux ~]#

希望您解答一下,或者给一份详细的使用帮助文档。 在此表示感谢。

tankywoo commented 7 years ago

@K7777777 你好

simiki new | n -t <title> -c <category> [-f <file>]

其中 new | n 格式表示使用新建文件的子命令 new 或者 n 都可以,增加n 是为了作为 new 的简写。

所以你应该直接写为:

simiki n -c "Simiki" -t "linux" -f "xx"

快速上手使用可以参考:http://simiki.org/quickstart.html

也感谢你的建议,我会考虑将帮助文档再写详细些。

如果还有其它问题,欢迎新开一个 Issue 👍