It’s a pity that some GitLab users have removed Staticman from their repo. I saw demand for Staticman from Framagit users. Therefore, after two days of testing, another API instance for Framagit has been created at https://staticman-frama.herokuapp.com. (Edit: typo edited, please see my comment below.)
The default GitLab base URL is set to “https://gitlab.com”. To provide Staticman support for a self-hosted GitLab service, another Staticman API server has to be set up.
I tried applying for OpenShift, but it’s been reported on Reddit that it takes about 10–20 days to get started. Amazon requires verification by credit card. I couldn’t deploy Staticman using Zeit Now’s Node.js server builder. Finally, I turned back to Heroku.
To minimise the mistakes, here’s a list of procedures that I’ve adopted for this deployment. You may view the source code of the public API instance for Framagit for details.
- I cloned the
deploy
branch of my fork of Staticman. - I created a new Heroku app for this clone.
- I copied the GitHub and GitLab tokens saved in Heroku config variables.
- I generated an RSA key and update Heroku config variable
RSA_PRIVATE_KEY
. - I created a
framagit
branch from this branch. - I deployed the app to Heroku.
- I tested this deployment by changing the form action URL of an existing Staticman + GitLab demo site. A web developer tool in a modern web browser will be useful for this. Testing is with Postman is even better for debugging, but that requires the installation of the app.
- I added a line for using the corresponding Heroku config variable as the
gitlabBaseUrl
in the API config. - I set Heroku config variable for GitLab base URL as “https://gitlab.com”, which is the default value.
- I repeated step 7 to see that step 9 was working.
- I repeaded step 9 with a custom GitLab instance “https://framagit.org”.
- I replaced the GitLab token stored in the Heroku config variable by the one for Framagit.
- I deployed Staticman again to Heroku.
- I repeated step 7 to see that steps 11–12 were working.