https://www.datascienceblog.net/post/other/staticman_comments/
https://vincenttam.gitlab.io/post/2018-09-16-staticman-powered-gitlab-pages/2/
https://yasoob.me/posts/running_staticman_on_static_hugo_blog_with_nested_comments/
-
Create a new GitHub account for the Staticman API
-
Create a GitHub token with repo acccess (check the repo checkbox) for the new account: https://github.com/settings/tokens,
-
Clone an instance of Staticman:
git clone https://github.com/eduardoboucas/staticman/
-
Move into the staticman folder:
cd ~/staticman
-
In the staticman folder, create a file called
Procfile
and store a single line in there:web: npm start
-
Create a private RSA key for use with the API:
openssl genrsa -out key.pem
-
Create a Heroku account
-
Log into the Heroku CLI using
heroku login
, -
Create a new Staticman app and configure it:
heroku create {nameOfYourStaticmanApp}` heroku config:set NODE_ENV="production" heroku config:set RSA_PRIVATE_KEY="$(cat key.pem)" heroku config:set GITHUB_TOKEN="Your_Token"
-
Create a production branch:
git checkout -b production origin/dev
-
Add
!config.production.json
to.gitignore
-
Commit the changes:
git add config.production.json Procfile .gitignore git commit -m "Set up Staticman v3 for deployment to Heroku"
-
Deploy the API:
git push heroku production:master
-
After the API has been built successfully, you should be greeted with Hello from Staticman version 3.0.0! when visiting your API instance at https://{nameOfYourStaticmanApp}.herokuapp.com.
On POST using the API endpoint https://{nameOfYourStaticmanApp}.herokuapp.com/v3/entry/github/{githubUsername}/{repositoryName}/{branchName}/{folderLikeCommentsOrReviews}
the instance should show an error: "Internal Server Error"
To fix it use this pull request eduardoboucas/staticman#288
git pull origin pull/288/head
git push heroku
It's better to select a minimal set of priviledges for the GitHub token.