Skip to content

Database#26

Merged
ValentijnvdBeek merged 27 commits into
debian-stablefrom
database
Nov 16, 2021
Merged

Database#26
ValentijnvdBeek merged 27 commits into
debian-stablefrom
database

Conversation

@ValentijnvdBeek
Copy link
Copy Markdown
Collaborator

Summary

Expands on the work done last year to create a database for the BAAS project. Combined this merge requests implements a database based on the Gorm ORM which stores the machines, images, users, and various other relevant entities to a Sqlite instance. You can create users who are allowed to create new images associated to their account, they can change their images locally and upload their changed image to the server. Another option is ignoring the generated image and instead uploading a custom image of some sort. Generated images are plain raw disk images with a size of 6 GiB.

Features

  • Sqlite database (Jonathan & Victor)
  • Create a user (Jonathan & Victor)
  • Get users (Jonathan & Victor)
  • Get a user (Jonathan & Victor)
  • Get a machine (Jonathan & Victor)
  • Get machines (Jonathan & Victor)
  • Update machine (Jonathan & Victor)
  • Disk, Image and User related database models (Jonathan & Victor)
  • Creating images (Valentijn)
  • Uploading images (Valentijn)
  • Input validation on endpoints (Valentijn)
  • Fix a bug where it would only fetch the first global entry if you fetch any entry (Valentiijn)
  • Document all the endpoints with parameters, input and output (Valentijn)
  • Get all the images associated with a user (Valentijn)
  • Make email and usernames unique (Valentijn)
  • Throw an error if users, machines or images don't exist (Valentijn)
  • Get all images with a specified name (Vlaentijn)
  • Get all images associated with a user id (Valentijn)
  • Endpoint to download the latest version (Valentijn)
  • Create a new version for each uploaded image (Valentijn)

Known Issues

  • Currently, the database models have a few quirks in regard to what their primary keys are set to. So a user has an email and username, but also an id which is used as a primary and foreign key. Disk and images have UUID, but similarly use a separate ID as their primary key. This is not very nice conceptually and leads to some awkward SQL queries
  • Endpoint should be documented better in a separate document
  • Documentation regarding the database design is missing
  • The database is not linked to the rest of the program
  • Unit testing is disabled on the CI since it requires disk access which we don't have
  • Images are always associated with a user
  • Images are always system images
  • Images are singular and cannot have associated images (i.e. boot, system, usr, etc)

Why it should be merged

It features a lot of work done by last years developers and it goes a long way towards the end goal of a user friendly imaging and flashing software. The endpoints we have now are not yet fully sufficient, but would allow a team to create a simple web interface which can create and manage images. More thought and documentation does need to go into this part of the program, but this merge requests offers an excellent base to do so

Victor Roest and others added 22 commits January 12, 2021 17:06
Co-authored-by: Jonathan Dönszelmann <jonabent@gmail.com>
Co-authored-by: Victor Roest <victor@xirion.net>
Co-authored-by: Victor Roest <victor@xirion.net>
Co-authored-by: Victor Roest <victor@xirion.net>
# Conflicts:
#	.dockerignore
#	Makefile
#	control_server/api/boot.go
#	control_server/httpserver/routes.go
#	control_server/main.go
#	go.mod
#	go.sum
#	management_os/build/Dockerfile
#	management_os/entrypoint/api.go
#	management_os/entrypoint/download.go
#	management_os/entrypoint/main.go
#	management_os/entrypoint/upload.go
…sByUser

Extra documentation for the endpoints with request examples
Validates the inputs for a few functions to ensure that the endpoints are called correctly
Fixes a bug where it always returned the first item for any Read endpoint
Fixes a bug where it would not give an error for non-existing users, images or machines
Cleans up the image code by creating helper function which gets variables about the uri
Implements an endpoint which gets all the images associated with a user out of the database
Implements an endpoint which gets the first image with a given name for a specified user
Implements a function to get a user by id which is useful given the database is denormalized
…e not unique; Create an image file when an image is created
Integrate the database to the IPXE server
@ValentijnvdBeek ValentijnvdBeek merged commit e6d7941 into debian-stable Nov 16, 2021
@ValentijnvdBeek ValentijnvdBeek deleted the database branch November 21, 2021 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants