How to Install Grist on a VPS with Docker: A Spreadsheet That Works Like a Database
It starts as a simple spreadsheet — inventory, order tracking, a team schedule — and slowly turns into something nobody fully trusts: dozens of columns, formulas pointing at other formulas, and copies floating around named final-really-final-v2.xlsx. Once two people edit different copies, nobody knows which numbers are right. Cloud spreadsheet tools fix the version problem, but your data lives on the provider's servers, and the better features sit behind a paid plan.
Grist takes a different approach. It looks like a spreadsheet, but underneath, every document is a relational database: tables can link to each other, columns carry strict data types, and formulas are written in Python. This guide installs Grist Community edition — the free open source version — on a VPS with Docker Compose, with Nginx in front as a reverse proxy. When you finish, your team opens the same document in a browser, edits together, and the data stays on your own server.
Prerequisites
- A Linux VPS with Docker and Docker Compose v2 installed. Give it at least 2 GB of RAM; Grist runs several processes inside a single container.
- A domain pointed at the VPS IP, for example
data.example.com. This guide uses that domain; replace it with yours. - SSH access to the VPS and
sudorights. - Your email address for the first administrator account.
Check Docker and Compose on the VPS first:
docker --version
docker compose versionExpected result: both commands print version numbers without errors.
Step 1: generate a session secret and a data folder
Grist needs a secret for signing session cookies. Generate one with OpenSSL:
openssl rand -hex 32Expected result: a single long line of hexadecimal characters. Note it down — you will paste it into the Compose file. Do not change it after the installation is running, because a changed secret ends all active login sessions.
Create a working folder at /opt/grist:
sudo mkdir -p /opt/grist/data
cd /opt/gristStep 2: write the Compose file
Create a compose.yml file:
sudo nano compose.ymlFill it with the following, replacing data.example.com with your domain, you@example.com with your email, and the secret with the value from step 1:
services:
grist:
image: gristlabs/grist
container_name: grist
restart: unless-stopped
ports:
- "127.0.0.1:8484:8484"
volumes:
- ./data:/persist
environment:
GRIST_SESSION_SECRET: replace-with-the-secret-from-step-1
GRIST_DEFAULT_EMAIL: you@example.com
APP_HOME_URL: https://data.example.com
GRIST_SINGLE_ORG: office
GRIST_SANDBOX_FLAVOR: gvisorWhat each part does, following Grist's official documentation:
image: gristlabs/gristis Grist's main image. There is alsogristlabs/grist-oss, which contains only open source code; the main image lets you switch between the Community and full editions from the admin panel../data:/persistis a mandatory volume. Grist stores every document and its databases at/persistinside the container; without this volume, nothing is kept long-term.- Port 8484 is Grist's default port. Here it binds to localhost only; Nginx in the next step forwards outside traffic to it.
GRIST_SESSION_SECRETmust hold a secret value — the official docs stress this variable should not be left empty.GRIST_DEFAULT_EMAILdecides who the first administrator is: the user who logs in with this email becomes the installation's admin.APP_HOME_URLtells Grist its public address. This must be correct when Grist is served from a public domain, because many links and redirects inside the app are built from it.GRIST_SINGLE_ORGlocks the installation to a single team namedoffice, so document URLs do not need a team prefix like/o/team-name. Team names may only use lowercase letters, digits, and hyphens.GRIST_SANDBOX_FLAVOR: gvisorruns each document's formulas inside a sandbox isolated from other documents and from the network. This matters because Grist formulas use full Python — without sandboxing, a formula could read files outside its document.
Save the file (Ctrl+O, Enter, Ctrl+X in nano).
Step 3: start the container and finish the first-run setup
From /opt/grist, run:
sudo docker compose up -dCheck its status:
sudo docker compose ps
sudo docker compose logs --tail=50 gristExpected result: the container is running and the logs show Grist listening on port 8484. Your first visit lands on the boot login page, then the Quick setup wizard — follow that wizard to completion once the domain from the next steps is live, or straight from localhost if you are checking over an SSH tunnel.
Step 4: put Nginx in front as a reverse proxy
Create an Nginx configuration file at /etc/nginx/sites-available/grist:
sudo nano /etc/nginx/sites-available/gristFill it with this block, replacing data.example.com with your domain. It adapts the Nginx example from Grist's official documentation — the WebSocket section is mandatory, because Grist uses WebSockets for real-time collaboration:
server {
listen 80;
server_name data.example.com;
location / {
proxy_pass http://localhost:8484;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}Enable the site, test the configuration, and reload Nginx:
sudo ln -s /etc/nginx/sites-available/grist /etc/nginx/sites-enabled/grist
sudo nginx -t
sudo systemctl reload nginxExpected result: nginx -t reports syntax is ok and test is successful.
Step 5: enable HTTPS and log in for the first time
Install a free Let's Encrypt certificate:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d data.example.comFollow the Certbot prompts and choose the HTTP-to-HTTPS redirect. Then open https://data.example.com: your first visit takes you to the boot login page, then the Quick setup wizard. Sign in with the email you set in GRIST_DEFAULT_EMAIL — that account becomes the administrator, with access to the Installation page in the Admin Panel.
Step 6: build your first document and feel the difference from a plain spreadsheet
From the dashboard, create a new document and try three things that set Grist apart from an ordinary spreadsheet:
- Strict column types. Change a column to Date, Numeric, or Choice. Values that do not fit get rejected instead of silently turning into text — which is how date columns end up holding three different formats.
- Linked tables. Create a Customers table and an Orders table, then connect them with a Reference column. Change a customer name in one place and every order pointing at it reflects the change, with no fragile VLOOKUP formulas.
- Python formulas. Click a formula cell and write Python, for instance to total another column or reformat text. With the gvisor sandbox active, formulas run isolated from other documents.
Other team-friendly features: forms for collecting data from outsiders without giving them document access, per-document and per-workspace sharing, and imports from CSV files and existing spreadsheets.
Troubleshooting
The page does not load after docker compose up -d. Check the container is running (sudo docker compose ps), the logs show no errors (sudo docker compose logs --tail=100 grist), and Nginx forwards to the right port (sudo nginx -t). Grist needs a few seconds to be ready on first start.
Login loops or redirects to the wrong address. The APP_HOME_URL value does not match the domain you opened. Fix it in compose.yml, run sudo docker compose up -d, and retry from a private browser window.
Real-time collaboration does not work, but static pages load. The WebSocket section of the Nginx configuration is missing or wrong. Make sure the proxy_http_version 1.1 line and the Upgrade and Connection headers are present exactly as in step 4 — without all three, the connection cannot upgrade to a WebSocket.
Formulas fail with a sandbox error. Check whether the VPS processor supports gvisor (most modern x86_64 chips do) and whether the SYS_PTRACE capability is available in your container environment. Grist's official docs cover diagnosing this; as a temporary way out, you can drop the GRIST_SANDBOX_FLAVOR line and restart, keeping in mind formulas are then no longer isolated.
All documents vanish after the container is recreated. The ./data volume was not mounted, for instance because Compose was run from another folder. Always run docker compose from /opt/grist and confirm /opt/grist/data holds document files before restarting.
Summary table
| Component | Role | Port / path | Notes |
|---|---|---|---|
| grist | Spreadsheet-database app | 127.0.0.1:8484 (internal) | Image gristlabs/grist, Community edition |
| Nginx | Reverse proxy + TLS + WebSocket | 80 and 443 public | Forwards to 127.0.0.1:8484 |
| Certbot | Let's Encrypt certificates | — | Automatic renewal via systemd timer |
| Data volume | Documents and databases | /opt/grist/data:/persist | Mandatory; without it nothing is kept |
| gvisor sandbox | Python formula isolation | — | Via GRIST_SANDBOX_FLAVOR |
Final checklist
- The grist container is running and the logs show Grist listening on port 8484.
https://data.example.comloads with a valid certificate and HTTP redirects to HTTPS.- Login with the administrator email works and the Quick setup wizard is complete.
- One test document exists with two tables linked by a Reference column.
- One Python formula runs in the test document without a sandbox error.
- The
/opt/grist/datafolder is covered by your backup plan, since that is where every document lives.
For routine maintenance, run sudo docker compose pull && sudo docker compose up -d from /opt/grist to update the image, then check the logs and one document afterwards. As your team grows, consider enabling document snapshots and a stronger authentication method from the admin panel — both are covered in Grist's official documentation.
Which spreadsheet on your team most deserves to become a database like this — inventory, orders, or scheduling? And what usually breaks in it first: the formulas, the file versions, or the access mess? Tell us in the comments, and if any step above fails on your VPS, paste the error message so it can be discussed.
Baca juga: the Rnevio article "How to Install Docker and Docker Compose on an Ubuntu VPS" covers the foundation used throughout this guide, while the companion guide in this batch is available at the Docuseal guide to self-hosted document signing on a VPS.


Diskusi
Ada pertanyaan atau pengalaman yang ingin dibagikan?
Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.
Tulis komentar