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.
- Start up your Baserow:
docker-compose -f docker-compose.all-in-one.yml up -d
- Wait for it to become available (
docker logs baserow -f
) - 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
- The export command doesn’t log any success message when it works
- Now the export has run, but the files are inside the container and you need to get them out by running the following commands:
docker cp baserow:/baserow/backend/workspace_YOUR_WORKSPACE_ID.json .
docker cp baserow:/baserow/backend/workspace_YOUR_WORKSPACE_ID.zip .
- 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.
-
./dev.sh no_e2e
on it’s own will rundocker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
and then attempt to open tabs into the running containers. Theno_e2e
will ensure it doesn’t try to run the end to end tests. - 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. -
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 theworkspace_XYZ.{json/zip}
files appear in yourbackend
folder in your Baserow git folder with no need for copying. - One thing to note is
./dev.sh
runs all of our services in their own container. So if you rundocker 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.