I was looking for private wiki written by Markdown. This post introduces how to create a private wiki by mkdocs + GitLab CI + Heroku.
mkdocs
“mkdocs” is a simple document builder and converts documents in markdown to HTML. One of the famous themes is “material.”
mkdocs.yaml
site_name: Notebook
theme:
name: 'material'
language: 'ja'
extra:
search:
language: 'ja'
GitLab CI
Putting a config file .gitlab-ci.yaml
in the root path in git repository.
.gitlab-ci.yaml
build-mdfiles:
image: python:3.7-alpine
stage: build
script:
- pip install -r requirements.txt
- mkdocs build
# test
- apk add git
- git clone --depth 1 https://github.com/nulltask/heroku-static-provider.git static-site
- cd static-site/
- git config user.email 'koya@koyama.me'
- git config user.name 'koya'
- git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APPNAME.git
- git pull heroku master
- cp -r ../site/* public/
- git add .
- git commit -a -m `date +deploy_%Y%M%d_%H%m%S`
- git push heroku master
Setting secret variables on Repository. Settings => CI/CD => Variables
Heroku
Following these steps:
- Create Heroku account
- Setup Heroku CLI ENV
- Create a site on Heroku
heroku create
- Optional: If you wish to use BasicAuth, you should run these commands.
heroku config:set -a=koyawiki USER=YOUR_USER
heroku config:set -a=koyawiki PASS=YOUR_PASS
コメントを残す