Skip to content

Commit 6ba5fdc

Browse files
committed
RD-T39 Working on dispatch page
1 parent ac84974 commit 6ba5fdc

43 files changed

Lines changed: 5669 additions & 118 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Dependencies
2+
node_modules/
3+
.pnp/
4+
.pnp.js
5+
6+
# Build outputs
7+
dist/
8+
build/
9+
.expo/
10+
web-build/
11+
android/
12+
ios/
13+
14+
# Testing
15+
coverage/
16+
.nyc_output/
17+
*.test.js
18+
*.spec.js
19+
__tests__/
20+
__mocks__/
21+
22+
# IDE and editors
23+
.idea/
24+
.vscode/
25+
*.swp
26+
*.swo
27+
*~
28+
29+
# OS files
30+
.DS_Store
31+
Thumbs.db
32+
*.log
33+
34+
# Git
35+
.git/
36+
.gitignore
37+
38+
# Environment files (build time only, runtime injected)
39+
.env
40+
.env.*
41+
!.env.docker.example
42+
43+
# Documentation
44+
docs/
45+
*.md
46+
!README.md
47+
48+
# Docker files (don't need to copy into build context)
49+
docker-compose*.yml
50+
51+
# Expo/EAS
52+
eas.json
53+
.easignore
54+
55+
# CI/CD
56+
.github/
57+
.gitlab-ci.yml
58+
.circleci/
59+
Jenkinsfile
60+
61+
# Misc
62+
*.log
63+
npm-debug.log*
64+
yarn-debug.log*
65+
yarn-error.log*
66+
.maestro/

.env.development

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
DISPATCH_MAPBOX_PUBKEY=pk.eyJ1IjoicmVzZ3JpZCIsImEiOiJjbWRmYzRmM3IwY2RhMmxwenNqNG9oamM0In0.72i0xa5xSLE_sYyTmRc8gw
2+
DISPATCH_MAPBOX_DLKEY=sk.eyJ1IjoicmVzZ3JpZCIsImEiOiJjbTZ0a2UxajYwM3R0MmpwcmQyYWxvb2VhIn0.-jsajvbKKQX_4UpqK$
3+
DISPATCH_BASE_API_URL=https://sjapi.resgrid.dev
4+
# DISPATCH_BASE_API_URL=https://api.resgrid.com
5+
DISPATCH_API_VERSION=v4
6+
DISPATCH_RESGRID_API_URL=/api/v4
7+
DISPATCH_CHANNEL_API_URL=https://sjevents.resgrid.dev/
8+
#export DISPATCH_CHANNEL_API_URL=https://qaevents.resgrid.dev/
9+
#export DISPATCH_CHANNEL_API_URL=https://events.resgrid.com/
10+
DISPATCH_CHANNEL_HUB_NAME=eventingHub
11+
DISPATCH_REALTIME_GEO_HUB_NAME=geolocationHub
12+
DISPATCH_LOGGING_KEY=https://2f9cd04897a3d888d0ca03a2096226c2@sentry.resgrid.net/8
13+
DISPATCH_APP_KEY=69208a03-8c5d-4d89-a72d-9e26cdb79dbc
14+
DISPATCH_IS_MOBILE_APP=1
15+
DISPATCH_SENTRY_DSN=https://2f9cd04897a3d888d0ca03a2096226c2@sentry.resgrid.net/8
16+
DISPATCH_APTABASE_APP_KEY=A-SH-6901837625
17+
DISPATCH_APTABASE_URL=https://ab.resgrid.net
18+
DISPATCH_COUNTLY_APP_KEY=df2554c6b9eb5a37526e33bf790d8e60108942cb
19+
DISPATCH_COUNTLY_URL=https://c.resgrid.net

.env.docker.example

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Docker Environment Configuration for Resgrid Dispatch Web
2+
# Copy this file to .env.docker and fill in your values
3+
4+
# API Configuration
5+
DISPATCH_BASE_API_URL=https://api.resgrid.com
6+
DISPATCH_API_VERSION=v4
7+
DISPATCH_RESGRID_API_URL=/api/v4
8+
9+
# SignalR Hub Configuration
10+
DISPATCH_CHANNEL_HUB_NAME=eventingHub
11+
DISPATCH_REALTIME_GEO_HUB_NAME=geolocationHub
12+
13+
# Logging and App Keys
14+
DISPATCH_LOGGING_KEY=
15+
DISPATCH_APP_KEY=
16+
17+
# Mapbox Configuration
18+
DISPATCH_MAPBOX_PUBKEY=
19+
20+
# Sentry Error Tracking
21+
DISPATCH_SENTRY_DSN=
22+
23+
# Countly Analytics
24+
DISPATCH_COUNTLY_APP_KEY=
25+
DISPATCH_COUNTLY_SERVER_URL=
26+
27+
# Feature Flags
28+
DISPATCH_MAINTENANCE_MODE=false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Gemfile
3131
*.apk
3232
*.keystore
3333

34+
# Docker
35+
.env.docker
36+
3437
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
3538
# The following patterns were generated by expo-cli
3639

Dockerfile

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,54 @@
11
### STAGE 1: Build ###
2-
FROM node:18.16.0-alpine AS build
3-
WORKDIR /usr/src/app
4-
COPY package.json package-lock.json ./
5-
RUN npm ci
2+
FROM node:20-alpine AS build
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Install dependencies needed for build
8+
RUN apk add --no-cache python3 make g++
9+
10+
# Copy package files
11+
COPY package.json yarn.lock ./
12+
13+
# Install dependencies
14+
RUN yarn install --frozen-lockfile
15+
16+
# Copy source code
617
COPY . .
7-
RUN npm run build -- --configuration=production
818

9-
### STAGE 2: Run ###
10-
FROM nginx:1.21.6-alpine
19+
# Set environment for production web build
20+
ENV APP_ENV=production
21+
ENV NODE_ENV=production
22+
ENV EXPO_PUBLIC_PLATFORM=web
23+
24+
# Build the web application
25+
RUN yarn expo export --platform web
26+
27+
### STAGE 2: Serve ###
28+
FROM nginx:1.25-alpine
29+
30+
# Install envsubst (part of gettext)
31+
RUN apk add --no-cache gettext
32+
33+
# Copy nginx configuration
1134
COPY nginx.conf /etc/nginx/nginx.conf
12-
COPY --from=build /usr/src/app/www /usr/share/nginx/html
35+
36+
# Copy built web app from build stage
37+
COPY --from=build /app/dist /usr/share/nginx/html
38+
39+
# Copy the docker entrypoint script
40+
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
41+
RUN chmod +x /docker-entrypoint.sh
1342

1443
# Expose port 80
1544
EXPOSE 80
1645

17-
# When the container starts, replace the env.js with values from environment variables
18-
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/assets/env.prod.js > /usr/share/nginx/html/assets/env.js && exec nginx -g 'daemon off;'"]
46+
# Health check
47+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
48+
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1
49+
50+
# Set the entrypoint
51+
ENTRYPOINT ["/docker-entrypoint.sh"]
52+
53+
# Start nginx
54+
CMD ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,87 @@ LOGGING_KEY=
8787
</tr>
8888
</table>
8989

90-
## Deployment ##
90+
## Docker Deployment
91+
92+
### Building the Docker Image
93+
94+
```bash
95+
# Build the Docker image
96+
yarn docker:build
97+
98+
# Or using docker directly
99+
docker build -t resgrid-dispatch-web .
100+
```
101+
102+
### Running with Docker
103+
104+
1. Copy the example environment file:
105+
```bash
106+
cp .env.docker.example .env.docker
107+
```
108+
109+
2. Edit `.env.docker` with your configuration values.
110+
111+
3. Run the container:
112+
```bash
113+
# Using yarn script
114+
yarn docker:run
115+
116+
# Or using docker-compose
117+
yarn docker:up
118+
```
119+
120+
### Docker Environment Variables
121+
122+
The following environment variables can be set at runtime (no rebuild required):
123+
124+
| Variable | Default | Description |
125+
|----------|---------|-------------|
126+
| `DISPATCH_BASE_API_URL` | `https://api.resgrid.com` | Base URL for the Resgrid API |
127+
| `DISPATCH_API_VERSION` | `v4` | API version |
128+
| `DISPATCH_RESGRID_API_URL` | `/api/v4` | API path |
129+
| `DISPATCH_CHANNEL_HUB_NAME` | `eventingHub` | SignalR events hub name |
130+
| `DISPATCH_REALTIME_GEO_HUB_NAME` | `geolocationHub` | SignalR geolocation hub name |
131+
| `DISPATCH_LOGGING_KEY` | `` | Logging API key |
132+
| `DISPATCH_APP_KEY` | `` | Application key |
133+
| `DISPATCH_MAPBOX_PUBKEY` | `` | Mapbox public key |
134+
| `DISPATCH_SENTRY_DSN` | `` | Sentry DSN for error tracking |
135+
| `DISPATCH_COUNTLY_APP_KEY` | `` | Countly analytics app key |
136+
| `DISPATCH_COUNTLY_SERVER_URL` | `` | Countly server URL |
137+
| `DISPATCH_MAINTENANCE_MODE` | `false` | Enable maintenance mode |
138+
139+
### Docker Commands
140+
141+
```bash
142+
# Build image
143+
yarn docker:build
144+
145+
# Run container with environment file
146+
yarn docker:run
147+
148+
# Start with docker-compose (detached)
149+
yarn docker:up
150+
151+
# Stop docker-compose services
152+
yarn docker:down
153+
154+
# View logs
155+
yarn docker:logs
156+
```
157+
158+
### Manual Docker Run
159+
160+
```bash
161+
docker run -d \
162+
-p 3000:80 \
163+
-e DISPATCH_BASE_API_URL=https://api.resgrid.com \
164+
-e DISPATCH_API_VERSION=v4 \
165+
-e DISPATCH_MAPBOX_PUBKEY=your_mapbox_key \
166+
--name resgrid-dispatch \
167+
resgrid-dispatch-web
168+
```
169+
170+
### Pull from Docker Hub
91171

92172
docker pull resgridllc/dispatch
93173

docker-compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '3.8'
2+
3+
services:
4+
dispatch-web:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: resgrid-dispatch-web
9+
ports:
10+
- "3000:80"
11+
environment:
12+
# API Configuration
13+
- DISPATCH_BASE_API_URL=https://api.resgrid.com
14+
- DISPATCH_API_VERSION=v4
15+
- DISPATCH_RESGRID_API_URL=/api/v4
16+
17+
# SignalR Hub Configuration
18+
- DISPATCH_CHANNEL_HUB_NAME=eventingHub
19+
- DISPATCH_REALTIME_GEO_HUB_NAME=geolocationHub
20+
21+
# Logging and Analytics
22+
- DISPATCH_LOGGING_KEY=
23+
- DISPATCH_APP_KEY=
24+
- DISPATCH_SENTRY_DSN=
25+
- DISPATCH_COUNTLY_APP_KEY=
26+
- DISPATCH_COUNTLY_SERVER_URL=
27+
28+
# Mapbox Configuration
29+
- DISPATCH_MAPBOX_PUBKEY=
30+
31+
# Feature Flags
32+
- DISPATCH_MAINTENANCE_MODE=false
33+
restart: unless-stopped
34+
healthcheck:
35+
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/health"]
36+
interval: 30s
37+
timeout: 10s
38+
retries: 3
39+
start_period: 10s
40+
41+
# Example usage with custom environment file:
42+
# docker-compose --env-file .env.docker up -d

docs/map-theme-implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Map Theme Implementation
22

33
## Overview
4-
This document outlines the implementation of light/dark theme support for the map component in the Resgrid Unit app.
4+
This document outlines the implementation of light/dark theme support for the map component in the Resgrid Dispatch app.
55

66
## Changes Made
77

0 commit comments

Comments
 (0)