Skip to content

Latest commit

 

History

History
156 lines (109 loc) · 5.08 KB

File metadata and controls

156 lines (109 loc) · 5.08 KB

Developer

This document describes how to set up your development environment to build and develop PlanDev.

Prerequisite Software

Before you can run PlanDev you must install and configure the following products on your development machine:

  • Git and/or the GitHub app; GitHub's Guide to Installing Git is a good source of information.

  • Docker which is used to run the PlanDev services.

  • OpenJDK Temurin LTS which is used to build the Java-based PlanDev services. If you're on OSX you can use brew. Note PlanDev is currently compatible with Java temurin V21, which can be installed with brew using:

    brew install --cask temurin@21

    Make sure you update your JAVA_HOME environment variable. For example with Zsh you can set your .zshrc to:

    export JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home"
  • PostgreSQL which is used for testing the database. You do not need this normally since PlanDev runs Postgres in a Docker container for development, and you only need it for the psql command-line tool. Do not run the Postgres service locally or it will clash with the PlanDev Postgres Docker container. If you're on OSX you can use brew:

    brew install postgresql

Code Editor

If you use IntelliJ IDEA, you can import the PlanDev repository into IntelliJ as a Gradle project. No additional configuration is required.

Getting the Sources

Clone the PlanDev repository:

git clone https://github.com/NASA-AMMOS/plandev.git
cd plandev

Building

cd plandev
./gradlew assemble

Testing

cd plandev
./gradlew test

Dependency Updates

Use the following task to print a report of the dependencies that have updates available.

cd plandev
./gradlew dependencyUpdates

Environment

To run the PlanDev services you need to first set the proper environment variables. First copy the template:

cd plandev
cp .env.template .env

Fill out the .env file with the following default environment variables (note you should not use these values in production):

AERIE_PASSWORD=aerie
AERIE_USERNAME=aerie
HASURA_GRAPHQL_ADMIN_SECRET=aerie
HASURA_GRAPHQL_JWT_SECRET='{ "type": "HS256", "key": "oursupersecretsupersecurekey1234567890" }'
POSTGRES_PASSWORD=postgres
POSTGRES_USER=postgres

Start PlanDev

The docker-compose.yml in the root directory deploys PlanDev locally, creating containers using the artifacts from the build step above.

cd plandev
docker-compose up --build --detach

Once PlanDev is started you can visit http://localhost to view the PlanDev UI. You can visit http://localhost:8080 to view the Hasura Console.

Stop PlanDev

cd plandev
docker compose down

Remove Docker Images

Removing a docker image from your local cache forces Docker to either rebuild it or fetch it from a repository (e.g. DockerHub or GitHub Packages).

docker rmi [image name or image id]

Remove Docker Volumes

Sometimes it's necessary to clear the contents of file system volumes mounted by Docker. For PlanDev this could be needing to start with a clean install and wanting to delete the database contents, mission model jars, and mission simulation data files.

First ensure all containers are down. Only once containers are down you can run volume pruning operation:

docker volume prune

Entering a Docker Container

At times it is helpful to enter a docker container and inspect the filesystem or run CLI utilities such as psql or hasura-cli. For example a shell can be initialized in the Postgres container with:

docker exec -it aerie-postgres /bin/sh

Apple Silicon

If you're having issues building the Docker containers with Apple Silicon you can try setting the follow environment variables. This will disable BuildKit and try to default to using linux/arm as the platform.

export DOCKER_DEFAULT_PLATFORM=linux/arm64
export DOCKER_BUILDKIT=0