1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-14 00:59:06 +00:00

Add docker upgrade docs

This commit is contained in:
Nigel Gott 2022-05-10 15:44:28 +00:00
parent d33b6b83df
commit 68d30b690d
4 changed files with 157 additions and 76 deletions

View file

@ -6,6 +6,10 @@ services:
build:
dockerfile: $PWD/deploy/all-in-one/Dockerfile
context: $PWD
environment:
EMAIL_SMTP: 'yes'
EMAIL_SMTP_HOST: 'mailhog'
EMAIL_SMTP_PORT: '1025'
ports:
- "80:80"
- "443:443"

View file

@ -35,7 +35,7 @@ https://www.linode.com/docs/development/version-control/how-to-install-git-on-li
Once you have finished installing all the required software you should be able to run
the following commands in your terminal.
```
```bash
$ docker -v
Docker version 20.10.6, build 370c289
$ docker-compose -v

View file

@ -20,7 +20,7 @@ https://www.linode.com/docs/development/version-control/how-to-install-git-on-li
After installing all the required software you should be able to run the following
commands in your terminal.
```
```bash
$ docker -v
Docker version 20.10.12, build e91ed57
$ docker-compose -v
@ -38,12 +38,15 @@ You can download the example Baserow `docker-compose.yml` by either directly dow
the file from
[https://gitlab.com/bramw/baserow/-/blob/master/docker-compose.yml](https://gitlab.com/bramw/baserow/-/blob/master/docker-compose.yml)
and running:
```bash
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:
```bash
$ cd ~/baserow
$ git clone --depth=1 --branch master https://gitlab.com/bramw/baserow.git
@ -73,6 +76,7 @@ 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
```
@ -80,65 +84,88 @@ 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](configuration.md) for information on the
other environment variables you can configure.
See [Configuring Baserow](configuration.md) for information on the other environment
variables you can configure.
## How to set environment variables
You can set these variables by using docker-compose env file
(https://docs.docker.com/compose/environment-variables/#the-env-file):
1. Copy the `.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
```
2. Edit `.env` and provide values for the missing environment variables.
3. `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):
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
```
## Upgrading from Baserow version 1.9.0 or later
1. It is recommended that you backup your data before upgrading, see the Backup sections
below for more details on how to do this.
2. Stop your existing Baserow install when safe to do so:
`docker-compose down`
3. Get the latest Baserow version by running:
`git pull`
4. Startup the new version of Baserow by running: `docker-compose up -d`
5. Monitor the logs using: `docker-compose logs -f`
6. Once you see the following log line your Baserow upgraded and is now available again:
```
[BASEROW-WATCHER][2022-05-10 08:44:46] Baserow is now available at ...
```
## Upgrading from Baserow 1.8.2's docker-compose file
> 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:
To upgrade from 1.8.2's docker-compose file from inside the Baserow git repo you need
to:
1. Stop your existing Baserow install when safe to do so:
`docker-compose down`
2. `git pull`
3. Copy `.env.example` to `.env` and edit `.env` filling in the missing variables
below:
3. Copy `.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).
- `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`.
4. Run the command below which will change the baserow postgresql users password to
what you have set in step 1 in the .env file (no need to edit the command):
- `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`.
4. Run the command below which will change the baserow postgresql users password to what
you have set in step 1 in the .env file (no need to edit the command):
```
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'"
```
5. `docker-compose up -d`
5. `docker-compose up -d`
## How To
### Running management commands
You can see and run the Baserow backend management commands like so:
```bash
docker-compose exec backend /baserow/backend/docker/docker-entrypoint.sh help
```
@ -152,9 +179,9 @@ $ docker-compose logs
### Run Baserow alongside existing services
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
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.
```bash
@ -226,8 +253,8 @@ SYNC_TEMPLATES_ON_STARTUP=false docker-compose up -d
### Back-up your Baserow DB
1. Please read the output of `docker-compose run backend manage backup_baserow --help`.
2. Please ensure you only back-up a Baserow database which is not actively being used
by a running Baserow instance or any other process which is making changes to the
2. Please ensure you only back-up a Baserow database which is not actively being used by
a running Baserow instance or any other process which is making changes to the
database.
```bash
@ -243,8 +270,8 @@ docker-compose run -v ~/baserow_backups:/baserow/backups backend backup -f /base
### Restore your Baserow DB from a back-up
1. Please read the output of `docker-compose run backend manage restore_baserow --help`
1. Please ensure you never restore Baserow using a pooled connection but instead do
the restoration via direct database connection.
1. Please ensure you never restore Baserow using a pooled connection but instead do the
restoration via direct database connection.
1. Make a new, empty database to restore the back-up file into, please do not overwrite
existing databases as this might cause database inconsistency errors.

View file

