more configs and readme updates.

This commit is contained in:
2025-07-06 16:07:55 -06:00
parent c4ea51995e
commit 5f39ce8218
27 changed files with 249 additions and 150 deletions

View File

@@ -13,9 +13,9 @@ A containerized web application that visualizes geographic data from NocoDB on a
- 👤 User authentication with login system
- ⚙️ Admin panel for system configuration
- 🎯 Configurable map start location
- <EFBFBD> Walk Sheet generator for door-to-door canvassing
- 📋 Walk Sheet generator for door-to-door canvassing
- 🔗 QR code integration for digital resources
- <EFBFBD>🐳 Docker containerization for easy deployment
- 🐳 Docker containerization for easy deployment
- 🆓 100% open source (no proprietary dependencies)
## Quick Start
@@ -23,88 +23,129 @@ A containerized web application that visualizes geographic data from NocoDB on a
### Prerequisites
- Docker and Docker Compose
- NocoDB instance with a table containing location data
- NocoDB instance with API access
- NocoDB API token
### NocoDB Table Setup
1. **Main Locations Table** - Create a table with these required columns. The format here is `Column Name - Column Type - Other Settings`:
- `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
- `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)
- `Address` (Single Line Text): Street address
- `Sign` (Checkbox): Has campaign sign
- `Sign Size` (Single Select): Options: "Small", "Medium", "Large"
- `Notes` (Long Text): Additional details and comments
- `title` (Text): Location name (legacy field)
- `category` (Single Select): Classification (legacy field)
2. **Login Table** - Create a table for user authentication:
- `Email` (Email): User email address
- `Name` (Single Line Text): User display name
- `Admin` (Checkbox): Admin privileges
3. **Settings Table** - Create a table for admin configuration:
- `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
### Installation
1. Clone this repository or create the file structure as shown
1. **Get NocoDB API Token**
2. Copy the environment template:
```bash
cp .env.example .env
```
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
3. Edit `.env` with your NocoDB details:
2. **Configure Environment**
Edit the `.env` file with your NocoDB API and API Url:
```env
NOCODB_API_URL=https://db.lindalindsay.org/api/v1
NOCODB_API_TOKEN=your-token-here
NOCODB_VIEW_URL=https://db.lindalindsay.org/dashboard/#/nc/p406kno3lbq4zmq/mvtryxrvze6td79
NOCODB_LOGIN_SHEET=https://db.lindalindsay.org/dashboard/#/nc/p406kno3lbq4zmq/login_sheet_id
NOCODB_SETTINGS_SHEET=https://db.lindalindsay.org/dashboard/#/nc/p406kno3lbq4zmq/settings_sheet_id
# NocoDB API Configuration
NOCODB_API_URL=https://your-nocodb-instance.com/api/v1
NOCODB_API_TOKEN=your-api-token-here
# 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=your-secure-random-string
# Map Defaults (Edmonton, AB)
DEFAULT_LAT=53.5461
DEFAULT_LNG=-113.4938
DEFAULT_ZOOM=11
```
4. Start 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
```
5. Access the map at: http://localhost:3000
7. **Verify Installation**
## Finding NocoDB IDs
- Check container status: `docker-compose ps`
- View logs: `docker-compose logs -f map-viewer`
- Access the application at: http://localhost:3000
### API Token
## Database Schema
1. Click user icon → Account Settings
2. Go to "API Tokens" tab
3. Create new token with read/write permissions
The build script automatically creates the following table structure:
### Project and Table IDs
### Main Locations Table
- `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
- `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)
- `Address` (Single Line Text): Street address
- `Sign` (Checkbox): Has campaign sign
- `Sign Size` (Single Select): Options: "Small", "Medium", "Large"
- `Notes` (Long Text): Additional details and comments
- `title` (Text): Location name (legacy field)
- `category` (Single Select): Classification (legacy field)
- Simply provide the full NocoDB view URL in `NOCODB_VIEW_URL`
- The system will automatically extract the project and table IDs
### Login Table
- `Email` (Email): User email address
- `Name` (Single Line Text): User display name
- `Admin` (Checkbox): Admin privileges
### Settings 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
## API Endpoints
@@ -183,6 +224,28 @@ All configuration is done via environment variables:
| `DEFAULT_LNG` | Default map longitude | -113.4938 |
| `DEFAULT_ZOOM` | Default map zoom level | 11 |
## Maintenance Commands
### Update Application
```bash
docker-compose down
git pull origin main
docker-compose build
docker-compose up -d
```
### Development Mode
```bash
cd app
npm install
npm run dev
```
### Health Check
```bash
curl http://localhost:3000/health
```
## Development
To run in development mode:
@@ -226,6 +289,12 @@ To run in development mode:
- Check API URL format
- Confirm network connectivity
### Build Script Issues
- Ensure NocoDB instance is accessible
- Verify API token has admin permissions
- Check that the NocoDB database is clean (delete all bases before running)
## License
MIT License - See LICENSE file for details
@@ -237,8 +306,7 @@ For issues or questions:
2. Review NocoDB documentation
3. Open an issue on GitHub
# Known Bugs
## Known Bugs
- First load of page often fails, need to debug
- want ui for dots tohave a edit button that then brings up the form.
-
- Want UI for dots to have an edit button that then brings up the form