This guide explains how to set up a local development environment for the MiradorStack Grafana datasource plugin.
- Docker and Docker Compose
- Node.js and npm (for building the plugin)
- mirador-core running locally (optional, for testing)
./localdev-up.shThis script will:
- Build the datasource plugin
- Pull Grafana 12.2.0 Docker image
- Start Grafana with the plugin loaded
- Open Grafana in your browser (macOS)
- URL: http://localhost:3000
- Username: admin
- Password: admin
- Go to Configuration → Data Sources
- Click Add data source
- Search for and select "MiradorStack Datasource"
- Configure the settings:
- URL:
http://host.docker.internal:8081/api/v1(if mirador-core is running locally) - Tenant ID: Your tenant ID
- Authentication: Enable/disable as needed
- Bearer Token: Your API token (if authentication enabled)
- URL:
Click "Save & Test" to verify the connection to mirador-core.
- Edit the plugin code in
datasource/src/ - Rebuild the plugin:
cd datasource npm run build - Restart the Grafana container:
./localdev-down.sh ./localdev-up.sh
# View Grafana container logs
docker logs grafana-miradorstack-dev
# Follow logs in real-time
docker logs -f grafana-miradorstack-dev- Plugin files are mounted as a volume at
/var/lib/grafana/plugins/platformbuilds-miradorstack-datasource - Check Grafana logs for plugin loading issues
- Ensure mirador-core is accessible from the container
./localdev-up.sh: Start the development environment./localdev-down.sh: Stop and clean up the development environment
- Check that the plugin built successfully:
cd datasource && npm run build - Verify the plugin files exist in the container:
docker exec grafana-miradorstack-dev ls -la /var/lib/grafana/plugins/platformbuilds-miradorstack-datasource/ - Check Grafana logs for plugin loading errors
- Ensure mirador-core is running and accessible
- Use
host.docker.internalto access services on the host machine - Check network connectivity from within the container
- Clear node_modules:
cd datasource && rm -rf node_modules && npm install - Check for TypeScript errors:
npm run typecheck - Verify all dependencies are installed
The development container uses these Grafana environment variables:
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: Allows loading the unsigned pluginGF_LOG_LEVEL: Set toinfofor detailed loggingGF_SECURITY_ADMIN_PASSWORD: Sets admin password toadmin
- Grafana: http://localhost:3000
- mirador-core (if running): http://localhost:8081
- Container access to host: Use
host.docker.internalinstead oflocalhost
├── localdev-up.sh # Start development environment
├── localdev-down.sh # Stop development environment
├── datasource/ # Plugin source code
│ ├── src/ # TypeScript source
│ ├── dist/ # Built plugin files
│ └── package.json # Plugin dependencies
└── plugin-temp/ # Temporary plugin files (created by script)