@ -9,8 +9,8 @@
> Please check that your docker is up-to date by running `docker -v`.
This guide assumes you already have Docker installed and have permissions to run Docker
containers. See the [Install on Ubuntu](install-on-ubuntu.md) for a installation from
scratch instead.
containers. See the [Install on Ubuntu](install-on-ubuntu.md) for an installation from
scratch.
## Quick Start
@ -33,7 +33,8 @@ docker run \
* Change `BASEROW_PUBLIC_URL` to `https://YOUR_DOMAIN` or `http://YOUR_IP` to enable
external access.
* Add `-e BASEROW_CADDY_ADDRESSES=https://YOUR_DOMAIN` to enable
[automatic Caddy HTTPS](https://caddyserver.com/docs/caddyfile/automatic-https#overview).
[automatic Caddy HTTPS](https://caddyserver.com/docs/caddyfile/automatic-https#overview)
.
* Optionally add `-e DATABASE_URL=postgresql://user:pwd@host:port/db` to use an external
Postgresql.
* Optionally add `-e REDIS_URL=redis://user:pwd@host:port` to use an external Redis.
@ -65,7 +66,57 @@ single container for ease of use. A quick summary of its features are:
* Provides a CLI for execing admin commands against a running Baserow container or
running one off commands against just a Baserow data volume.
## Example Commands
## Upgrading from a previous version
1. It is recommended that you backup your data before upgrading, see the Backup sections
below for more details on how to do this.
2. Stop your existing Baserow container:
```bash
docker stop baserow
```
3. Bump the image version in the `docker run` command you usually use to run your
Baserow and start up a brand-new container:
```bash
# We haven't yet deleted the old Baserow container so you need to start this new one
# with a different name to prevent an error like:
# `response from daemon: Conflict. The container name "/baserow" is already in use by
# container`
docker run \
-d \
--name baserow_version_REPLACE_WITH_NEW_VERSION \
# YOUR STANDARD ARGS HERE
baserow/baserow:REPLACE_WITH_LATEST_VERSION
```
5. Baserow will automatically upgrade itself on startup, follow the logs to monitor it:
```bash
docker logs -f baserow_version_REPLACE_WITH_NEW_VERSION
```
6. Once you see the following log line your Baserow upgraded and is now available again:
```
[BASEROW-WATCHER][2022-05-10 08:44:46] Baserow is now available at ...
```
7. Make sure your Baserow has been successfully upgraded by visiting it and checking
everything is working as expected and your data is still present.
8. If everything works you can now remove the old Baserow container.
> WARNING: If you have not been using a volume to persist the `/baserow/data` folder
> inside the container this will delete all of your Baserow data stored in this
> container permanently.
```bash
docker rm baserow
```
# Example Commands
See [Configuring Baserow](configuration.md) for more detailed information on all the
other environment variables you can configure.
@ -181,8 +232,8 @@ docker run \
### With a Postgresql server running on the same host as the Baserow docker container
This is assuming you are using the postgresql server bundled by ubuntu. If not then
you will have to find the correct locations for the config files for your OS.
This is assuming you are using the postgresql server bundled by ubuntu. If not then you
will have to find the correct locations for the config files for your OS.
1. Find out what version of postgresql is installed by running
`sudo ls /etc/postgresql/`
@ -198,6 +249,7 @@ you will have to find the correct locations for the config files for your OS.
8. Check the logs do not have errors by running
`sudo less /var/log/postgresql/postgresql-YOUR_PSQL_VERSION-main.log`
9. Run Baserow like so:
```bash
docker run \
-d \
@ -218,8 +270,8 @@ docker run \
### Supply secrets using files
The `DATABASE_PASSWORD`, `SECRET_KEY` and `REDIS_PASSWORD` environment variables
can instead be loaded using a file by using the `*_FILE` variants:
The `DATABASE_PASSWORD`, `SECRET_KEY` and `REDIS_PASSWORD` environment variables can
instead be loaded using a file by using the `*_FILE` variants:
```bash
echo "your_redis_password" > .your_redis_password
@ -277,8 +329,8 @@ docker run -it \
## Backing up and Restoring Baserow
Baserow stores all of its persistent data in the `/baserow/data` directory by default.
We strongly recommend you mount a docker volume into this location to persist
Baserows data so you do not lose it if you accidentally delete your Baserow container.
We strongly recommend you mount a docker volume into this location to persist Baserows
data so you do not lose it if you accidentally delete your Baserow container.
> The backup and restore operations discussed below are best done on a Baserow server
> which is not being used.
@ -318,9 +370,8 @@ docker run --rm -v new_baserow_data_volume $PWD:/backup ubuntu bash -c "mkdir -p
### Backup only Baserow's Postgres database
Please ensure you only back-up a Baserow database which is not actively being used
by a running Baserow instance or any other process which is making changes to the
database.
Please ensure you only back-up a Baserow database which is not actively being used by a
running Baserow instance or any other process which is making changes to the database.
Baserow stores all of its own data in Postgres. To backup just this database you can run
the command below.
@ -359,9 +410,9 @@ docker run -it --rm \
## Running healthchecks on Baserow
The Dockerfile already defines a HEALTHCHECK command which will be used by software
that supports it. However if you wish to trigger a healthcheck yourself on a running
Baserow container then you can run:
The Dockerfile already defines a HEALTHCHECK command which will be used by software that
supports it. However if you wish to trigger a healthcheck yourself on a running Baserow
container then you can run:
```bash
docker exec baserow ./baserow.sh backend-cmd backend-healthcheck
@ -408,9 +459,8 @@ docker run \
baserow/baserow:1.10.0
```
Or you can just store it directly in the volume at `baserow_data/env` meaning it will
be loaded whenever you mount in this data volume.
Or you can just store it directly in the volume at `baserow_data/env` meaning it will be
loaded whenever you mount in this data volume.
### Building your own image from Baserow