Any questions, problems or suggestions with this guide? Ask a question in our community or contribute the change yourself at https://gitlab.com/bramw/baserow/-/tree/develop/docs .
If you haven’t already installed docker and docker-compose on your computer you can do so by following the instructions on https://docs.docker.com/desktop/ and https://docs.docker.com/compose/install/.
Docker-compose version 3.4 and Docker version 19.03 are the minimum versions required by our provided files.
If you want to get the docker-compose.yml via git then you can install it by following https://www.linode.com/docs/development/version-control/how-to-install-git-on-linux-mac-and-windows/ .
After installing all the required software you should be able to run the following commands in your terminal.
$ docker -v
Docker version 20.10.12, build e91ed57
$ docker-compose -v
docker-compose version 1.26.2, build eefe0d31
$ git --version
git version 2.25.1
If all commands return something similar as described in the example, then you are ready to proceed!
You can download the example Baserow docker-compose.yml
by either directly downloading
the file from
https://gitlab.com/bramw/baserow/-/blob/master/docker-compose.yml
and running:
curl -o docker-compose.yml https://gitlab.com/bramw/baserow/-/raw/master/docker-compose.yml
curl -o Caddyfile https://gitlab.com/bramw/baserow/-/raw/master/Caddyfile
docker-compose up -d
or by directly cloning our git repo so you can get updates easier:
$ cd ~/baserow
$ git clone --depth=1 --branch master https://gitlab.com/bramw/baserow.git
$ cd baserow
$ docker-compose up -d
# To update to the latest run:
docker-compose down
git pull
docker-compose up -d
Baserow will take a couple of minutes on your first startup before it works. This is because the templates need to be installed.
There is a security flaw with docker and the ufw firewall. By default docker when exposing ports on 0.0.0.0 will bypass any ufw firewall rules and expose the above container publicly from your machine on its network. If this is not intended then please set HOST_PUBLISH_IP to 127.0.0.1 so Baserow can only be accessed from the machine it is running on. Please see https://github.com/chaifeng/ufw-docker for more information and how to setup ufw to work securely with docker.
To use this docker-compose.yml to run Baserow you must set the three required
environment variables in the x-backend-required-variables
section inside the
docker-compose.yml
and review the variables in the x-common-important-variables
section. If you receive the following error it is because you need to set the required
environment variables first:
ERROR: Missing mandatory value for "environment" option interpolating
If you are upgrading from Baserow 1.8.2 or earlier please read the additional section below.
See Configuring Baserow for information on the other environment variables you can configure.
You can set these variables by using docker-compose env file (https://docs.docker.com/compose/environment-variables/#the-env-file):
.env.example
file found in the root of Baserows repository
(https://gitlab.com/bramw/baserow/-/blob/master/.env.example) to .env
:curl -o .env https://gitlab.com/bramw/baserow/-/raw/master/.env.example
.env
and provide values for the missing environment variables.docker-compose up
Alternatively you can set these variables by either running docker-compose with the environment variables set on the command line (fill in secure values first):
SECRET_KEY= DATABASE_PASSWORD= REDIS_PASSWORD= docker-compose up
If you were previously using a separate api.your_baserow_server.com domain this is no longer needed. Baserow will now work on a single domain accessing the api at YOUR_DOMAIN.com/api.
To upgrade from 1.8.2’s docker-compose file from inside the Baserow git repo you need to:
docker-compose down
git pull
.env.example
to .env
and edit .env
filling in the missing variables
below:
SECRET_KEY
to a secure value, existing logins sessions will be invalidated.DATABASE_PASSWORD
to a secure password (this defaulted to ‘baserow’ before, in
step 3 we are going to change the database users password to the value you set)REDIS_PASSWORD
to a secure password.WEB_FRONTEND_PORT
back to 3000 if you want to continue accessing Baserow on
that port (it now defaults to 80).BASEROW_PUBLIC_URL
to the URL/IP/Domain you were using access Baserow remotely
(it must begin with http:// or https://). If you have set WEB_FRONTEND_PORT
to
anything but 80 you must append it to the end of BASEROW_PUBLIC_URL
.BASEROW_CADDY_ADDRESSES
configures which addresses the new internal Caddy reverse
proxy listens on. By default, it will serve http only, enable automatic https
by setting to https://YOUR_DOMAIN_NAME.com
. Append ,http://localhost
if you
still want to be able to access Baserow from localhost
.docker-compose run --rm backend bash -c "PGPASSWORD=baserow psql -h db -U baserow -c \"ALTER USER baserow WITH PASSWORD '$DATABASE_PASSWORD';\" && echo 'Successfully changed Baserow's db user password'"
docker-compose up -d
You can see and run the Baserow backend management commands like so:
docker-compose exec backend /baserow/backend/docker/docker-entrypoint.sh help
$ docker-compose logs
Baserow’s docker-compose files will automatically expose the caddy
service on your
network on ports 80 and 433 by default. If you already have applications or
services using those ports the Baserow service which uses that port will crash. To fix
this you can set the WEB_FRONTEND_PORT
variable to change the default of port 80 and
WEB_FRONTEND_SSL_PORT
to change the default port of 443.
$ WEB_FRONTEND_SSL_PORT=444 WEB_FRONTEND_PORT=3000 docker-compose up
If you have a domain name and have correctly configured DNS then you can run the following command to make Baserow available at the domain with automatic https provided by Caddy.
Append
,http://localhost
to BASEROW_CADDY_ADDRESSES if you still want to be able to access your server from the machine it is running on using http://localhost. See Caddy’s Address Docs for all supported values for BASEROW_CADDY_ADDRESSES.
BASEROW_PUBLIC_URL=https://www.REPLACE_WITH_YOUR_DOMAIN.com \
BASEROW_CADDY_ADDRESSES=https://www.REPLACE_WITH_YOUR_DOMAIN.com \
docker-compose up
WEB_FRONTEND_SSL_PORT= \
BASEROW_PUBLIC_URL=https://www.REPLACE_WITH_YOUR_DOMAIN.com \
docker-compose up
WEB_FRONTEND_PORT=3000 \
BASEROW_PUBLIC_URL=https://www.REPLACE_WITH_YOUR_DOMAIN.com:3000 \
docker-compose up
You can disable automatic migration by setting the MIGRATE_ON_STARTUP
environment
variable to false
(or any value which is not true
) like so:
MIGRATE_ON_STARTUP=false docker-compose up -d
# Use run if you have stopped your docker-compose environment
docker-compose run backend manage migrate
# Use exec otherwise
docker-compose exec backend /baserow/backend/docker/docker-entrypoint.sh manage migrate
You can disable automatic baserow template syncing by setting the
SYNC_TEMPLATES_ON_STARTUP
environment variable to false
(or any value which is
not true
) like so:
SYNC_TEMPLATES_ON_STARTUP=false docker-compose up -d
docker-compose run backend manage backup_baserow --help
.mkdir ~/baserow_backups
# The folder must be the same UID:GID as the user running inside the container, which
# for the local env is 9999:9999, for the dev env it is 1000:1000 or your own UID:GID
# when using ./dev.sh
sudo chown 9999:9999 ~/baserow_backups/
docker-compose run -v ~/baserow_backups:/baserow/backups backend backup -f /baserow/backups/baserow_backup.tar.gz
# backups/ now contains your Baserow backup.
docker-compose run backend manage restore_baserow --help
docker-compose run -v ~/baserow_backups:/baserow/backups backend restore -f /baserow/backups/baserow_backup.tar.gz