diff --git a/scripts/push-to-ecr.sh b/scripts/push-to-ecr.sh index cefbd62..095474d 100755 --- a/scripts/push-to-ecr.sh +++ b/scripts/push-to-ecr.sh @@ -30,14 +30,22 @@ if ! command -v docker &> /dev/null; then exit 1 fi -echo "Building Docker image for Meshstream..." -docker build \ +# Check if Docker Buildx is available +if ! docker buildx version &> /dev/null; then + echo "Error: Docker Buildx is not available. Please install or enable Docker Buildx." + exit 1 +fi + +echo "Building Docker image for Meshstream using buildx (linux/amd64 platform)..." +docker buildx build \ + --platform linux/amd64 \ --build-arg MESHSTREAM_API_BASE_URL="${MESHSTREAM_API_BASE_URL:-}" \ --build-arg MESHSTREAM_APP_ENV="${MESHSTREAM_APP_ENV:-production}" \ --build-arg MESHSTREAM_SITE_TITLE="${MESHSTREAM_SITE_TITLE:-Bay Area Mesh}" \ --build-arg MESHSTREAM_SITE_DESCRIPTION="${MESHSTREAM_SITE_DESCRIPTION:-Meshtastic activity in the Bay Area region, CA.}" \ --build-arg MESHSTREAM_GOOGLE_MAPS_ID="${MESHSTREAM_GOOGLE_MAPS_ID}" \ --build-arg MESHSTREAM_GOOGLE_MAPS_API_KEY="${MESHSTREAM_GOOGLE_MAPS_API_KEY}" \ + --load \ -t meshstream:${IMAGE_TAG} . echo "Tagging image for ECR repository..." diff --git a/server/server.go b/server/server.go index 9847892..f28c422 100644 --- a/server/server.go +++ b/server/server.go @@ -83,7 +83,8 @@ func (s *Server) Start() error { prefab.WithPort(port), prefab.WithHTTPHandlerFunc("/api/status", s.handleStatus), prefab.WithHTTPHandlerFunc("/api/stream", s.handleStream), - prefab.WithStaticFiles("/", s.config.StaticDir), + prefab.WithStaticFiles("/assets", s.config.StaticDir+"/assets"), + prefab.WithHTTPHandlerFunc("/", s.fallbackHandler), ) // Start the server @@ -124,6 +125,14 @@ func (s *Server) handleStatus(w http.ResponseWriter, r *http.Request) { json.NewEncoder(w).Encode(status) } +func (s *Server) fallbackHandler(w http.ResponseWriter, r *http.Request) { + logger := s.logger.Named("api.fallback") + logger.Info("Fallback handler called") + + // Serve the index.html file from the static directory + http.ServeFile(w, r, s.config.StaticDir+"/index.html") +} + // handleStream handles Server-Sent Events streaming of MQTT messages func (s *Server) handleStream(w http.ResponseWriter, r *http.Request) { logger := s.logger.Named("api.sse").With("remoteAddr", r.RemoteAddr) diff --git a/server/static/index.html b/server/static/index.html index 0531c10..17e0b61 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -115,29 +115,11 @@

Meshstream

-
-
Simple View
-
Development
-
- -
-

This page displays real-time messages from Meshtastic nodes via MQTT.

-
-

Waiting for messages...

-
-
- -
-

- A web interface for viewing Meshtastic network traffic. - This is a placeholder page for the production build. -

- Open Development Server -

- For production deployment, build the web application with make web-build - to replace this placeholder with the full application. -

+

This page displays real-time messages from Meshtastic nodes via MQTT.

+
+

Waiting for messages...

+