One-click deploy to Heroku, no installation needed #407
Replies: 1 comment 1 reply
-
Hey, thanks for this guide. It's been more helpful than the official docs, however it's still really confusing. I will point out the issues, hopefully they can be clarified to the benefit of future users, thanks. (1): (2): going to
(3): for the config table, I assume you DONT need all 6 variables, just 4 - (4): I see |
Beta Was this translation helpful? Give feedback.
-
Originally posted in https://github.com/pacollins/hugo-future-imperfect-slim/wiki/staticman.yml, credits to @pacollins for reviewing and organizing my guide with headers for readability.
Setting up your own Staticman API instance on Heroku
yourapp dot herokuapp dot com
.Git Provider setup
Follow either one of the three sub-sections.
GitHub
Create a GitHub apps: https://docs.github.com/en/developers/apps/creating-a-github-app. You can leave the default values unchanged, except for the mandatory fields.
<your-api>/v1/webhook
.Then generate a RSA keypair at the bottom of the page. A RSA private key would be automatically downloaded.
I recommend making this app private and personal.
Don't forget to install this app to the GitHub repo for your static website after having finished the setup in the next section.
To know more, you may see Jan Hajek's article about Staticman v3.
Note: There is no need to hit the
/connect
route in Staticman v3 because we're using a GitHub App instead of a GitHub bot account here.GitLab.com
Create a GitLab bot account and obtain a personal access token with scopes
api
andread_repository
.Add your GitLab bot account as a developer to your GitLab repo for your static website. This can be done by going to your project, then Settings → Members → Invite member, and finally searching for your GitLab bot.
Note: There is no need to hit the
/connect
route in Staticman v3 because once a GitLab account is invited to a GitLab repo, it can start committing to the GitLab repo. Unlike GitHub, there's no need for the invited GitLab account to accept the invitation.Framagit
Since Framagit is a fork of GitLab, the overall setup is the same as that for GitLab. The only difference is that you need to add an extra environment variable
GITLAB_BASE_URL
with valuehttps://framagit.org
.Config variables via Heroku's online dashboard
Here're the necessary variables to get the instance running.
NODE_ENV
production
RSA_PRIVATE_KEY
openssl genrsa -out key.pem
GITHUB_APP_ID
GITHUB_PRIVATE_KEY
GITLAB_TOKEN
GITLAB_BASE_URL
To store a multi-line RSA private key, you may first input the environment variable name. Then click the pen icon 🖊️ on the right in order to show a text area for editing. A simple copy and paste would do, as shown in the screenshot below.
To know more about the API variables, the best way is to read https://github.com/eduardoboucas/staticman/blob/master/config.js.
Beta Was this translation helpful? Give feedback.
All reactions