If you are using this repo, note that I will use this README as a means of communicating the current state of this project. E.g. some of the database version aren't exactly as specified by the module study guide due to a lack of availability on Docker. I will also use this README to communicate any issues I have encountered and how I have resolved them.
Software | Version | Download Link | Database Type |
---|---|---|---|
ObjectDB | 2.9.0 | Download | Object Oriented Databases |
PostgreSQL | 16.3 | Download | Object Relational Databases |
BaseX | X111 | Download | XML Databases |
MongoDB | 7.0.12 | Download | NoSQL Document Databases |
Neo4j DB | 5.9.0 | Download | NoSQL Graph Databases |
Software | Version |
---|---|
ObjectDB | 2.9.0 |
PostgreSQL | 16.3 |
BaseX | Latest |
MongoDB | 7.0.12 |
Neo4j DB | 5.9.0 |
Object DB is not available on Docker. I have downloaded the ObjectDB version 2.9.0 from the official website and stuck that .zip into the /objectdb
directory with a Dockerfile
that the compose.yaml
uses. This spins up the objectdb container.
In terms of connecting to and using the ObjectDB database, official documentation can be found here. However for those of you that prefer a more pragmatic approach, here is a Gradle project maintained by a good friend of mine that should help speed you past the obscenities of the otherwise standard Maven alternatives: ObjectDB Gradle Project.
Requires authentication, which is specified in the compose.yaml file. Additionally, the ./initpg directory contains an init.sql file used to initialize the database with tables, data, enums, etc. This initialization script runs only if PostgreSQL detects that no database already exists. This ensures that the database is set up correctly on the first run but does not overwrite existing data on subsequent restarts.
Version X111 (or 11.1) is not available on docker. I am using the latest tag as the next available version is 9.5.2. This is not the version specified in the study guide. Here is the link to the available tags: BaseX Docker Hub.
Nothing to note.
Two ports are specified in the compose.yaml
file. The first is the bolt port. The bolt port is used for the Neo4j Browser (accessible via http://localhost:7474/browser/
). The second is the default port for the Neo4j DB. The default port is used for the Neo4j DB itself. The admin username and password are specified in the compose.yaml
file in the NEO4J_AUTH
environment variable formatted as username/password
. Note: having "neo4j" as the username is required as it is the admin username.
- Need to confirm if the BaseX version is correct. The latest tag is not the version specified in the study guide. I will need to confirm this with the module leader.
- Need to double-check that all the volumes specified in the
compose.yaml
are correct to ensure persistence across the databases.
To start the databases, run the following command in the root directory of this project:
docker compose up -d
The -d
flag is used to run the containers in the background. If you want to see the logs whilst the containers are running, remove the -d
flag.
To stop the containers, run the following command:
docker compose down
Volumes are used in Docker to persist data generated by and used by Docker containers. This ensures that data remains intact across container restarts. Below are some key points to understand regarding volumes and how they relate to the compose.yaml
configuration:
-
Persistence: Volumes ensure that data is not lost when a container is stopped or restarted. For example, the
COS326_pg_data
volume ensures that PostgreSQL data remains available even after stopping the PostgreSQL container. -
Volume Definition: Volumes are defined in the
compose.yaml
file under both theservices
andvolumes
sections. In theservices
section, volumes are specified for each service, mapping container paths to named volumes (e.g.,COS326_pg_data:/var/lib/postgresql/data
) or to existing directories (e.g.,./initpg:/docker-entrypoint-initdb.d
). In thevolumes
section, named volumes are declared (e.g.,COS326_pg_data:
), which are then referenced by the services. -
Configuration Changes: If changes are made to the configuration in the
compose.yaml
file (such as environment variables or authentication details), these changes may not take effect if an existing volume contains previous data. This is because the volume will retain its data and configuration from previous runs. -
Resetting Data: To apply configuration changes or reset a database to its initial state, you may need to remove the existing volume. For instance, if you change the PostgreSQL user or password in the
compose.yaml
file, the existing volume (COS326_pg_data
) would still retain the old credentials. You can remove the volume with the following command:docker volume rm COS326_pg_data
After removing the volume, the next time you start the container, a new volume will be created with the updated configuration. This will also delete any data stored in the volume, so use this command with caution.
-
Volume Management: It is crucial to manage volumes carefully, especially in a development environment. Unintended volume removal can result in data loss. To list all volumes and check their current state, use:
docker volume ls
To inspect a specific volume, use:
docker volume inspect VOLUME_NAME