[en]
This blog system is not a node module for now, and you need to download whole project from GitHub.
After downloading, you need to create a file named .env.local
in your project root.
NODE_ENV=development # If you want to develop this project
APP_KEYS=APP_KEYS # define APP_KEYS for koa-session
GITHUB_TOKEN= # define your own GitHub token for calling GitHub API
# If you want user to login, you need define following variables, more detail: https://github.com/settings/applications/new
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_OAUTH_CALLBACK=http://localhost:7000/api/oauth
And also, you need to modify .env
file to enable your own GitHub repository information.
GITHUB_REPOSITORY_OWNER_TYPE
should be user
or organization
.
GITHUB_EXCLUDED_LABELS
represents which issue labels you want to exclude displaying in your blog.
Then install dependencies for development or building (yarn
) or for production (yarn run prune
).
That's all you need to do!
Start the sever on development: yarn dev
or on production: yarn build && yarn start
.
Addition
This project provides some useful scripts to deploy to your own server.
If you're using Travis , it will automatically sync built assets to a branch named asstes
, then on your own server, you can run yarn sync:pull
to sync assets
into a folder named assets
, finally you can simply run yarn pm2
to use pm2 holding your server.
[zh]
这个博客系统目前还不是一个 node 模块,你必须从 GitHub 下载整个项目。
下载完成后,你需要在项目根目录创建一个名为 .env.local
的文件
NODE_ENV=development # 如果你希望开发这个项目
APP_KEYS=APP_KEYS # 为 koa-session 定义 APP_KEYS
GITHUB_TOKEN= # 为调用 GitHub API 定义你自己的 GitHub 令牌
# 如果你希望用户可以登录,你需要定义以下的变量,更多详情:https://github.com/settings/applications/new
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_OAUTH_CALLBACK=http://localhost:7000/api/oauth
另外你还需要修改 .env
文件以启用你自己的 GitHub 仓库信息。
GITHUB_REPOSITORY_OWNER_TYPE
应该是 user
或者 organization
.
GITHUB_EXCLUDED_LABELS
代表你希望在你的博客内容中排除的 issue 标签。
然后在开发环境或者打包前运行 yarn
或者在生成环境运行 yarn run prune
安装依赖。
这就是你需要做的所有准备工作!
开发环境运行 yarn dev
启动服务器或者在生产环节运行 yarn build && yarn start
。
附加内容
这个项目提供一些有用的脚本帮助你发布到自己的服务器上。
如果你正在使用 Travis ,它会自动同步构建生成的资源到一个名为 asstes
的分支上,然后你可以在自己的服务器上运行 yarn sync:pull
来同步 assets
到目录 dist
中,最后你可以简单地运行 yarn pm2
以使用 pm2 在后台运行你的应用。