Skip to content

DigitalArsenal/spacedb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpaceDB

SpaceDB is a space data transmission and storage application that leverages code generated by the SpaceDataStandards.org project. It utilizes Google Flatbuffers as a serialization format, providing high-performance, memory-efficient, and cross-platform serialization essential for space operations.

Environment Variables

NODE_ENV

Specifies the environment in which the application is running.

  • development (default)
  • test
  • production

DB_CLIENT

Specifies the database client to be used by Knex.js.

  • better-sqlite3 (default)
  • pg (PostgreSQL)
  • mysql
  • mysql2
  • sqlite3
  • Any other supported Knex client

DB_FILENAME

Specifies the filename for the SQLite database. Only used when DB_CLIENT is set to better-sqlite3 or sqlite3.

  • space-db (default)
  • Any valid filename

DB_HOST

Specifies the host of the database.

  • localhost (default)
  • Any valid hostname or IP address

DB_USER

Specifies the username to connect to the database.

  • root (default)
  • Any valid database username

DB_PASSWORD

Specifies the password to connect to the database.

  • `` (default, empty string)
  • Any valid database password

DB_NAME

Specifies the name of the database.

  • spaceaware (default)
  • Any valid database name

Getting Started

To run the tests for this project, you'll need to have Docker and Docker Compose installed on your system. Follow the instructions below to set up your environment and run the tests.

Prerequisites

  1. Docker: Docker is a platform that enables you to create, deploy, and run applications in containers. Install Docker by following the instructions for your operating system:

  2. Docker Compose: Docker Compose is a tool for defining and running multi-container Docker applications. Install Docker Compose by following the instructions for your operating system:

    • Docker Compose is included with Docker Desktop for Windows and Mac.
    • For Linux, follow the installation instructions here.

Cloning the Repository

First, clone the repository to your local machine:

git clone <https://github.com/your-repo/your-project.git>
cd your-project

Installing Node.js Dependencies

Install the required Node.js dependencies using npm:

npm install

Running the Tests

The tests are configured to use a Docker container for MySQL. The test setup will automatically start and stop the Docker container as needed.

To run the tests, use the following command:

npm test

This command will:

  1. Start a MySQL Docker container using Docker Compose.
  2. Run the test suite.
  3. Tear down the Docker container after the tests complete.

Docker Compose Configuration

The Docker Compose configuration for the MySQL container is defined in test/docker-compose.yml:

version: '3.1'

services:
  mysqldb:
    build: .
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: ""
      MYSQL_DATABASE: "testdb"

Dockerfile for MySQL Setup

The test/Dockerfile sets up the MySQL container:

# Dockerfile for MySQL
FROM mysql:latest

ENV MYSQL_ROOT_PASSWORD=
ENV MYSQL_DATABASE=testdb
EXPOSE 3306

Running the Tests Manually

If you need to run the tests manually, you can start the MySQL container and then run the tests:

  1. Start the MySQL container:

    docker-compose -f test/docker-compose.yml up -d
  2. Run the tests:

    npm test
  3. Tear down the MySQL container after the tests complete:

    docker-compose -f test/docker-compose.yml down
    ```sh

License

This project is licensed under the terms of the license file included in this repository.

Contact

[email protected]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published