eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.41k stars 534 forks source link

Improve documentation for self-hosted staticman + gitlab #441

Open rriemann opened 2 years ago

rriemann commented 2 years ago

Dear all,

I have been reading many blog posts about staticman. I've managed to install it on https://uberspace.de and expose it to https://my-domain/staticman. However, whenever I try to submit a comment, I get the error: Error: Require an oauthToken or token option

  express:router dispatching POST /v2/entry/my-domain/master/comments +24s
  express:router query  : /v2/entry/blog.riemann.cc/master/comments +2ms
  express:router expressInit  : /v2/entry/blog.riemann.cc/master/comments +0ms
  express:router jsonParser  : /v2/entry/blog.riemann.cc/master/comments +1ms
  express:router urlencodedParser  : /v2/entry/blog.riemann.cc/master/comments +1ms
  express:router githookHandler  : /v2/entry/blog.riemann.cc/master/comments +15ms
  express:router <anonymous>  : /v2/entry/blog.riemann.cc/master/comments +0ms
(node:25449) UnhandledPromiseRejectionWarning: Error: Require an `oauthToken` or `token` option
    at /home/rriemann/staticman/build/lib/GitHub.js:47:15
    at new GitHub (/home/rriemann/staticman/build/lib/GitHub.js:59:7)
    at _default (/home/rriemann/staticman/build/lib/GitServiceFactory.js:20:14)
    at /home/rriemann/staticman/build/lib/Staticman.js:58:55
    at new Staticman (/home/rriemann/staticman/build/lib/Staticman.js:69:7)
    at _default (/home/rriemann/staticman/build/controllers/process.js:141:27)
    at Layer.handle [as handle_request] (/home/rriemann/staticman/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/rriemann/staticman/node_modules/express/lib/router/route.js:137:13)
    at /home/rriemann/staticman/build/server.js:244:14
    at Layer.handle [as handle_request] (/home/rriemann/staticman/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/rriemann/staticman/node_modules/express/lib/router/route.js:137:13)
    at /home/rriemann/staticman/build/server.js:208:14
    at Layer.handle [as handle_request] (/home/rriemann/staticman/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/rriemann/staticman/node_modules/express/lib/router/route.js:137:13)
    at module.exports.<anonymous> (/home/rriemann/staticman/node_modules/express-brute/index.js:142:36)
    at module.exports.MemoryStore.set (/home/rriemann/staticman/node_modules/express-brute/lib/MemoryStore.js:28:35)
    at module.exports.<anonymous> (/home/rriemann/staticman/node_modules/express-brute/index.js:127:17)
    at module.exports.MemoryStore.get (/home/rriemann/staticman/node_modules/express-brute/lib/MemoryStore.js:38:35)
    at module.exports.<anonymous> (/home/rriemann/staticman/node_modules/express-brute/index.js:82:15)
    at keyFunc (/home/rriemann/staticman/node_modules/express-brute/index.js:39:41)
    at module.exports.<anonymous> (/home/rriemann/staticman/node_modules/express-brute/index.js:47:3)
    at Layer.handle [as handle_request] (/home/rriemann/staticman/node_modules/express/lib/router/layer.js:95:5)
(node:25449) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:25449) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I don't understand how I can tell staticman to rely on Gitlab instead of Github. I am confused with respect to API v2 and v3.

I would appreciate a guide that explains how to setup Staticman for Gitlab with example configurations for staticman.yml and production.json.

All the best! Robert

hispanic commented 2 years ago

@rriemann Yeah, the project and docs aren't packaged up well these days. I can say that GitLab definitely works - or at least it worked several months ago when I last did a build. However, I got it all to work by looking at the code. You might have more success by looking at the latest code for the documentation site - https://github.com/eduardoboucas/staticman.net

ghost commented 2 years ago

I'm in a similar position, trying to follow documentation / blog posts but am stuck with Error: Require an oauthToken or token option when submitting a comment. (Looking around in the latest code for the documentation site wasn't able to get me unstuck)

Best! Kris

rriemann commented 2 years ago

I eventually programmed some Ruby CGI code that receives a POST request and sends the the comment in a YAML file per email attachment. For just very few comments, this seems to be a workable solution for me that does not require yet Staticman.

ghost commented 2 years ago

Hi Robert, that seems like it would be a great solution for me. Very interested if you end up making that code public!

UtkarshVerma commented 2 years ago

Has there been any updates regarding this? I'm getting this error even on GitHub.

rriemann commented 2 years ago

Hi Robert, that seems like it would be a great solution for me. Very interested if you end up making that code public!

Hi @kris-github-bot , please find my code to send comments (in yaml format) from the blog to my email address here: https://blog.riemann.cc/2021/12/27/jekyll-import-disqus-comments-for-staticman/#receiving-new-comments

Let me know if you spot security problems! ;)