final round of updates. Still need to stabalize first load for the map, having issues for sure; longer load time
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
"stars_count": 0,
|
||||
"forks_count": 0,
|
||||
"open_issues_count": 0,
|
||||
"updated_at": "2025-07-04T14:31:11-06:00",
|
||||
"updated_at": "2025-07-05T23:14:45-06:00",
|
||||
"created_at": "2025-05-28T14:54:59-06:00",
|
||||
"clone_url": "https://gitea.bnkops.com/admin/changemaker.lite.git",
|
||||
"ssh_url": "git@gitea.bnkops.com:admin/changemaker.lite.git",
|
||||
"default_branch": "main",
|
||||
"last_build_update": "2025-07-04T14:31:11-06:00"
|
||||
"last_build_update": "2025-07-05T23:14:45-06:00"
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
"description": "Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.",
|
||||
"html_url": "https://github.com/anthropics/claude-code",
|
||||
"language": "PowerShell",
|
||||
"stars_count": 17373,
|
||||
"forks_count": 959,
|
||||
"open_issues_count": 1578,
|
||||
"updated_at": "2025-07-04T21:17:51Z",
|
||||
"stars_count": 17581,
|
||||
"forks_count": 977,
|
||||
"open_issues_count": 1616,
|
||||
"updated_at": "2025-07-06T05:36:02Z",
|
||||
"created_at": "2025-02-22T17:41:21Z",
|
||||
"clone_url": "https://github.com/anthropics/claude-code.git",
|
||||
"ssh_url": "git@github.com:anthropics/claude-code.git",
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
"description": "VS Code in the browser",
|
||||
"html_url": "https://github.com/coder/code-server",
|
||||
"language": "TypeScript",
|
||||
"stars_count": 72668,
|
||||
"forks_count": 6074,
|
||||
"open_issues_count": 143,
|
||||
"updated_at": "2025-07-04T18:33:06Z",
|
||||
"stars_count": 72703,
|
||||
"forks_count": 6078,
|
||||
"open_issues_count": 144,
|
||||
"updated_at": "2025-07-06T05:59:54Z",
|
||||
"created_at": "2019-02-27T16:50:41Z",
|
||||
"clone_url": "https://github.com/coder/code-server.git",
|
||||
"ssh_url": "git@github.com:coder/code-server.git",
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "A highly customizable homepage (or startpage / application dashboard) with Docker and service API integrations.",
|
||||
"html_url": "https://github.com/gethomepage/homepage",
|
||||
"language": "JavaScript",
|
||||
"stars_count": 24643,
|
||||
"forks_count": 1522,
|
||||
"stars_count": 24660,
|
||||
"forks_count": 1526,
|
||||
"open_issues_count": 2,
|
||||
"updated_at": "2025-07-04T19:49:50Z",
|
||||
"updated_at": "2025-07-06T05:23:44Z",
|
||||
"created_at": "2022-08-24T07:29:42Z",
|
||||
"clone_url": "https://github.com/gethomepage/homepage.git",
|
||||
"ssh_url": "git@github.com:gethomepage/homepage.git",
|
||||
"default_branch": "dev",
|
||||
"last_build_update": "2025-07-04T12:13:48Z"
|
||||
"last_build_update": "2025-07-06T00:40:33Z"
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD",
|
||||
"html_url": "https://github.com/go-gitea/gitea",
|
||||
"language": "Go",
|
||||
"stars_count": 49370,
|
||||
"stars_count": 49388,
|
||||
"forks_count": 5897,
|
||||
"open_issues_count": 2711,
|
||||
"updated_at": "2025-07-04T20:42:00Z",
|
||||
"open_issues_count": 2708,
|
||||
"updated_at": "2025-07-06T05:36:50Z",
|
||||
"created_at": "2016-11-01T02:13:26Z",
|
||||
"clone_url": "https://github.com/go-gitea/gitea.git",
|
||||
"ssh_url": "git@github.com:go-gitea/gitea.git",
|
||||
"default_branch": "main",
|
||||
"last_build_update": "2025-07-04T15:41:19Z"
|
||||
"last_build_update": "2025-07-06T05:36:45Z"
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.",
|
||||
"html_url": "https://github.com/knadh/listmonk",
|
||||
"language": "Go",
|
||||
"stars_count": 17261,
|
||||
"forks_count": 1659,
|
||||
"open_issues_count": 103,
|
||||
"updated_at": "2025-07-04T18:22:09Z",
|
||||
"stars_count": 17265,
|
||||
"forks_count": 1661,
|
||||
"open_issues_count": 97,
|
||||
"updated_at": "2025-07-06T04:14:35Z",
|
||||
"created_at": "2019-06-26T05:08:39Z",
|
||||
"clone_url": "https://github.com/knadh/listmonk.git",
|
||||
"ssh_url": "git@github.com:knadh/listmonk.git",
|
||||
"default_branch": "master",
|
||||
"last_build_update": "2025-07-02T18:01:43Z"
|
||||
"last_build_update": "2025-07-05T13:20:25Z"
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "Create & scan cute qr codes easily \ud83d\udc7e",
|
||||
"html_url": "https://github.com/lyqht/mini-qr",
|
||||
"language": "Vue",
|
||||
"stars_count": 1258,
|
||||
"stars_count": 1259,
|
||||
"forks_count": 164,
|
||||
"open_issues_count": 13,
|
||||
"updated_at": "2025-07-04T21:12:26Z",
|
||||
"updated_at": "2025-07-05T15:44:11Z",
|
||||
"created_at": "2023-04-21T14:20:14Z",
|
||||
"clone_url": "https://github.com/lyqht/mini-qr.git",
|
||||
"ssh_url": "git@github.com:lyqht/mini-qr.git",
|
||||
"default_branch": "main",
|
||||
"last_build_update": "2025-07-01T14:06:08Z"
|
||||
"last_build_update": "2025-07-06T03:08:22Z"
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.",
|
||||
"html_url": "https://github.com/n8n-io/n8n",
|
||||
"language": "TypeScript",
|
||||
"stars_count": 114980,
|
||||
"forks_count": 33907,
|
||||
"open_issues_count": 1074,
|
||||
"updated_at": "2025-07-04T21:26:25Z",
|
||||
"stars_count": 115275,
|
||||
"forks_count": 34061,
|
||||
"open_issues_count": 1080,
|
||||
"updated_at": "2025-07-06T05:59:18Z",
|
||||
"created_at": "2019-06-22T09:24:21Z",
|
||||
"clone_url": "https://github.com/n8n-io/n8n.git",
|
||||
"ssh_url": "git@github.com:n8n-io/n8n.git",
|
||||
"default_branch": "master",
|
||||
"last_build_update": "2025-07-04T18:53:03Z"
|
||||
"last_build_update": "2025-07-05T21:59:59Z"
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "\ud83d\udd25 \ud83d\udd25 \ud83d\udd25 Open Source Airtable Alternative",
|
||||
"html_url": "https://github.com/nocodb/nocodb",
|
||||
"language": "TypeScript",
|
||||
"stars_count": 55535,
|
||||
"stars_count": 55551,
|
||||
"forks_count": 3997,
|
||||
"open_issues_count": 718,
|
||||
"updated_at": "2025-07-04T20:56:30Z",
|
||||
"open_issues_count": 717,
|
||||
"updated_at": "2025-07-06T04:11:36Z",
|
||||
"created_at": "2017-10-29T18:51:48Z",
|
||||
"clone_url": "https://github.com/nocodb/nocodb.git",
|
||||
"ssh_url": "git@github.com:nocodb/nocodb.git",
|
||||
"default_branch": "develop",
|
||||
"last_build_update": "2025-07-04T18:37:18Z"
|
||||
"last_build_update": "2025-07-06T04:38:06Z"
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"description": "Get up and running with Llama 3.3, DeepSeek-R1, Phi-4, Gemma 3, Mistral Small 3.1 and other large language models.",
|
||||
"html_url": "https://github.com/ollama/ollama",
|
||||
"language": "Go",
|
||||
"stars_count": 145579,
|
||||
"forks_count": 12297,
|
||||
"open_issues_count": 1881,
|
||||
"updated_at": "2025-07-04T20:55:45Z",
|
||||
"stars_count": 145672,
|
||||
"forks_count": 12305,
|
||||
"open_issues_count": 1858,
|
||||
"updated_at": "2025-07-06T05:29:22Z",
|
||||
"created_at": "2023-06-26T19:39:32Z",
|
||||
"clone_url": "https://github.com/ollama/ollama.git",
|
||||
"ssh_url": "git@github.com:ollama/ollama.git",
|
||||
"default_branch": "main",
|
||||
"last_build_update": "2025-07-04T05:42:44Z"
|
||||
"last_build_update": "2025-07-06T00:20:42Z"
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
"description": "Documentation that simply works",
|
||||
"html_url": "https://github.com/squidfunk/mkdocs-material",
|
||||
"language": "Python",
|
||||
"stars_count": 23801,
|
||||
"forks_count": 3792,
|
||||
"open_issues_count": 6,
|
||||
"updated_at": "2025-07-04T20:37:34Z",
|
||||
"stars_count": 23806,
|
||||
"forks_count": 3793,
|
||||
"open_issues_count": 7,
|
||||
"updated_at": "2025-07-06T00:58:35Z",
|
||||
"created_at": "2016-01-28T22:09:23Z",
|
||||
"clone_url": "https://github.com/squidfunk/mkdocs-material.git",
|
||||
"ssh_url": "git@github.com:squidfunk/mkdocs-material.git",
|
||||
|
||||
210
mkdocs/docs/build/map.md
vendored
210
mkdocs/docs/build/map.md
vendored
@@ -1,100 +1,138 @@
|
||||
# Map
|
||||
# Map Build Guide
|
||||
|
||||
Map is BNKops canvassing application. It is built from the ground up to serve our community (Edmonton).
|
||||
Map is BNKops canvassing application built for community organizing and door-to-door canvassing.
|
||||
|
||||
!!! info "Complete Configuration"
|
||||
For detailed configuration, usage instructions, and troubleshooting, see the [Map Configuration Guide](../config/map.md).
|
||||
|
||||
!!! warning "Clean NocoDB"
|
||||
Currently the way to get a good result is to ensure the target nocodb database is empty. You can do this by deleting all bases. The script should still work with other volumes however may insert tables into odd locations; still debugging. Again, see config if needing to do manually.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- NocoDB instance with API access
|
||||
- Domain name (optional but recommended for production)
|
||||
|
||||
## NocoDB Table Setup
|
||||
## Quick Build Process
|
||||
|
||||
### Required Columns
|
||||
### 1. Get NocoDB API Token
|
||||
|
||||
!!! warning "Case Sensitive"
|
||||
When entering in the required columns, make sure that you enter in exact information. Case sensitivity matters for mapping the values to the map itself.
|
||||
1. Login to your NocoDB instance
|
||||
2. Click user icon → **Account Settings** → **API Tokens**
|
||||
3. Create new token with read/write permissions
|
||||
4. Copy the token for the next step
|
||||
|
||||
Create a table in NocoDB with these required columns. The format here is the `Name of the column - column type - details`:
|
||||
### 2. Configure Environment
|
||||
|
||||
1. **Geo-Location** (geo-data) - Format: "latitude;longitude"
|
||||
2. **latitude** (Decimal) - Precision: 10, Scale: 8
|
||||
3. **longitude** (Decimal) - Precision: 11, Scale: 8
|
||||
|
||||
### Recommended Columns
|
||||
|
||||
- First Name (Text)
|
||||
- Last Name (Text)
|
||||
- Email (Email)
|
||||
- Phone (Phone)
|
||||
- Unit Number (Text)
|
||||
- Address (LongText)
|
||||
- Support Level (Single Select) - Values (only enter numbers):
|
||||
- 1 `Strong Support (Green)`
|
||||
- 2 `Moderate Support (Yellow)`
|
||||
- 3 `Low Support (Orange)`
|
||||
- 4 `No Support (Red)`
|
||||
- Sign (Checkbox)
|
||||
- Sign Size (Single Select) - Values: Small, Medium, Large
|
||||
- Notes (LongText)
|
||||
|
||||
## Login Sheet Setup
|
||||
Create a separate table for authorized users with:
|
||||
- Email (Email) - Primary column
|
||||
- Name (Text) - Optional
|
||||
|
||||
## API Token Setup
|
||||
|
||||
1. In NocoDB, click user icon → Account Settings
|
||||
2. Go to "API Tokens" tab
|
||||
3. Create new token with read/write permissions for both tables
|
||||
|
||||
## 6. Finding NocoDB IDs
|
||||
|
||||
- **Project and Table IDs**: Use the full NocoDB view URL in `NOCODB_VIEW_URL`
|
||||
- **Login Sheet ID**: Use the full URL to your login sheet in `NOCODB_LOGIN_SHEET`
|
||||
|
||||
## Environment Configuration
|
||||
|
||||
!!! note "Config"
|
||||
The `./config.sh` should have created a new `.env` file. If `.env` file is present, and it has properly defined domain, skip to step 2
|
||||
|
||||
1. Copy the example env file:
|
||||
Edit the `.env` file in the `map/` directory:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
cd map
|
||||
```
|
||||
|
||||
2. Edit .env with your NocoDB details:
|
||||
Update your `.env` file with your NocoDB details, specifically the instance and api token:
|
||||
|
||||
```env
|
||||
# NocoDB API Configuration
|
||||
NOCODB_API_URL=https://your-nocodb-instance.com/api/v1
|
||||
NOCODB_API_TOKEN=your-api-token-here
|
||||
NOCODB_VIEW_URL=https://your-nocodb-instance.com/dashboard/#/nc/project-id/table-id
|
||||
NOCODB_LOGIN_SHEET=https://your-nocodb-instance.com/dashboard/#/nc/project-id/login-sheet-id
|
||||
|
||||
# These will be populated after running build-nocodb.sh
|
||||
NOCODB_VIEW_URL=
|
||||
NOCODB_LOGIN_SHEET=
|
||||
NOCODB_SETTINGS_SHEET=
|
||||
|
||||
# Server Configuration
|
||||
PORT=3000
|
||||
NODE_ENV=production
|
||||
|
||||
# Session Secret (generate with: openssl rand -hex 32)
|
||||
SESSION_SECRET=your-secure-random-string
|
||||
|
||||
# Map Defaults
|
||||
# Map Defaults (Edmonton, AB)
|
||||
DEFAULT_LAT=53.5461
|
||||
DEFAULT_LNG=-113.4938
|
||||
DEFAULT_ZOOM=11
|
||||
|
||||
# Optional: Map Boundaries
|
||||
# BOUND_NORTH=53.7
|
||||
# BOUND_SOUTH=53.4
|
||||
# BOUND_EAST=-113.3
|
||||
# BOUND_WEST=-113.7
|
||||
|
||||
# Domain Settings (for cookies)
|
||||
# Production Settings
|
||||
COOKIE_DOMAIN=.yourdomain.com
|
||||
ALLOWED_ORIGINS=https://map.yourdomain.com,http://localhost:3000
|
||||
```
|
||||
|
||||
## Running the Application
|
||||
### 3. Auto-Create Database Structure
|
||||
|
||||
Run the build script to create required tables:
|
||||
|
||||
```bash
|
||||
chmod +x build-nocodb.sh
|
||||
./build-nocodb.sh
|
||||
```
|
||||
|
||||
This creates three tables:
|
||||
- **Locations** - Main map data with geo-location, contact info, support levels
|
||||
- **Login** - User authentication (email, name, admin flag)
|
||||
- **Settings** - Admin configuration and QR codes
|
||||
|
||||
### 4. Get Table URLs
|
||||
|
||||
After the script completes:
|
||||
|
||||
1. Login to your NocoDB instance
|
||||
2. Navigate to your project ("Map Viewer Project")
|
||||
3. Copy the view URLs for each table from your browser address bar
|
||||
4. URLs should look like: `https://your-nocodb.com/dashboard/#/nc/project-id/table-id`
|
||||
|
||||
### 5. Update Environment with URLs
|
||||
|
||||
Edit your `.env` file and add the table URLs:
|
||||
|
||||
```env
|
||||
NOCODB_VIEW_URL=https://your-nocodb.com/dashboard/#/nc/project-id/locations-table-id
|
||||
NOCODB_LOGIN_SHEET=https://your-nocodb.com/dashboard/#/nc/project-id/login-table-id
|
||||
NOCODB_SETTINGS_SHEET=https://your-nocodb.com/dashboard/#/nc/project-id/settings-table-id
|
||||
```
|
||||
|
||||
### 6. Build and Deploy
|
||||
|
||||
Build the Docker image and start the application:
|
||||
|
||||
```bash
|
||||
# Build the Docker image
|
||||
docker-compose build
|
||||
|
||||
# Start the application
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Verify Installation
|
||||
|
||||
1. Check container status:
|
||||
```bash
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
2. View logs:
|
||||
```bash
|
||||
docker-compose logs -f map-viewer
|
||||
```
|
||||
|
||||
3. Access the application at `http://localhost:3000`
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Login**: Use an email from your Login table
|
||||
2. **Add Locations**: Click on the map to add new locations
|
||||
3. **Admin Panel**: Admin users can access `/admin.html` for configuration
|
||||
4. **Walk Sheets**: Generate printable canvassing forms with QR codes
|
||||
|
||||
## Maintenance Commands
|
||||
|
||||
### Update Application
|
||||
```bash
|
||||
docker-compose down
|
||||
git pull origin main
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Development Mode
|
||||
```bash
|
||||
@@ -103,45 +141,11 @@ npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Production with Docker
|
||||
### Health Check
|
||||
```bash
|
||||
docker-compose up -d
|
||||
curl http://localhost:3000/health
|
||||
```
|
||||
|
||||
## First Run
|
||||
## Support
|
||||
|
||||
1. Access the application at `http://localhost:3000` (or your domain)
|
||||
2. Login with an email from your authorized users list
|
||||
3. Verify locations appear on the map
|
||||
|
||||
## Maintenance
|
||||
|
||||
- To clear the geocoding cache, restart the application
|
||||
- To update the application:
|
||||
```bash
|
||||
docker-compose down
|
||||
git pull origin main
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Locations not showing**: Verify table has required columns and API token has read permissions
|
||||
- **Cannot add locations**: Check API token has write permissions
|
||||
- **Authentication issues**: Verify login sheet is properly configured
|
||||
|
||||
## Security Recommendations
|
||||
|
||||
1. Use HTTPS in production
|
||||
2. Regularly rotate API tokens
|
||||
3. Restrict API token permissions to only what's needed
|
||||
4. Set appropriate CORS and cookie domains
|
||||
5. Keep dependencies updated
|
||||
|
||||
The application will automatically:
|
||||
|
||||
- Parse project/table IDs from view URLs
|
||||
- Sync geo fields between different formats
|
||||
- Cache geocoding results for performance
|
||||
- Rate limit API endpoints
|
||||
- Validate all inputs
|
||||
For detailed configuration, troubleshooting, and usage instructions, see the [Map Configuration Guide](../config/map.md).
|
||||
390
mkdocs/docs/config/map.md
Normal file
390
mkdocs/docs/config/map.md
Normal file
@@ -0,0 +1,390 @@
|
||||
# Map Configuration
|
||||
|
||||
The Map system is a containerized web application that visualizes geographic data from NocoDB on an interactive map using Leaflet.js. It's designed for canvassing applications and community organizing.
|
||||
|
||||
## Features
|
||||
|
||||
- 🗺️ Interactive map visualization with OpenStreetMap
|
||||
- 📍 Real-time geolocation support for adding locations
|
||||
- ➕ Add new locations directly from the map interface
|
||||
- 🔄 Auto-refresh every 30 seconds
|
||||
- 📱 Responsive design for mobile devices
|
||||
- 🔒 Secure API proxy to protect NocoDB credentials
|
||||
- 👤 User authentication with login system
|
||||
- ⚙️ Admin panel for system configuration
|
||||
- 🎯 Configurable map start location
|
||||
- 📄 Walk Sheet generator for door-to-door canvassing
|
||||
- 🔗 QR code integration for digital resources
|
||||
- 🐳 Docker containerization for easy deployment
|
||||
- 🆓 100% open source (no proprietary dependencies)
|
||||
|
||||
## Setup Process Overview
|
||||
|
||||
The setup process involves several steps that must be completed in order:
|
||||
|
||||
1. **Get NocoDB API Token** - Create an API token in your NocoDB instance
|
||||
2. **Configure Environment** - Update the `.env` file with your NocoDB details
|
||||
3. **Auto-Create Database Structure** - Run the build script to create required tables
|
||||
4. **Get Table URLs** - Find and copy the URLs for the newly created tables
|
||||
5. **Update Environment with URLs** - Add the table URLs to your `.env` file
|
||||
6. **Build and Deploy** - Build the Docker image and start the application
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- NocoDB instance with API access
|
||||
- Domain name (optional but recommended for production)
|
||||
|
||||
## Step 1: Get NocoDB API Token
|
||||
|
||||
1. Login to your NocoDB instance
|
||||
2. Click your user icon → **Account Settings**
|
||||
3. Go to the **API Tokens** tab
|
||||
4. Click **Create new token**
|
||||
5. Set the following permissions:
|
||||
- **Read**: Yes
|
||||
- **Write**: Yes
|
||||
- **Delete**: Yes (optional, for admin functions)
|
||||
6. Copy the generated token - you'll need it for the next step
|
||||
|
||||
!!! warning "Token Security"
|
||||
Keep your API token secure and never commit it to version control. The token provides full access to your NocoDB data.
|
||||
|
||||
## Step 2: Configure Environment
|
||||
|
||||
Edit the `.env` file in the `map/` directory:
|
||||
|
||||
```env
|
||||
# NocoDB API Configuration
|
||||
NOCODB_API_URL=https://your-nocodb-instance.com/api/v1
|
||||
NOCODB_API_TOKEN=your-api-token-here
|
||||
|
||||
# These URLs will be populated after running build-nocodb.sh
|
||||
NOCODB_VIEW_URL=
|
||||
NOCODB_LOGIN_SHEET=
|
||||
NOCODB_SETTINGS_SHEET=
|
||||
|
||||
# Server Configuration
|
||||
PORT=3000
|
||||
NODE_ENV=production
|
||||
|
||||
# Session Secret (generate with: openssl rand -hex 32)
|
||||
SESSION_SECRET=your-secure-random-string
|
||||
|
||||
# Map Defaults (Edmonton, Alberta, Canada)
|
||||
DEFAULT_LAT=53.5461
|
||||
DEFAULT_LNG=-113.4938
|
||||
DEFAULT_ZOOM=11
|
||||
|
||||
# Optional: Map Boundaries (prevents users from adding points outside area)
|
||||
# BOUND_NORTH=53.7
|
||||
# BOUND_SOUTH=53.4
|
||||
# BOUND_EAST=-113.3
|
||||
# BOUND_WEST=-113.7
|
||||
|
||||
# Production Settings
|
||||
TRUST_PROXY=true
|
||||
COOKIE_DOMAIN=.yourdomain.com
|
||||
ALLOWED_ORIGINS=https://map.yourdomain.com,http://localhost:3000
|
||||
```
|
||||
|
||||
### Required Configuration
|
||||
|
||||
- `NOCODB_API_URL`: Your NocoDB instance API URL (usually ends with `/api/v1`)
|
||||
- `NOCODB_API_TOKEN`: The token you created in Step 1
|
||||
- `SESSION_SECRET`: Generate a secure random string for session encryption
|
||||
|
||||
### Optional Configuration
|
||||
|
||||
- `DEFAULT_LAT/LNG/ZOOM`: Default map center and zoom level
|
||||
- `BOUND_*`: Map boundaries to restrict where users can add points
|
||||
- `COOKIE_DOMAIN`: Your domain for cookie security
|
||||
- `ALLOWED_ORIGINS`: Comma-separated list of allowed origins for CORS
|
||||
|
||||
## Step 3: Auto-Create Database Structure
|
||||
|
||||
The `build-nocodb.sh` script will automatically create the required tables in your NocoDB instance.
|
||||
|
||||
```bash
|
||||
cd map
|
||||
chmod +x build-nocodb.sh
|
||||
./build-nocodb.sh
|
||||
```
|
||||
|
||||
### What the Script Creates
|
||||
|
||||
The script creates three tables with the following structure:
|
||||
|
||||
#### 1. Locations Table
|
||||
Main table for storing map data:
|
||||
|
||||
- `Geo-Location` (Geo-Data): Format "latitude;longitude"
|
||||
- `latitude` (Decimal): Precision 10, Scale 8
|
||||
- `longitude` (Decimal): Precision 11, Scale 8
|
||||
- `First Name` (Single Line Text): Person's first name
|
||||
- `Last Name` (Single Line Text): Person's last name
|
||||
- `Email` (Email): Email address
|
||||
- `Phone` (Single Line Text): Phone number
|
||||
- `Unit Number` (Single Line Text): Unit or apartment number
|
||||
- `Address` (Single Line Text): Street address
|
||||
- `Support Level` (Single Select): Options: "1", "2", "3", "4"
|
||||
- 1 = Strong Support (Green)
|
||||
- 2 = Moderate Support (Yellow)
|
||||
- 3 = Low Support (Orange)
|
||||
- 4 = No Support (Red)
|
||||
- `Sign` (Checkbox): Has campaign sign
|
||||
- `Sign Size` (Single Select): Options: "Small", "Medium", "Large"
|
||||
- `Notes` (Long Text): Additional details and comments
|
||||
|
||||
#### 2. Login Table
|
||||
User authentication table:
|
||||
|
||||
- `Email` (Email): User email address (Primary)
|
||||
- `Name` (Single Line Text): User display name
|
||||
- `Admin` (Checkbox): Admin privileges
|
||||
|
||||
#### 3. Settings Table
|
||||
Admin configuration table:
|
||||
|
||||
- `key` (Single Line Text): Setting identifier
|
||||
- `title` (Single Line Text): Display name
|
||||
- `value` (Long Text): Setting value
|
||||
- `Geo-Location` (Text): Format "latitude;longitude"
|
||||
- `latitude` (Decimal): Precision 10, Scale 8
|
||||
- `longitude` (Decimal): Precision 11, Scale 8
|
||||
- `zoom` (Number): Map zoom level
|
||||
- `category` (Single Select): Setting category
|
||||
- `updated_by` (Single Line Text): Last updater email
|
||||
- `updated_at` (DateTime): Last update time
|
||||
- `qr_code_1_image` (Attachment): QR code 1 image
|
||||
- `qr_code_2_image` (Attachment): QR code 2 image
|
||||
- `qr_code_3_image` (Attachment): QR code 3 image
|
||||
|
||||
### Default Data
|
||||
|
||||
The script also creates:
|
||||
- A default admin user (admin@example.com)
|
||||
- A default start location setting
|
||||
|
||||
## Step 4: Get Table URLs
|
||||
|
||||
After the script completes successfully:
|
||||
|
||||
1. Login to your NocoDB instance
|
||||
2. Navigate to your project (should be named "Map Viewer Project")
|
||||
3. For each table, get the view URL:
|
||||
- Click on the table name
|
||||
- Copy the URL from your browser's address bar
|
||||
- The URL should look like: `https://your-nocodb.com/dashboard/#/nc/project-id/table-id`
|
||||
|
||||
You need URLs for:
|
||||
- **Locations table** → `NOCODB_VIEW_URL`
|
||||
- **Login table** → `NOCODB_LOGIN_SHEET`
|
||||
- **Settings table** → `NOCODB_SETTINGS_SHEET`
|
||||
|
||||
## Step 5: Update Environment with URLs
|
||||
|
||||
Edit your `.env` file and add the table URLs:
|
||||
|
||||
```env
|
||||
# Update these with the actual URLs from your NocoDB instance
|
||||
NOCODB_VIEW_URL=https://your-nocodb.com/dashboard/#/nc/project-id/locations-table-id
|
||||
NOCODB_LOGIN_SHEET=https://your-nocodb.com/dashboard/#/nc/project-id/login-table-id
|
||||
NOCODB_SETTINGS_SHEET=https://your-nocodb.com/dashboard/#/nc/project-id/settings-table-id
|
||||
```
|
||||
|
||||
!!! warning "URL Format"
|
||||
Make sure to use the complete dashboard URLs, not the API URLs. The application will automatically extract the project and table IDs from these URLs.
|
||||
|
||||
## Step 6: Build and Deploy
|
||||
|
||||
Build the Docker image and start the application:
|
||||
|
||||
```bash
|
||||
# Build the Docker image
|
||||
docker-compose build
|
||||
|
||||
# Start the application
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Verify Deployment
|
||||
|
||||
1. Check that the container is running:
|
||||
```bash
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
2. Check the logs:
|
||||
```bash
|
||||
docker-compose logs -f map-viewer
|
||||
```
|
||||
|
||||
3. Access the application at `http://localhost:3000` (or your configured domain)
|
||||
|
||||
## Using the Map System
|
||||
|
||||
### User Interface
|
||||
|
||||
#### Main Map View
|
||||
- **Interactive Map**: Click and drag to navigate
|
||||
- **Add Location**: Click on the map to add a new location
|
||||
- **Search**: Use the search bar to find addresses
|
||||
- **Refresh**: Data refreshes automatically every 30 seconds
|
||||
|
||||
#### Location Markers
|
||||
- **Green**: Strong Support (Level 1)
|
||||
- **Yellow**: Moderate Support (Level 2)
|
||||
- **Orange**: Low Support (Level 3)
|
||||
- **Red**: No Support (Level 4)
|
||||
|
||||
#### Adding Locations
|
||||
1. Click on the map where you want to add a location
|
||||
2. Fill out the form with contact information
|
||||
3. Select support level and sign information
|
||||
4. Add any relevant notes
|
||||
5. Click "Save Location"
|
||||
|
||||
### Authentication
|
||||
|
||||
#### User Login
|
||||
- Users must be added to the Login table in NocoDB
|
||||
- Login with email address (no password required for simplified setup)
|
||||
- Admin users have additional privileges
|
||||
|
||||
#### Admin Access
|
||||
- Admin users can access `/admin.html`
|
||||
- Configure map start location
|
||||
- Set up walk sheet generator
|
||||
- Manage QR codes and settings
|
||||
|
||||
### Admin Panel Features
|
||||
|
||||
#### Start Location Configuration
|
||||
- **Interactive Map**: Visual interface for selecting coordinates
|
||||
- **Real-time Preview**: See changes immediately
|
||||
- **Validation**: Built-in coordinate and zoom level validation
|
||||
|
||||
#### Walk Sheet Generator
|
||||
- **Printable Forms**: Generate 8.5x11 walk sheets for door-to-door canvassing
|
||||
- **QR Code Integration**: Add up to 3 QR codes with custom URLs and labels
|
||||
- **Form Field Matching**: Automatically matches fields from the main location form
|
||||
- **Live Preview**: See changes as you type
|
||||
- **Print Optimization**: Proper formatting for printing or PDF export
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Public Endpoints
|
||||
- `GET /api/locations` - Fetch all locations (requires auth)
|
||||
- `POST /api/locations` - Create new location (requires auth)
|
||||
- `GET /api/locations/:id` - Get single location (requires auth)
|
||||
- `PUT /api/locations/:id` - Update location (requires auth)
|
||||
- `DELETE /api/locations/:id` - Delete location (requires auth)
|
||||
- `GET /api/config/start-location` - Get map start location
|
||||
- `GET /health` - Health check
|
||||
|
||||
### Authentication Endpoints
|
||||
- `POST /api/auth/login` - User login
|
||||
- `GET /api/auth/check` - Check authentication status
|
||||
- `POST /api/auth/logout` - User logout
|
||||
|
||||
### Admin Endpoints (requires admin privileges)
|
||||
- `GET /api/admin/start-location` - Get start location with source info
|
||||
- `POST /api/admin/start-location` - Update map start location
|
||||
- `GET /api/admin/walk-sheet-config` - Get walk sheet configuration
|
||||
- `POST /api/admin/walk-sheet-config` - Save walk sheet configuration
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
#### Locations not showing
|
||||
- Verify table has required columns (`Geo-Location`, `latitude`, `longitude`)
|
||||
- Check that coordinates are valid numbers
|
||||
- Ensure API token has read permissions
|
||||
- Verify `NOCODB_VIEW_URL` is correct
|
||||
|
||||
#### Cannot add locations
|
||||
- Verify API token has write permissions
|
||||
- Check browser console for errors
|
||||
- Ensure coordinates are within valid ranges
|
||||
- Verify user is authenticated
|
||||
|
||||
#### Authentication issues
|
||||
- Verify login table is properly configured
|
||||
- Check that user email exists in Login table
|
||||
- Ensure `NOCODB_LOGIN_SHEET` URL is correct
|
||||
|
||||
#### Build script failures
|
||||
- Check that `NOCODB_API_URL` and `NOCODB_API_TOKEN` are correct
|
||||
- Verify NocoDB instance is accessible
|
||||
- Check network connectivity
|
||||
- Review script output for specific error messages
|
||||
|
||||
### Development Mode
|
||||
|
||||
For development and debugging:
|
||||
|
||||
```bash
|
||||
cd map/app
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
This will start the application with hot reload and detailed logging.
|
||||
|
||||
### Logs and Monitoring
|
||||
|
||||
View application logs:
|
||||
```bash
|
||||
docker-compose logs -f map-viewer
|
||||
```
|
||||
|
||||
Check health status:
|
||||
```bash
|
||||
curl http://localhost:3000/health
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
1. **API Token Security**: Keep tokens secure and rotate regularly
|
||||
2. **HTTPS**: Use HTTPS in production
|
||||
3. **CORS Configuration**: Set appropriate `ALLOWED_ORIGINS`
|
||||
4. **Cookie Security**: Configure `COOKIE_DOMAIN` properly
|
||||
5. **Input Validation**: All inputs are validated server-side
|
||||
6. **Rate Limiting**: API endpoints have rate limiting
|
||||
7. **Session Security**: Use a strong `SESSION_SECRET`
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Regular Updates
|
||||
```bash
|
||||
# Stop the application
|
||||
docker-compose down
|
||||
|
||||
# Pull updates (if using git)
|
||||
git pull origin main
|
||||
|
||||
# Rebuild and restart
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Backup Considerations
|
||||
- NocoDB data is stored in your NocoDB instance
|
||||
- Back up your `.env` file securely
|
||||
- Consider backing up QR code images from the Settings table
|
||||
|
||||
### Performance Tips
|
||||
- Monitor NocoDB performance and scaling
|
||||
- Consider enabling caching for high-traffic deployments
|
||||
- Use CDN for static assets if needed
|
||||
- Monitor Docker container resource usage
|
||||
|
||||
## Support
|
||||
|
||||
For issues or questions:
|
||||
1. Check the troubleshooting section above
|
||||
2. Review NocoDB documentation
|
||||
3. Check Docker and Docker Compose documentation
|
||||
4. Open an issue on GitHub
|
||||
Reference in New Issue
Block a user