The OpenEarth Viewer gives insight in a wide variety of marine data. It is configured to be loaded into a variety of different websites and cater specific layer data to each individual client.
- Clone this repository:
git clone git@github.com:openearth/rws-viewer.git
cd rws-viewer
npm install --legacy-peer-deps
- Copy
.env.example
to.env
. And set all variables.
npm run dev
This project uses DatoCMS migrations for managing the models and moving data around in the DatoCMS instances. It uses custom scripts to generate the migrations, and to apply them.
File: scripts/dato/create.ts
This script creates a new migration file for DatoCMS.
- Prompts the user for a migration name.
- Uses the current DatoCMS instance specified in the environment variable
DATO_INSTANCE_CURRENT
. - Creates a new migration file using the DatoCMS CLI.
Usage:
npm run migrations:create
File: scripts/dato/apply-staging.ts
This script applies migrations to the staging environment for all configured DatoCMS instances.
For each instance:
- Sets up a staging environment.
- Destroys the existing staging environment if it exists.
- Creates a fresh staging environment by forking from the main environment.
- Applies all migrations in the
migrations
directory to the staging environment.
Usage:
npm run migrations:apply
🚧 Please do not use this script unless you know what you are doing. This will update the main environment for all configured DatoCMS instances and can cause data loss. Typically this will only be run from a GitHub action.
File: scripts/dato/apply-main.ts
This script applies migrations to the main environment for all configured DatoCMS instances.
For each instance:
- Destroys the existing staging environment if it exists.
- Creates a fresh staging environment by forking from the main environment.
- Applies all migrations in the
migrations
directory to the staging environment. - Promotes the staging environment to main.
- Destroys the old main environment.
- Renames the staging environment to main.
Usage:
npm run migrations:apply-main
The main-migrations.yaml
workflow is triggered on a push to the main
branch. It performs the following steps:
- Checks out the repository.
- Checks for changes in the
migrations
folder. - If changes are detected, sets up Node.js, installs dependencies, and runs the
migrations:apply-main
script. - Deploys the application to Netlify using the specified instances.
The staging-migrations.yaml
workflow is triggered on pull request events (opened or synchronized). It performs the following steps:
- Checks out the repository.
- Checks for changes in the
migrations
folder. - If changes are detected, sets up Node.js, installs dependencies, and runs the
migrations:apply-staging
script. - Deploys the application to Netlify using the specified instances.