This repository contains the source code for ACTRIS Cloudnet data portal hosted at https://cloudnet.fmi.fi.
The data portal is distributed as a docker container as a part of the Cloudnet development toolkit. Refer to README of the dev-toolkit repository on how to set up the CLU development environment.
Install pre-commit to your machine and run pre-commit install
to set up the hooks.
For running commands in the data portal containers, small wrapper scripts are provided at backend/run-dev
, backend/run-test
and frontend/run
,
for running commands in the backend development, backend test, and frontend development containers, respectively.
Before using these scripts make sure the containers are up.
By default, there is no data in the portal's database. The following command will populate the development database with test fixtures:
cd backend
./run-dev npm run reset-db
To load other data to the db, for instance the sites used in production, use:
cd backend
./run-dev npx ts-node -T src/fixtures.ts /dataportal-fixtures/1-site.json APPEND
The dataportal uses TypeORM for automatic database schema manipulation. This repository provides wrapper scripts for TypeORM's own migration tool:
cd backend
./run-dev npm run migration:show
./run-dev npm run migration:run
./run-dev npm run migration:revert
./run-dev npm run migration:generate -- src/migration/NewMigration
./run-dev npm run migration:create -- src/migration/NewMigration
./run-dev npm run typeorm -- --help
The migrations are stored in backend/src/migration
. For more information on how to use TypeORM's migrations, see https://typeorm.io/migrations.
The backend unit and integration tests are run with the commands:
cd backend
./run-test npm test
Individual tests can be run as:
cd backend
./run-test sh -c "npm run reset-db && npx jest tests/integration/sequential/upload.test.ts"
To run backend e2e-tests, issue
cd backend
./run-test npm run e2e-test
The frontend unit and integration tests are run with:
cd frontend
./run npm run test:unit
WRAPPER npx prettier --write FILENAME
WRAPPER npm run lint-fix
where WRAPPER
is, depending on the backend or frontend, ./run-dev
or ./run
, respectively.
MIT