Skip to content

MorphoDesignExplorer/morphodb-go

Repository files navigation

MorphoDB - Go

Go rewrite of the MorphoDB database.

Serves only HTTP as it is meant to be used within a docker network.

Quick Startup

You will need to setup environment variables before starting up the server. Check them out in the dedicated section below.

Clone this repository first, and move into the directory. To start up the server: (On Linux)

go run ./main

If you're using a .env file for environment variables:

go build -o main-bin main
env $(cat .env) ./main-bin

Build Instructions

Local Go Build

go build . 

Docker Container:

docker build --tag morphodb-go .

Documentation:

You can run godoc on the commandline to start up a documentation http server locally. This should display the documentation for the code in this repository under the github.com > MorphoDesignExplorer namespace.

Pointers for future developers / maintainers

Definitions:

  1. A project is a collection of randomly generated solutions produced by the Morpho Grasshopper Plugin.
  2. A solution is a set of input and output variables (typically numerical knobs and analysis results associated with names).
  3. An asset is an image or analysis file generated by the plugin, associated with a particular solution.

All of the above definitions can be found as structs within morpho-routes/db-types.go.

This repository is meant to be used on the docker net as a standalone web server and also as a local backend for the desktop application, to reduce the amount of code written. So be careful when editing non-http routes and check for compatibility issues with the desktop application. Some tests are provided in server_test.go to check if GET responses are backward compatible.

A locustfile is provided to load test the server. Refer to Locust's Quick Start Guide to get started.

TODO Items:

  • Need to implement email support for Password Reset Sessions.
  • Automated Testing for POST routes.

Environment Variables:

Variable Purpose
DB_STRING Path to the SQLite databse on disk
AWS_STORAGE_BUCKET_NAME Name of the storage bucket containing our assets
AWS_REGION Region where the storage bucket is situated
ENVIRONMENT Environment that the instance is running in (dev or prod)

You can set these variables up on the shell or in an .env file. A .env file is recommended though, as it's easier to load into the shell.

two sample env files are provided for reference too (.env.test and .env.sample).

About

Go rewrite of the MorphoDB database

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages