Commit Graph

52 Commits

Author SHA1 Message Date
Copilot
2c147a92ad Add Docker build for browser mode with optimized 3-stage build, multi-platform support, comprehensive UI testing, one-click deployment, enterprise SSO integration, and biweekly CI pipeline (#934)
## Docker Build for Browser Solution

This PR creates a Docker build for the browser solution (MQTT Explorer
server mode).

### Completed:
- [x] Create a production Dockerfile for the browser solution
(`Dockerfile.browser`)
  - **NEW**: 3-stage build for maximum optimization
- **NEW**: Clean production dependency installation with `yarn
--production`
  - **NEW**: Only compiled dist/ folder copied (no source code)
  - Alpine Linux base with Node.js 24
  - Non-root user (UID 1001) for security
  - Health check endpoint with proper error handling
  - Proper signal handling with dumb-init
  - Production dependencies automatically filtered by yarn
- [x] Apply Docker best practices (multi-stage build, minimal image,
non-root user, .dockerignore)
  - Created comprehensive .dockerignore
  - **FIXED**: Removed events from .dockerignore (needed for build)
  - **NEW**: Optimized for smaller layers with combined RUN commands
  - **NEW**: Removed development dependencies from final image
  - Used alpine base image
- [x] Create GitHub Actions workflow for building, publishing, and
testing the Docker image
  - Builds for linux/amd64, linux/arm64, linux/arm/v7
- **FIXED**: Added tsconfig.json and events/** to workflow trigger paths
- **FIXED**: Attestation now uses correct digest from build step output
  - **NEW**: Mosquitto MQTT broker service for integration testing
- **NEW**: MQTT broker configurable via MQTT_BROKER_HOST and
MQTT_BROKER_PORT environment variables
  - **NEW**: Full UI test suite runs against containerized application
- Tests container startup, health check, HTTP response, data persistence
  - **NEW**: Image size reporting in workflow summary
  - Tests verify application works with MQTT broker
- Publishes to GitHub Container Registry
(ghcr.io/thomasnordquist/mqtt-explorer)
  - Includes build attestation for supply chain security
- [x] Configure workflow to run on push and every two weeks via cron
schedule
  - Runs on 1st and 15th of each month at 2:00 AM UTC
- Also runs on push to master/beta/release branches when relevant files
change
  - Manual trigger via workflow_dispatch
- [x] Add comprehensive test suite
- Basic smoke tests: startup, health check, HTTP response, data
persistence
- **NEW**: Full UI test suite (`test:browser`) runs against Docker
container
- **NEW**: Tests connect to configurable MQTT broker (default
localhost:1883)
- Tests execute with Mosquitto MQTT broker available for backend
integration
  - Same comprehensive tests validate both Electron and browser modes
- [x] Test organization and naming
- **NEW**: Renamed `test:ui` to `test:electron` for Electron-specific
tests
- **NEW**: Added `test:browser` script for browser mode tests (runs same
UI test suite)
  - **NEW**: Kept `test:ui` as backward-compatible alias
- **NEW**: Renamed `ui-tests` workflow job to `electron-tests` for
clarity
- [x] Update documentation with Docker usage instructions
  - Created DOCKER.md with comprehensive Docker documentation
  - Updated README.md with Docker quick start
  - **UPDATED**: CI_CD.md now lists all 10 test steps accurately
  - **NEW**: Added one-click deployment options section
  - **NEW**: Added authentication modes documentation
- [x] **NEW**: One-click deployment solutions
  - **NEW**: Created docker-compose.yml for easy deployment
- **NEW**: Added Play with Docker (PWD) badge for instant browser-based
demo
  - **NEW**: Added DigitalOcean App Platform deployment badge
  - **NEW**: Added Koyeb deployment badge
  - **NEW**: Comprehensive deployment options documentation in DOCKER.md
- **NEW**: "Try It Now" section in README.md and DOCKER.md with PWD
badge
- [x] **NEW**: Enterprise authentication integration
  - **NEW**: Added `MQTT_EXPLORER_SKIP_AUTH` environment variable
- **NEW**: Allows disabling built-in authentication for proxy-based auth
(OAuth2 Proxy, Authelia, enterprise SSO)
- **NEW**: Socket.IO emits `auth-status` event on connection with
authentication state
- **NEW**: Frontend receives auth status via Socket.IO and skips login
dialog when disabled
  - **NEW**: Logout button hidden when authentication is disabled
- **NEW**: Created AuthContext for managing authentication state across
components
- **NEW**: Comprehensive security warnings in documentation about using
skip auth only behind trusted authentication proxies
- **NEW**: Updated docker-compose.yml with commented example for proxy
authentication
- [x] Code review and security scan passed
  - Fixed health check to handle connection errors properly
  - Corrected cron schedule comment
  - No security vulnerabilities found
  - Fixed image tag naming consistency
  - Simplified dependency management
- **FIXED**: Workflow trigger paths now include all build-affecting
files
  - **FIXED**: Attestation digest reference corrected
  - **FIXED**: events directory included in Docker build context
- **FIXED**: Mosquitto service properly configured for integration
testing
- **FIXED**: MQTT broker connection now configurable for flexible
testing environments
- **IMPROVED**: Auth status now communicated via Socket.IO for better
real-time synchronization
- [x] Rename image to ghcr.io/thomasnordquist/mqtt-explorer (removed
-browser suffix)
- [x] Add multi-platform support for Raspberry Pi
  - linux/arm64 (Raspberry Pi 3/4/5)
  - linux/arm/v7 (Raspberry Pi 2/3)
- [x] Upgrade to Node.js 24 (matching project requirements)
- [x] **NEW**: Optimize Docker image for minimal size
  - Only production dependencies (no devDependencies)
  - No backend source code (only compiled JavaScript)
  - Removed build tools and dev dependencies
  - Combined layers for smaller image
  - **Image size reported in workflow summary**
- [x] **NEW**: Fix webpack build configuration
  - **Enable minification** for production builds (was disabled)
  - **Update Material-UI references** from @material-ui to @mui
  - Fix vendor chunking to include @mui and @emotion packages
  - Reduces bundle size and fixes missing component issues

### Docker Image Features:
- **Base**: Alpine Linux with Node.js 24
- **Size**: Reported automatically in workflow summary
- **Platforms**: amd64, arm64, arm/v7 (Raspberry Pi support)
- **Security**: Non-root user, minimal attack surface
- **Reliability**: Health checks, graceful shutdown
- **Persistence**: Data volume at `/app/data`
- **Registry**: ghcr.io/thomasnordquist/mqtt-explorer
- **Runtime deps**: Only production dependencies (automatically
filtered)
- **Frontend**: Minified webpack bundles with proper vendor splitting
- **Testing**: Full UI test suite with configurable MQTT broker
integration
- **One-Click Deploy**: Play with Docker, DigitalOcean, Koyeb
- **Enterprise Ready**: Optional authentication bypass for proxy-based
SSO

### Available Tags:
- `latest` - Latest stable from master
- `master`, `beta`, `release` - Latest from each branch
- `<branch>-<sha>` - Specific commits

### Authentication Options:
1. **Standard Mode** (default): Built-in username/password
authentication
- Set credentials via `MQTT_EXPLORER_USERNAME` and
`MQTT_EXPLORER_PASSWORD` environment variables
2. **Skip Authentication Mode**: Set `MQTT_EXPLORER_SKIP_AUTH=true` for
proxy-based auth
- Use only behind trusted authentication proxies (OAuth2 Proxy,
Authelia, enterprise SSO)
- Socket.IO automatically informs frontend about auth status on
connection
- Frontend skips login dialog and logout button is hidden when
authentication is disabled
- ⚠️ **Security Warning**: Only use in environments with external
authentication protection

### One-Click Deployment:
Try MQTT Explorer instantly without installation:
- **Play with Docker**: Free browser-based demo (click badge in
README.md or DOCKER.md)
- **DigitalOcean**: Deploy to managed platform starting at $5/month
- **Koyeb**: Deploy to global edge network with free tier

### Security Summary:
- CodeQL scan passed with no vulnerabilities
- Docker image runs as non-root user (UID 1001)
- Multi-stage build reduces attack surface
- Health check includes proper error handling
- Minimal runtime dependencies reduce vulnerability exposure
- Full UI test suite validates application functionality
- Build attestation with correct digest reference
- MQTT broker integration tested with configurable connection via
environment variables
- Optional authentication bypass for enterprise SSO integration (with
comprehensive security warnings)
- Auth status communicated via Socket.IO for real-time synchronization

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>create a docker build for the browser
solution</issue_title>
> <issue_description>Create a docker build for amd64, that ships with a
minimal image including nodes. Apply best practices and create a test
workflow that builds it , publishes it and tests the built image. Build
it every two weeks</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes thomasnordquist/MQTT-Explorer#933

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com>
Co-authored-by: Thomas Nordquist <thomasnordquist@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-22 21:06:35 +01:00
Copilot
a143c5fb45 Upgrade to Material-UI v7 and React 19 (#954) 2025-12-22 21:03:46 +01:00
Copilot
a5629b8c77 chore: add macOS notarization support for DMG builds (#944) 2025-12-21 17:36:01 +01:00
Copilot
91df6de4d4 Add browser support with Socket.io transport, authentication, performance-optimized IPC, and CI/CD (#925) 2025-12-20 02:35:34 +01:00
Copilot
8285627c5f Implement comprehensive UI test suite with meaningful assertions and best practices (#921) 2025-12-20 02:13:31 +01:00
Jason Bauer
b457559b4a Update license 2025-08-21 12:54:21 -07:00
Thomas Nordquist
7fb0483889 chore: document release 2024-05-11 12:03:01 +02:00
Andre Klärner
e769ddece4 go for cloning the gh-pages branch directly
This avoids pulling in the entire history of the master branch
2021-10-03 22:36:04 +02:00
Thomas Nordquist
f63e73ee0a Add documentation for how to update http://mqtt-explorer.com 2020-01-17 12:52:34 +01:00
Thomas Nordquist
34cc38ab3c Fix build 2020-01-17 09:37:47 +01:00
Thomas Nordquist
173f662fa7 Fix readme 2019-06-05 13:49:35 +02:00
greenkeeper[bot]
f8648b92a1 Update dependencies to enable Greenkeeper 🌴 (#121)
* chore: add Greenkeeper config file

* chore(package): update dependencies

* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* chore(package): update lockfile app/yarn.lock

* chore(package): update lockfile yarn.lock

* Fix update specific issues

* Fix AceEditor
2019-06-05 11:48:15 +02:00
Thomas Nordquist
6bf84055d9 Update images in readme 2019-05-03 12:11:03 +02:00
Thomas Nordquist
9320fa252e Add license 2019-04-17 19:32:29 +02:00
Thomas Nordquist
083a39d6c6 Remove remark 2019-04-08 14:16:24 +02:00
Thomas Nordquist
e89ca2bfa4 Improve development
Redirect app visitors to mqtt-explorer.com
2019-04-08 13:59:45 +02:00
Thomas Nordquist
09dcce97b7 Refactor 2019-04-04 20:23:27 +02:00
Thomas Nordquist
f7e3fbc8f9 Add badge 2019-03-28 13:03:57 +01:00
Thomas Nordquist
2cb8c0dabc Update readme 2019-03-26 15:30:48 +01:00
Thomas Nordquist
ea7994dad9 Update Readme 2019-03-20 10:52:21 +01:00
Thomas Nordquist
d9fcf59ca4 Update readme 2019-03-19 04:20:16 +01:00
Thomas Nordquist
d66ecc6f0f Re-add dmg download to readme 2019-03-09 20:31:44 +01:00
Thomas Nordquist
eb6aa998a9 Update Readme.md 2019-03-08 10:28:43 +01:00
Thomas Nordquist
ef4dfe3298 Update readme 2019-03-07 13:02:48 +01:00
Thomas Nordquist
517bb06fb2 Update readme 2019-03-06 14:20:25 +01:00
Thomas Nordquist
1a8f64966c Update readme 2019-03-05 14:10:14 +01:00
Thomas Nordquist
e3539015f7 Add appveyor badge 2019-02-26 23:44:52 +01:00
Thomas Nordquist
953422dcd4 Show travis-ci master build status 2019-02-22 12:08:36 +01:00
Thomas Nordquist
60a06d8c82 Update Readme & Add snap store link 2019-02-20 15:35:51 +01:00
Thomas Nordquist
396e6985ce Update readme 2019-02-19 00:33:21 +01:00
Thomas Nordquist
6d75f29f03 Update readme 2019-02-19 00:09:25 +01:00
Thomas Nordquist
f316d5699d Improve readme for mobile preview 2019-02-14 11:47:12 +01:00
Thomas Nordquist
a58049d678 Update license reference in readme 2019-02-05 12:27:03 +01:00
Thomas Nordquist
a2a24659de Update readme 2019-02-04 19:25:28 +01:00
Thomas Nordquist
28d19875d5 Update readme 2019-01-30 12:39:00 +01:00
Thomas Nordquist
5776bab4e1 Update readme 2019-01-27 20:38:00 +01:00
Thomas Nordquist
da37b708b4 Fix Readme 2019-01-26 17:26:03 +01:00
Thomas Nordquist
cb26f08ffd Update Readme 2019-01-26 00:38:24 +01:00
Thomas Nordquist
d072de06ed Update readme 2019-01-25 21:15:07 +01:00
Thomas Nordquist
61737fa97b Update readme 2019-01-20 23:08:20 +01:00
Thomas Nordquist
ce60d1b20a Update Readme 2019-01-20 18:35:15 +01:00
Thomas Nordquist
2316dac809 Update Readme 2019-01-20 16:37:33 +01:00
Thomas Nordquist
d3a684d89e Update Readme 2019-01-17 22:30:31 +01:00
Thomas Nordquist
73e83beeb0 Update Readme 2019-01-16 02:39:09 +01:00
Thomas Nordquist
4192e91cce Revert "Update readme"
This reverts commit 64358e772d.
2019-01-16 01:16:17 +01:00
Thomas Nordquist
64358e772d Update readme 2019-01-16 01:14:07 +01:00
Thomas Nordquist
830dd31f06 Update readme 2019-01-15 22:26:16 +01:00
Thomas Nordquist
b0fa4a9f7a Update readme 2019-01-14 17:38:00 +01:00
Thomas Nordquist
7c72344174 Update readme 2019-01-14 17:00:14 +01:00
Thomas Nordquist
4d11302b24 Update screenshot 2019-01-14 12:08:00 +01:00