DEV Community

Jain Wun
Jain Wun

Posted on

自己的hackmd自己架 - Codimd

更多會員限定文章可以到patreon觀看


Codimd是hackmd的開源版,雖然主要功能仍含hackmd差不多

但並沒有提供像是hackmd的團隊管理系統

他可以使用heroku, docker compose, k8s來架

Herkou

這是裡面最簡單的架設方式,點一下heroku的按鈕就好

https://heroku.com/deploy?template=https://github.com/hackmdio/codimd/tree/master

Config

會有一些環境變數可以設定,當然也可以deploy完後再去修改

image.png

https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration

::heroku的DB是直接使用plugin,不用去設定CMD_DB_URL::


如果在create app時有遇到錯誤

Item could not be created:

We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy.

::先去fork codimd的專案,然後把button和app.json裡面的連結改掉::

https://heroku.com/deploy?template=https://github.com/username/codimd/tree/master
Enter fullscreen mode Exit fullscreen mode
{
"repository": "https://github.com/username/codimd",
}
Enter fullscreen mode Exit fullscreen mode

如果成功create app但是有error

2022-03-23T13:45:56.526766+00:00 app[web.1]: npm ERR! 
2022-03-23T13:45:56.526878+00:00 app[web.1]: npm ERR! Failed at the codimd@2.4.1 start script.
2022-03-23T13:45:56.527016+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2022-03-23T13:45:56.530491+00:00 app[web.1]: 
2022-03-23T13:45:56.530721+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-03-23T13:45:56.530822+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2022-03-23T13_45_56_527Z-debug.log
2022-03-23T13:45:56.725946+00:00 heroku[web.1]: Process exited with status 1
2022-03-23T13:45:56.816721+00:00 heroku[web.1]: State changed from starting to crashed
Enter fullscreen mode Exit fullscreen mode

一樣得fork repo,然後去package.json改node版本

{
"engines": {
    "node": "12.22.1"
  },
}
Enter fullscreen mode Exit fullscreen mode

記得deploy裡面的github要和fork的repo link起來

Top comments (0)