Skip to content

galv-team/galv-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

179 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Galv frontend (React app)

A metadata secretary for battery science

GitHub package.json dynamic

Storybook Chromatic Storybook deployment

Jest CI Build docs

The Galv frontend is a user-friendly web interface for interacting with the Galv REST API.

Galv Project

For more complete documentation, see the Galv Frontend documentation.

Deploying

The frontend is deployed as a Docker container.
The Dockerfile is in the root directory of this repository.

To deploy the frontend, you will need to set the following environment variables in the Docker container:

  • VITE_GALV_API_BASE_URL: the URL of the Galv REST API you are targeting with the frontend
  • (optional) VITE_GALV_ANALYTICS_URL: URL of the Plausible analytics instance to use

You can set these variables either by editing the Dockerfile, or by passing them in as arguments to docker run or docker-compose up. If you're using docker-compose, you can set them in the environment section of the frontend service in the docker-compose.yml file.

Demo instance

A demo instance of the frontend is available at galv-demo.oxrse.uk. It is updated every week.

Development

Development is most easily done by using the provided Dockerfile and docker-compose.yml files. The docker-compose.yml file will start a postgres database and the Django server. The Django server will automatically reload when changes are made to the code. This will create four containers:

  • a backend container that runs a copy of the latest version of the Galv backend
  • a postgres container that runs a postgres database for the backend
  • the frontend container that runs the frontend

The following command will start the server:

docker-compose up frontend

The server will be available at http://localhost:8002. If you need access to the backend, it will be available at http://localhost:8081.

Gotchas

  • The src directory is mounted as a volume in the Docker container, so changes made outside that directory will not be automatically reflected in the container.

Testing

There are unit tests and Cypress end-to-end tests.
The unit tests are run with Jest and the end-to-end tests are run with Cypress.

Unit tests

Unit tests are kept to a minimum, and used to ensure that novel logic in the components works as expected.

To run the unit tests, run the following command:

docker-compose up frontend_test

Remember to add the --build flag if you have made changes to the frontend code outside the src directory.

End-to-end tests

End-to-end tests are used to ensure that the frontend works as expected from the user's perspective. They are run with Cypress.

To run the end-to-end tests, run the following command:

docker-compose up frontend_test_e2e

Remember to add the --build flag if you have made changes to the frontend code outside the src directory.

To develop end-to-end tests, you can use the Cypress GUI. To do this, run the following command:

pnpm run cypress:open

Releases

Releases should be tagged with a semver version number. When releases are created, a workflow will be triggered to build the release and upload it to the GitHub releases page. This will also update the latest tag on the GitHub container registry, and push a version of the image to the AWS Elastic Container Registry (ECR) for use in AWS deployments.

Releasing with AWS

We use AWS (Amazon Web Services) to host a few instances. There is a repository that contains the AWS Cloud Development Kit (CDK) code to deploy the Galv backend to AWS. The workflows for the staging and demo instances use this CDK code to deploy the Galv backend to AWS.

To perform a manual deployment to AWS, please follow the instructions in the CDK repository.

About

React app to provide a user-friendly interface to the Galv REST API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors