eduardoboucas / staticman

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

Heroku shutting down their free tier #451

Open DawnPaladin opened 1 year ago

DawnPaladin commented 1 year ago

Heads up: Heroku is eliminating their free services, starting November 28. Staticman has long recommended Heroku for their free services, and the documentation walks users through setting up hosting on Heroku; that documentation will need to be changed.

There are a number of competitors seeking to replace Heroku in this market niche. I've looked at a number of them and my current favorite is fly.io. They have a dedicated Heroku importer which has worked pretty well for me.

matheusamazonas commented 1 year ago

Thank you for the tip. I just migrated my Heroku Staticman app to fly.io and it works like a charm.

ka2in commented 1 year ago

@DawnPaladin: Thank you very much for the hint. Please share your feedback about any issues that you might have faced during the migration process. @matheusamazonas: Thank you for sharing your thoughts with us. I am currently hosting Staticman on Heroku, and I intend to migrate my app, too. Are there any settings that need to be changed during the migration?

turian commented 1 year ago

@DawnPaladin @matheusamazonas I spent an hour trying to get Heroku working unsuccessfuly :(

I might try netlify as suggested here: https://github.com/eduardoboucas/eleventy-blog-staticman

ka2in commented 1 year ago

@turian:

Did you try using a different version (v1 or v2) for the API post request?

<form method="POST" action="https://api.staticman.net/v3/entry/github/eduardoboucas/staticman/gh-pages/comments">

Check the logs on Heroku. That might help finding out what's causing your issue.

matheusamazonas commented 1 year ago

@ka2in The migration was as simple as it could be, to be honest. I only had to choose the Fly.io app name, which Heroku app should it migrate, and that was it. I was kind of impressed about how easy it was.

matheusamazonas commented 1 year ago

@turian It's hard to pinpoint what your problem could be without extra information. I did struggle a bit while trying to set it up on Heroku, but everything was easily fixable.

Rubonnek commented 1 year ago

I was looking into this recently, and I figured that Staticman can run as a Google Cloud Function with an ugly POST redirection patch. Here is my fork that implements that.

As a Google Cloud Function, Staticman will be able to handle 2 million POST requests per month for free.

Essentially free for small blogs.

ianrenton commented 1 year ago

@Rubonnek I just wanted to say thanks for your effort here! I preferred GCF over Fly.io or Netlify for no real reason other than not having to create an account with yet another company - and it works great thanks to your patch.

A couple of notes for anyone doing the same:

I hope that helps! I get about 2 comments a month so I'm hoping 2 million POST requests will be enough 😆

RyanTG commented 1 year ago

Fly.io's heroker importer worked well for me. The importer actually appeared to get stuck, but when I went to the dashboard the app was running. After that, just had to change the github app webhook url and change the API link in the site config.yml.

VincentTam commented 1 year ago

@turian:

Did you try using a different version (v1 or v2) for the API post request?

<form method="POST" action="https://api.staticman.net/v3/entry/github/eduardoboucas/staticman/gh-pages/comments">

Check the logs on Heroku. That might help finding out what's causing your issue.

i suggest using v3 for two-folded reasons:

ℹ️ It's possible that one (personal) API server serve both GitLab and GitHub sites.

ka2in commented 1 year ago

@DawnPaladin @matheusamazonas I wanted to give your suggestion a try, but then I was asked for my credit card details in the middle of the process. No way to import an app from Heroku before selecting a payment method.

RyanTG commented 1 year ago

We’re living in a post-heroku world. They disabled the free tier in part because of people signing up and using resources, and the competitors have learned from this and most require cards.

jamesmortensen commented 1 year ago

I just migrated my Heroku instance to Cyclic. They have free accounts and don't require credit cards. To get setup, I had to fork this repo, since eduardo's repos wouldn't show up in the list. I also had to deploy from master, not dev.

After moving over my GITHUB_TOKEN and RSA_PRIVATE_KEY, and changing the URL in staticman.yml to point to the new instance, everything seems to be working.

erikw commented 1 year ago

More Heroku alternatives are listed at https://github.com/Engagespot/heroku-free-alternatives

ka2in commented 1 year ago

@erikw @jamesmortensen: Thank you very much for introducing more alternatives to Heroku.

jamesmortensen commented 1 year ago

@Rubonnek the gcloud integration looks cool. With a little bit more effort, I think you could write a wrapper around it that would allow users of Staticman to choose between the default standalone mode and cloud function mode.

However, the upstream project isn't active, so I'm not sure if it's a good time investment if there is no one to evaluate and merge the pull request.

@VincentTam does v3 still support PAT tokens? I think I am still on v2 because I didn't create a GitHub app.

VincentTam commented 1 year ago

@VincentTam does v3 still support PAT tokens? I think I am still on v2 because I didn't create a GitHub app.

@jamesmortensen

Git provider ✔️ / ❌
GitHub ✔️
GitLab

I encourage you to move to GitHub App for issues addressed by PR 243.

ka2in commented 1 year ago

I finally migrated my app to Render without any big issues.

  1. Deploy as a Web Service.
  2. Node environment.
  3. Enter the environment variables you were using on Heroku
  4. Adjust your webhook URL and change the URL you're pointing to for the POST requests.

You can also set a different name for your Web Service on Render under Settings. That's it.

ka2in commented 1 year ago

Would be nice if people update their tutorials on the net to explain the migration process for new users. The Getting Started on the Staticman official website is not a detailed resource for newcomers.

jamesmortensen commented 1 year ago

@ka2in would you be able to write one for Render? I should be able to have time soon to do one for cyclic.sh.

Since there is no one to approve and merge pull requests, I think we could just post links to those tutorials in this issue.

ka2in commented 1 year ago

@jamesmortensen yes, sure. I'll prepare a tutorial for Render.

prateekdwv commented 1 year ago

@ka2in When deploying the app on Render, it prompts

Staticman API running on port 10000

But the build never finishes. It remains stuck on "in progress". It builds fine locally but there seems to be some trouble in deployment which I'm struggling to figure out. Is there by any chance you faced the same issue or know a workaround to fix it?

ka2in commented 1 year ago

Here's my tutorial: https://github.com/ka2in/heroku-render-migration/wiki/Migrating-your-Staticman-instance-from-Heroku-to-Render

ka2in commented 1 year ago

@prateekdwv What did you choose under Environment (runtime environment for your web service) in Render? I'm getting comments without any issues through my instance on Render.

anaxonda commented 1 year ago

I just migrated staticman to fly.io using the linked Heroku importer. Very simple.

andsplat commented 1 year ago

The fly.io migration tool kept failing for me. It said the app was not found. I then manually cloned a copy of staticman to fly.io and copied my secrets from Heroku. That "mostly" seemed to work, but when the app runs, I'm getting an error about the RSA key not being found. Thoughts on what to try next?

VincentTam commented 1 year ago

i've given up trying the RSA key cuz RSA won't be safe in post-quantum era.

andsplat commented 1 year ago

@VincentTam I'm not able to get the app to run without the RSA though as it kills my app on fly.io. Not sure why I'm having these issues as people above seem to have had no issues using the Heroku to fly.io migration tool. It's just not working for me and my manual clone of staticman and migration of my secrets are not working. I'm a bit confused on how to fix this.

andsplat commented 1 year ago

What port are you all using on fly.io in the config.js staticman file? I think that is where my app is failing. Fly.io is looking for 8080, but staticman is trying to use the default 0. Does that make sense?

hispanic commented 1 year ago

When I first migrated to Fly.io, I kept receiving failure reports:

% flyctl launch

Release v1 created
==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 1 unhealthy [health checks: 1 total, 1 critical]
Failed Instances

Failure #1

Instance
ID          PROCESS VERSION REGION  DESIRED STATUS  HEALTH CHECKS       RESTARTS    CREATED   
e92b862b    app     1       ewr     run     running 1 total, 1 critical 0           5m22s ago   

Recent Events
TIMESTAMP               TYPE        MESSAGE                 
2022-11-28T02:55:10Z    Received    Task received by client 
2022-11-28T02:55:36Z    Task Setup  Building Task Directory 
2022-11-28T02:55:37Z    Started     Task started by client  

2022-11-28T02:55:39Z   [info]Staticman API running on port 8098
--> v1 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v2 

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

I eventually fixed this by setting/changing internal_port = 8098 in the fly.toml file (to match my staticman config).

andsplat commented 1 year ago

Thanks, @hispanic! I updated both my config.js and fly.toml to match on the port and that seems to work. I am able to now get the "Hello from Staticman version 3.0.0!" message when I go to the URL.

I updated my api url in my website config file and changed my GitHub Application webhook address, but it failed when doing a test post to the new fly.io instance. Some of the messages that I received:

[@octokit/app] Deprecated. Use @octokit/app-auth instead. See https://github.com/octokit/app.js/#deprecated

(node:536) UnhandledPromiseRejectionWarning: Error: error:0906D06C:PEM routines:PEM_read_bio:no start line

(node:536) 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(). (rejection id: 4)

(node:536) [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.

[error] could not send HTTP request to instance: connection error: timed out

Did you have any issues when attempting a first test comment?

hispanic commented 1 year ago

Nope. No issues after that, I believe. Make sure you set your secrets (env vars), including your private key: % flyctl secrets set -a [your-app-name] RSA_PRIVATE_KEY="$(cat key.pem)"

Full disclosure, I'm using a custom fork, not the official Staticman. (I'm not encouraging usage of my fork, at least not by anyone expecting support.)

andsplat commented 1 year ago

Thanks, @hispanic. Are you not seeing the depreciation warning around @octokit/app being deprecated and needing to use @octokit/app-auth instead?

hispanic commented 1 year ago

Nope, no warning for me.

andsplat commented 1 year ago

@hispanic Yeah, I'm very confused. I am able to use the Fly.io webhook in my Github app, but when I change from my Heroku api call in my comment form HTML post URL to the Fly.io api URL, I get the following error:

iad [error] could not send HTTP request to instance: connection error: timed out

It seems that I am able to authenticate to the Fly.io instance since I can use the webhook URL in my GitHub app, but I don't know why my post URL is not working.

hispanic commented 1 year ago

I'm not sure what to say. Standard debugging procedures apply. Try to figure out the differences between the calls by recreating both the success and error conditions using something such as Insomnia, Postman, etc. Good luck.

andsplat commented 1 year ago

Thanks @hispanic. I'll try and figure that out (I'm primarily a designer, so I still have a lot to learn about debugging issues).

hispanic commented 1 year ago

Roger that. A time out error implies, to me, some sort of configuration error beyond Staticman.

That said, personally, I don't believe that Staticman is maintained, packaged, supported, or coded cleanly enough to be reliably stood-up by those who are not willing and able to dig into the code a bit. This is not a criticism of anyone, including Eduardo. I'm very thankful the codebase is available for use, regardless of any weaknesses I see it as having.

samusz commented 2 months ago

Please change the text and link saying Heroku has a free plan on your website. It's somewhat confusing when one lands on the Heroku website and can't find it (any more)! Best, Take care

RyanTG commented 2 months ago

@samusz If you’re referring to something in the docs, you can make the edit yourself and submit a PR https://github.com/eduardoboucas/staticman.net