Skip to content

albedosehen/surrealdb-deal-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SurrealDB Deal Store

This repository is for my own personal learning journey with SurrealDB following the SurrealDB Fundamentals course. I will be using this repository to learn and experiment with SurrealDB, and I will be documenting my experiences and initial impressions along the way on my website. Eventually I would like to apply this technology to a personal project, but for now I will be using it as a sandbox to learn and experiment.

Feel free to clone or learn from this repository, but please note that it is not intended for production use.

📃 Table of Contents

👓 Prerequisites

You'll basically need a working Docker environment to run the SurrealDB server.

  • Docker To manage the images and run the surreal commands
  • docker-compose To manage surrealdb and infrastructure
  • Docker Desktop for Windows/WSL Required for Windows users
  • Surrealist

NOTE: I use nix-direnv to manage my development environment. This also let's me use commands directly from the CLI. This is optional.

🦥 Getting Started

NOTE: Let root mean the root of the repository. Represented as ~/surreal-db-store/

  1. Clone this repository and navigate to the root
  2. Create a data directory (if not already present) at the root: mkdir ./data
  3. Create a .env at the root, and replace the content with your settings
    DB_USER=<your_choice_of_username>
    DB_PASS=<your_very_secure_password>
    DB_HOST=0.0.0.0
    DB_PORT=8000
    
  4. Build and run the project: docker-compose up --build --detach
  5. Validate HTTP 200 status code by making a request to localhost:8000. Refer to your .env for connection details.
    • Linux: curl -v localhost:8000
    • Windows:
          iwr "localhost:8000" | FT StatusCode, StatusDescription
  6. Launch Surrealist and create a connection to the database
  7. ???
  8. Profit

🐋 Docker

This is mostly aimed at those who utilize Docker Desktop for Windows/WSL. If you are using Docker on Linux, you can skip this section. Clearing the Docker cache doesn't always work through the Docker Desktop GUI, so you may need to use the CLI to get the job done. At least, in my own experience.. So here are some helpful commands all aimed at stopping and removing your local docker infrastructure.

  • Stop all containers: docker stop $(docker ps -a -q)
  • Remove all containers: docker rm $(docker ps -a -q)
  • Remove all images: docker rmi $(docker images -q)
  • Remove all volumes: docker volume rm $(docker volume ls -q)
  • Remove all networks: docker network rm $(docker network ls -q)
  • Remove all dangling volumes: docker volume rm $(docker volume ls -qf dangling=true)
  • Remove all dangling networks: docker network rm $(docker network ls -qf dangling=true)
  • Remove all dangling containers: docker rm $(docker ps -a -q --filter "status=exited" --filter "status=created")
  • Remove all dangling images: docker rmi $(docker images -f "dangling=true" -q)
  • Remove everything: docker system prune -a --volumes

🧑‍🚀 References

  • SurrealDB Documentation
  • Surrealist Documentation
  • Docker Desktop
  • docker-compose cheatsheet
  • Windows Subsystem for Linux (WSL)

About

SurrealDB project for following along SurrealDB University course material

Topics

Resources

Stars

Watchers

Forks