Original source can be found here: https://discord.com/channels/902568124350599239/970338835990974484/1096046227528888340 This gist is a rough example on how to approach this migration in case you're using docker
Author nickmenow, careerlister
Guide to update docker running SurrealDB beta8 to beta9
Starting from a logged in prompt of your computer, EC2 instance, Virtual Machine or box:
-
Follow the guide to download on your operating system the correct extra beta-8 release found here => https://surrealdb.com/docs/installation/upgrading/beta8-to-beta9 Unarchive it to a safe location - perhaps in a new folder. My example is in folder with path /home/ubuntu/beta8_extra
-
Go to docker.com and pull down the latest, nightly or 1.0.0-beta.9 image found here => https://hub.docker.com/r/surrealdb/surrealdb/tags
-
run
sudo docker images
in your instance and locate the IMAGE ID of the image you just pulled. In this case the nightly I am working on now is : e2a7220adbfa -
Modify your docker-compose.yml (or similar) file to add another container running surrealdb with something similar. Keep in mind that your original yml file could be slightly different but make sure to pay attention to the container name, image id, ports and the volumes as each need to be unique from the original container. Save the file.
services:
surrealdb:
# BETA-8 Nightly
image: f362651a2f2a
restart: always
command: start --log warn --user root --pass root file:/data/database.db
ports:
- 80:8000
volumes:
- ./data:/data
surrealdb9:
# BETA-9 Nightly
image: e2a7220adbfa
restart: always
command: start --log warn --user root --pass root file:/data/database.db
ports:
- 8888:8000
volumes:
- ./data_9:/data
-
run
sudo docker compose up -d
Docker should make the changes, add the container and start it on port 8888. -
Test it out by logging into the new running db on port 8888
surreal sql -c http://localhost:8888 --user root --pass root --ns test --db test --pretty
Then run a query likeINFO FOR DB
to get the info for that db. (EC2 folks need to update the securitygroup to open port 8888) -
Make an export of the data from beta8 (using the port from the yml file)
/home/ubuntu/beta8_extra/surreal export --conn http://localhost:80 --user root --pass root --ns production --db production "beta8backup/production-bak-$(date +"%Y_%m_%d_%I_%M_%p").surql"
Change the NS and DB for each NS and DB that you have and modify the surql file name to what you need it to be. -
Import the export using the beta9 port =>
surreal import --conn http://localhost:8888 --user root --pass root --ns production --db production backup/production-bak-2023_04_13_12_06_PM.surql
-
Test it using local
surreal sql -c http://localhost:8888 --user root --pass root --ns production --db production --pretty
and queryINFO FOR DB
. If all is good to go repeat for each NS and each DB in each NS. -
You can now switch the ports in your docker-compose.yml file if you'd like so that your beta9 data is now your main database. Make sure to run
sudo docker compose up -d
After your changes are complete. -
Help someone else on the SurrealDB discord and/or thank someone in the community.