In this post I will do a quick dive on how I setup my own staticman instance in Heroku since the public API and Dev API are no longer responding.
First, this site from yasoob does a great job running down how to get this setup in Github and on Heroku. I will just add af ew changes I made based on the content of Issue #299.
As pointed out in yasoob’s post, and in a ton of issues on the repo, there are a few things amiss with the master branch. And some of the fixes mentioned in the post did not work for me, but here is what did…
As pointed out by the trusty VincentTam in his comment on Issue #299 he points out that in his deploy release he is uing 55d1430
. So, that is what I used as well. And after some testing everything seems to work fine. I am using v3
on both of my sites and the Mailgun
integration and all is working as expected. I have not tested GitLab integration as I do not have a GitLab setup, but I may give it a shot in the future.
So, here is the quick and dirty on how I did it:
- Fork the Staticman Repo
- Create a Heroku app as mentioned above
- Run
git checkout -b workaround 55d1430
to create a branch namedworkaround
from the commit mentioned above. - Push that branch to Heroku using
git push -f heroku workaround:master
. I add the -f because I felt like living dangerously
If you configured all of your environment variables properly you should be good to go! I am running this instance on both NetworkHobo and Dan C Williams using the v3
API without issue.
I know this is quick, but I needed to get it out of my head. Please comment below if there are any questions. Thanks!
32 comments
Xin Zhang
Friday, Aug 23, 2019
Dan
In reply to Xin Zhang
Friday, Aug 23, 2019
Xin,
I just tried it and it worked for me. Here is the link I sent in my browser:
http://staticman-blog.herokuapp.com/v2/encrypt/test_data_to_encrypt
And here I received the encrypted string that was returned in the browser:
SnyVZNWY85qLOTS OF CHARACTERS9QDLMh5waZ2d34w==
If you are still having problems we can look into it further.
Xin Zhang
In reply to Xin Zhang
Friday, Aug 23, 2019
Aha, I see. forgot to add the data after that link, sorry for that mistake.
BTW, mailgun needs to be upgraded by adding card, otherwise we can’t add new domain. But, there’s something wrong with that. I can’t click the button upgrade after filling all info. Anyway, I opened a ticket for that and will let you know later.
Thanks!
Dan
In reply to Xin Zhang
Friday, Aug 23, 2019
Xin Zhang
In reply to Xin Zhang
Wednesday, Aug 28, 2019
Now, the comment system works now. But, I can’t get the notification. Here’re some information:
http://dreambooker-staticman.herokuapp.com/v2/encrypt/
.Is there anything worng?
Xin Zhang
Wednesday, Aug 28, 2019
BTW, sometimes when I add notifications to
staticman.yml
, I would get the commit error when comment. Here’re codes:JINXIANG LU
Sunday, Sep 8, 2019
wini3d
Wednesday, Sep 11, 2019
Hey Dan, Thanks for this. btw, does this include the nested replies feature?
Also would be nice to have a One Click Heroku deployment.
https://github.com/eduardoboucas/staticman/issues/305
Dan
In reply to wini3d
Wednesday, Sep 11, 2019
No worries. The nesting replies really relies upon tracking the reply IDs in your forms and how you structure your output in the Hugo templates. You can see how I do it in the repo for this site.
Comment Form Partial
Render Comments into Post Partial
Hope this helps! Let me know if you have any other questions.
Wini3D
Thursday, Sep 12, 2019
Thanks Dan, I’m actually using Jekyll and trying to add nested replies. I can’t find a clean version to copy to like using it with jekyll/minima theme.
Btw, do you have the heroku repo available for forking somewhere or on github? I can’t seem to get it running with my own heroku app instance and getting this message when posting comments:
{“success”:false,“rawError”:{“message”:"{"message":"Not Found","documentation_url":"https://developer.github.com/v3/git/refs/#create-a-reference"}",“statusCode”:404},“errorCode”:“GITHUB_CREATING_PR”}
Dan
In reply to Wini3D
Thursday, Sep 12, 2019
I currently do not have it up on Github, just here locally. I am getting ready to get on a plane but I can try to get something cleaned and pushed up.
As far as Jekyll, I have not used it. But, I know Minimal Mistakes was one of the pioneers in using Staticman with Replie, Check Here. I used a lot of his logic when learning how to do Staticman in Hugo.
Wini3D
In reply to Wini3D
Thursday, Sep 12, 2019
Thanks Dan and no worries. I got it sorted out with your tutorial here and created the right access token.
Now, I just need to display the nested replies format which I can’t still figure out. :/
Dan
In reply to Wini3D
Friday, Sep 13, 2019
Wini3D
In reply to Wini3D
Friday, Sep 13, 2019
Thanks. Yes, here is my site code. https://github.com/wini3d/minimaj
It seems there is a problem with replying_to not getting sorted out. I have checked some jekyll staticman v2 enabled blogs and I see the _parent is used for the _parent and _id sorting and it works. I then see the new staticman v3 used _parent for the url and not the parent id.
Wini3D
Friday, Sep 13, 2019
Dan
In reply to Wini3D
Friday, Sep 13, 2019
Yudy
Thursday, Sep 19, 2019
i have manage to deploy staticman to heroku (build notification was success)
but when i access the https://xxxx.herokuapp.com “the application eror”
any idea?
Yudy
In reply to Yudy
Saturday, Sep 21, 2019
$(cat ./key.pem)
not working so i have to putRSA_PRIVATE_KEY
manualy in heroku dashboard.Dan
In reply to Yudy
Saturday, Sep 21, 2019
Test
Saturday, Oct 5, 2019
Dan
In reply to Test
Sunday, Oct 6, 2019
wini3d
Monday, Jan 6, 2020
Dan
In reply to wini3d
Tuesday, Jan 7, 2020
Great question!
I have not tried it, but I would start here. Looking at line
24
in thepost-comments.html
file. File details here.Hope my markdown works. I am mobile at the moment.
Let me know!
wini3d
In reply to wini3d
Tuesday, Jan 7, 2020
Dan
In reply to wini3d
Tuesday, Jan 7, 2020
Ah…gotcha…
You would just have to figure out how to do the presentation using the templating engine that Jekyll uses (which I believe is Liquid).
I know the Minimal Mistakes theme for Jekyll uses Staticman so his code is a good place to look. I actually used the logic I found there to work out some of the nested commenting logic for the Hugo implementation.
Dan
Nam Ngo
Saturday, Apr 11, 2020
Hi Dan,
I have build BeautifulHugo with staticman. With notifications, i know staticman using Mailgun for setting. But Mailgun not Free
Dan
In reply to Nam Ngo
Saturday, Apr 11, 2020
Nam,
Thanks for the heads up. I have not looked at the Mailgun plans in years. Since the code is open I am sure the project would be happy to accept a pull request integrating a new mail system.
Teste
Sunday, Apr 12, 2020
Sam
Tuesday, May 5, 2020
Yasoob
Wednesday, Jun 3, 2020
Hi Dan!
I am in the process of moving my Python blog (https://pythontips.com) over from Wordpress to Hugo (and naturally Staticman) as well and I was going through GitHub trying to see if anyone else had migrated comments from Wordpress to Staticman. I found your repo and followed you to your blog. It was quite funny seeing my staticman article linked in this post. I am so glad it has been helpful for others :)
Keep writing such good quality content. Have a wonderful day and stay safe.
John Test
Tuesday, Oct 19, 2021
Test
Monday, Oct 7, 2024
Say something
Thank you
Your post has been submitted and will be published once it has been approved.
OK