Self-hosting Grist made easy with Yunohost

image + image

Yunohost is an operating system based on Debian aiming at democratizing self-hosting, thus making easy the administration of a server. You can know more about it here: What is YunoHost? | Yunohost Documentation

When you use Yunohost, you can install packaged application in a few clicks. You can browse the catalog here:

Lately, I have packaged Grist, it takes less than 10 minutes to get your Grist instance all set up, it is quite straightforward: YunoHost app store | Grist

Hope it will help people here to self-host Grist with the least technical knowledges!

You can browse the code and star the repository on Github: GitHub - YunoHost-Apps/grist_ynh: Grist package for YunoHost


Thank you Florent,
that’s a good new for me!
I test it now


1 Like

How will upgrading grist work when new versions come out? Will the option to upgrade show up in the yuno host admin panel? Are upgrades reliant someone maintaining the repo, or are they the automatic?


Yunohost has both a admin UI panel and a CLI that includes a simple way to upgrade debian packages as well as Yunohost apps: Upgrades | Yunohost Documentation

Most of the time, you won’t have any other steps than triggering the Grist app upgrade.

In the Upgrade panel, yes.

Both are true: a bot checks whether there is a new release in Github repository every day, and when it is the case:

  • a PR in the application repository is open here: Pull requests · YunoHost-Apps/grist_ynh · GitHub
  • the bot triggers the CI check;
  • the maintainer (currently me) has to check whether the CI passed, maybe check for breaking changes upstream and bring fixes, and then merge into the testing branch (as it names suggest, made for anyone to try this version) and then in master (this branch is for production ready deployments);

You can see a typical workflow here triggered when a new version is released here:

Thank for your work on this! I started using it and and its really easy to set up. The only problem that I am running into using grist with yunohost is that I don’t know how to add myself as the owner of the team site that I created. If you’ve figured out how to get team sites to work using yunohost I would really appreciate some guidance.

These are my currently set environment variables

Hi @Giovanni_Plascencia,
By chance, did you use this command to create the team site?

$ curl -X POST -H "content-type:application/json" -d '{"name": "foo"}' \
    -H "Authorization: Bearer $BEARER" http://localhost:8484/api/orgs

And got redirected to /o/<org_domain>/billing/payment?billingTask=signUpLite?

If that’s the case, I edited my comment accordingly to Paul suggestion, in order to add the domain in the passed JSON.

Feedback welcome!

@Florent_F, thank you for that! I didn’t know we could create orgs through the API. Now I have a new issue. The return response is the login html for the yunohost portal. Is there some configuration that didn’t do on my end? The Umami app has a specific permission for API access, could this be something that you’ll need to configure for the yunohost installation of grist?

Thanks for your help!

In order to do that, you should either:

  • make Grist available;
  • or run it on the server, replacing the domain by localhost:PORT where PORT is the result of this command: sudo yunohost app setting grist port

Probably specific permissions for the API could be interesting. If you’re willing to open a PR on Github for that, or at least an issue, that would be great.

Thank you for the help @Florent_F! It took me a moment to figure out what you meant by “one the server” To make it clear for anyone reading in the future:
you need to rune this command in the command line of your server where $BEARER is your API key

$ curl -X POST -H "content-type:application/json" -d '{"name": "foo", "domain": "foo"}' -H "Authorization: Bearer $BEARER" http://localhost:8484/api/orgs

Also for future readers: if you are wanting API access to your self hosted instance using yunohost like I was you’ll need to modify your nginx config
WARNING you may break your config. Take a backup or be sure you know what you are doing. Also, don’t trust code or commands from strangers on the internet without knowing what it does.

In the command line of your server you can navigate to your grist nginx config and start editing using nano by doing.

sudo nano /etc/nginx/conf.d/

Replace with the hostname of your grist instance.
Add the following to your server block that listens on 443.

location /api {
    access_by_lua_block { }
    proxy_pass http://localhost:8484; # Replace 8484 with the actual port Grist is running on if its not 8484
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

Add the location block above this line found within the server block:

access_by_lua_file /usr/share/ssowat/access.lua;

You can close the file doing ctrl+x and then entering “y” to save. Test your nginx config to make sure its valid by doing
sudo nginx -t

If the test passes you can reload nginx by doing
sudo systemctl reload nginx

The location /api block will expose all the API endpoints for your yunohost instance. The access_by_lua_block { } makes it so that anyone on the internet can reach those enpoints without being logged into your yunohost instance. This should be fine as an api token is needed to authenticate into the grist API.

If you happen to be using nodejs client to call the API like I am, your DOC_URL parameter should be${documentId} where example is replaced by your hostname.