Notes on exporting a Baserow workspace from `docker-compose.all-in-one.yml` or when using `./dev.sh`

I recently typed up some notes on how to export workspaces when using docker-compose.all-in-one.yml or ./dev.sh and wanted to share them here for anyone else who might find it useful in the future:

Exporting the workspace from an all-in-one container

docker-compose.all-in-one.yml runs Baserow in a single container, with a embedded/internal Postgres running inside of that container by default. This makes it tricky, but not impossible to connect to that database from outside of the container.

You should be able to run the following commands to get your workspace out of your all-in-one container.

  1. Start up your Baserow: docker-compose -f docker-compose.all-in-one.yml up -d
  2. Wait for it to become available (docker logs baserow -f)
  3. Now run the export command but inside the container: docker exec -it baserow ./baserow.sh backend-cmd manage export_workspace_applications YOUR_WORKSPACE_ID --indent
  4. The export command doesn’t log any success message when it works
  5. Now the export has run, but the files are inside the container and you need to get them out by running the following commands:
  6. docker cp baserow:/baserow/backend/workspace_YOUR_WORKSPACE_ID.json .
  7. docker cp baserow:/baserow/backend/workspace_YOUR_WORKSPACE_ID.zip .
  8. Now you should have the template .json and .zip outside of the container in your normal filesystem in the directory you ran the docker cp commands.

Using dev.sh instead

Our ./dev.sh script is just a wrapper around running docker-compose -f docker-compose.yml -f docker-compose.dev.yml commands however it does a number of things to make sure the dev env works properly. It also opens up tabs with shells inside of the various containers allowing you to easily run commands like the export ones above.

  1. ./dev.sh no_e2e on it’s own will run docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build and then attempt to open tabs into the running containers. The no_e2e will ensure it doesn’t try to run the end to end tests.
  2. If the tab opening worked, you should see a backend lint tab. This is where you will be able to run commands like ./baserow export_workspace_applications YOUR_WORKSPACE_ID --indent and it will just work as expected.
  3. dev.sh also mounts various folders on your filesystem into the container, so when you run the ./baserow export_workspace_applications YOUR_WORKSPACE_ID --indent you should just see the workspace_XYZ.{json/zip} files appear in your backend folder in your Baserow git folder with no need for copying.
  4. One thing to note is ./dev.sh runs all of our services in their own container. So if you run docker ps you’ll see all of the various Baserow services. This also means you can directly access say the postgres database as it is already listening on port 5432 on your machine etc.