Skip to content

Commit 4cb8c3b

Browse files
Merge pull request #113 from CodeForPhilly/zbl_dev_postusaupdate
Updated README and Sync Down Script
2 parents ec9e433 + 66e6a3c commit 4cb8c3b

33 files changed

+532
-585
lines changed

.env.example

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,21 @@ MONGODB_DOCKER_PORT=27017
66
NODE_LOCAL_PORT=6868
77
PORT=8080
88
PAC_API_BASE_URL=https://app.plantagents.org
9-
PAC_API_KEY={api key from user on plantagents.org}
9+
PAC_API_KEY={api key from user on plantagents.org}
10+
11+
# Linode Object Storage Configuration
12+
AWS_ACCESS_KEY_ID=your-access-key
13+
AWS_SECRET_ACCESS_KEY=your-secret-key
14+
AWS_DEFAULT_REGION=us-east-1
15+
LINODE_BUCKET_NAME=choose-native-plants
16+
LINODE_ENDPOINT_URL=https://us-east-1.linodeobjects.com
17+
18+
#Source Data Google Sheet Locations
19+
MASTER_CSV_URL=https://docs.google.com/spreadsheets/d/1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o/export?format=csv&id=1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o&gid=1957761759
20+
ARTICLES_CSV_URL=https://docs.google.com/spreadsheets/d/1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o/export?format=csv&id=1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o&gid=1051500658
21+
IMAGE_URLS_SHEET_ID=1A8NGzjm1rm_QXBY3hJicYVK13GiYf-qKrgC71q1l0pQ
22+
SUPERPLANTS_CSV_URL=https://docs.google.com/spreadsheets/d/1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o/export?format=csv&id=1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o&gid=1087463332
23+
LOCAL_MAP_CSV_URL=https://docs.google.com/spreadsheets/d/1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o/export?format=csv&id=1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o&gid=2078739318
24+
CONTACT_SHEET_ID=1q_I2cx0ccaNtynDW491s3HdAXBN_zF9_BoKe7iH-ZLg
25+
CONTACT_FILES_FOLDER_ID=16fKrgsG0sS9rD9xSrYY_SbGnzLnL3_Ou
26+
ONLINE_STORES_CSV_URL=https://docs.google.com/spreadsheets/d/1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o/export?format=csv&id=1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o&gid=316834967

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ node_modules
1313

1414
# local copy of .env.example
1515
.env
16+
17+
#You need to get the images from the the linode store via the sync down script not from git.
18+
/images

README.md

Lines changed: 65 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
1-
# Choose Native Plants (fomerly "PA Wildflower Selector"
1+
# Choose Native Plants 🌱
22

3-
A web application that helps US residents find native plants suitable for their gardens. Users can search and filter plants based on various criteria like sun exposure, soil moisture, pollinators attracted, and more. The app also shows where to buy these plants locally.
3+
<div align="center">
44

5-
## Features
5+
![GitHub license](https://img.shields.io/github/license/CodeForPhilly/pa-wildflower-selector)
6+
![GitHub stars](https://img.shields.io/github/stars/CodeForPhilly/pa-wildflower-selector)
7+
![GitHub issues](https://img.shields.io/github/issues/CodeForPhilly/pa-wildflower-selector)
68

7-
- Interactive plant search and filtering
8-
- Detailed plant information including growing conditions
9-
- Local nursery finder showing where to buy plants
10-
- Quick search wizard for beginner gardeners
11-
- Mobile-friendly responsive design
9+
**Help US residents find and source native plants for their gardens**
1210

13-
## Architecture
11+
[Getting Started](#getting-started)
12+
[Features](#features)
13+
[Architecture](#architecture)
14+
[Development](#development)
15+
[Database](#database-operations)
16+
[Contributing](#contributing)
17+
18+
</div>
19+
20+
## 🌟 Overview
21+
22+
[Choose Native Plants](https://choose-native-plants.com) (formerly "PA Wildflower Selector") is a web application that helps US residents find native plants suitable for their gardens. Users can search and filter plants based on various criteria like sun exposure, soil moisture, pollinators attracted, and more. The app also shows where to buy these plants locally.
23+
24+
<div align="center">
25+
<img src="app-screenshot.png" alt="Application Screenshot" width="600">
26+
</div>
27+
28+
## ✨ Features
29+
30+
- 🔍 Interactive plant search with multiple filter options
31+
- 🌿 Detailed plant information including growing conditions
32+
- 🏪 Local nursery finder showing where to buy plants
33+
- 🧙 Quick search wizard for beginner gardeners
34+
- 📱 Mobile-friendly responsive design
35+
36+
## 🏗️ Architecture
1437

1538
- **Frontend**: Vue.js web application
1639
- **Backend**: Node.js server
@@ -19,139 +42,65 @@ A web application that helps US residents find native plants suitable for their
1942
- **Vendor Integration**: PlantagentsAPI for local nursery data
2043
- [API Documentation](https://app.plantagents.org/swagger/index.html)
2144

22-
## Prerequisites
45+
## 🚀 Getting Started
2346

24-
1. Docker Desktop installed and running
25-
2. Git
26-
3. Access to Code for Philly Slack channel (for env keys and secrets)
47+
### Prerequisites
2748

28-
## Project setup (Docker Based)
49+
- Docker Desktop installed and running
50+
- Git
51+
- User account with [Code for Philly](https://codeforphilly.org/)
2952

30-
Join the Code for Philly slack channel and ask for the env key, secrets.yaml, and images.
31-
32-
### 1. Initial Setup
53+
### Initial Setup
3354

3455
```bash
3556
# Clone the repository
3657
git clone https://github.com/CodeForPhilly/pa-wildflower-selector
3758

38-
```
39-
git clone https://github.com/CodeForPhilly/pa-wildflower-selector
40-
```
41-
42-
Then you can install the npm dependencies at the server app and ui app levels:
43-
44-
45-
```
59+
# Navigate to project directory
4660
cd pa-wildflower-selector
47-
```
48-
49-
For local development, `docker-compose` is used to create a consistent and disposable environment without any modification to or dependency on software installed to the developer's workstation. This approach also provides close parity between local development and container-based deployment in production to Kubernetes.
50-
51-
Make sure Docker Desktop is running and run this Docker compose command:
52-
5361

54-
```
62+
# Start the Docker environment
5563
docker compose up -d --build
5664
```
5765

58-
## First time and occasional stuff
59-
If you ran docker compose for the first time, you should see http://localhost:6868/ running with no images or data.
60-
61-
### Copy images to images folder.
62-
66+
### Sync down the database and images locally
67+
```bash
68+
docker compose --profile tools run --rm sync-down
69+
```
6370

64-
### Populate mongodb based on google sheets plant listing.
71+
### View the application locally
72+
After setup, visit http://localhost:6868/ to view the application.
6573

66-
Run:
74+
## 💾 Database Operations
6775

76+
### MongoDB Connection
6877

78+
Connect to MongoDB using MongoDB Compass with:
6979
```
70-
docker-compose exec app node ./download.js --skip-images
80+
mongodb://[username]:[password]@localhost:7017/pa-wildflower-selector?authSource=admin
7181
```
7282

73-
### Massage the mongodb data so the UI can work with it.
83+
## 🛠️ Development
7484

75-
Run:
85+
### Project Structure
7686

87+
- **UI Code**: Located in `src/` directory
88+
- **Server Code**: Located in the main project directory
7789

78-
```
79-
docker-compose exec app node massage.js
80-
```
81-
90+
## 👥 Contributing
8291

83-
### Where is the UI code?
92+
We welcome contributions from the community! To contribute:
8493

85-
In `src/`.
94+
1. Fork the repository
95+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
96+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
97+
4. Push to the branch (`git push origin feature/amazing-feature`)
98+
5. Open a Pull Request
8699

87-
### Where is the server-side app code that answers queries?
88-
89-
In the main folder of the project.
90-
91-
92-
## Database Operations
93-
94-
### Querying MongoDB
95-
You can run these commands in the MongoDB container to check the database state:
96-
97-
```bash
98-
# Count total plants
99-
db.plants.count()
100-
101-
# Count plants in Alabama
102-
db.plants.find({"States": "AL"}).count()
103-
104-
# Find a specific plant
105-
db.plants.findOne({_id: "Asclepias tuberosa"})
106-
107-
# Count images in Docker container
108-
docker exec pa-wildflower-selector-app-1 sh -c "ls -1 images/*.jpg | wc -l"
109-
```
110-
111-
### Data Updates
112-
To update the plant data and images:
113-
114-
```bash
115-
# Full update (including image downloads)
116-
npm run update-data
117-
118-
# Quick update (skip image downloads)
119-
npm run fast-update-data
120-
```
121-
122-
### Database Sync
123-
Two scripts are available for database synchronization:
124-
125-
- `scripts/sync-down.sh`: Downloads MongoDB data and images from remote server
126-
- `scripts/sync-up.sh`: Uploads local MongoDB data and images to remote server
127-
128-
## Development Environment
129-
130-
### Docker Setup
131-
The application runs in Docker containers. Key ports:
132-
- MongoDB: 7017 (host) -> 27017 (container)
133-
- Application: 6868 (host) -> 8080 (container)
134-
135-
```bash
136-
# Start the development environment
137-
docker-compose up -d --build
138-
139-
# View logs
140-
docker-compose logs -f
141-
142-
# Stop the environment
143-
docker-compose down
144-
```
100+
## 📧 Contact
145101

146-
### Environment Variables
147-
Copy `.env.example` to `.env` and configure:
148-
- MongoDB credentials
149-
- API endpoints
150-
- Port mappings
102+
For any questions or inquiries, please email us at [[email protected]](mailto:[email protected]).
151103

152-
### SOURCE DATA
153-
The source data is from ERA that is populated on a google sheet ("ERA" and "ONLINE" sheets).
154-
https://docs.google.com/spreadsheets/d/1R_zhN3GUxhDEMlGFMhcPB_gAoaE9IoyWi10I_nM9f3o
104+
## 📄 License
155105

156-
Citation for the source data:
157-
United States Department of Agriculture and US Federal Highway Administration. 2017. National database for pollinator-friendly revegetation and restoration. Compiled by Mark W. Skinner, Gretchen LeBuhn, David Inouye, Terry Griswold, and Jennifer Hopwood. Online at . Contact Mark W. Skinner for updates or more information.
106+
This project is licensed under the MIT License - see the LICENSE file for details.

app-screenshot.png

914 KB
Loading

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,43 @@ services:
2424
- DB_PASSWORD=$MONGODB_PASSWORD
2525
- DB_NAME=$MONGODB_DATABASE
2626
- DB_PORT=$MONGODB_DOCKER_PORT
27+
- MASTER_CSV_URL=$MASTER_CSV_URL
28+
- ARTICLES_CSV_URL=$ARTICLES_CSV_URL
29+
- SUPERPLANTS_CSV_URL=$SUPERPLANTS_CSV_URL
30+
- LOCAL_MAP_CSV_URL=$LOCAL_MAP_CSV_URL
31+
- ONLINE_STORES_CSV_URL=$ONLINE_STORES_CSV_URL
32+
- IMAGE_URLS_SHEET_ID=$IMAGE_URLS_SHEET_ID
33+
- CONTACT_SHEET_ID=$CONTACT_SHEET_ID
34+
- CONTACT_FILES_FOLDER_ID=$CONTACT_FILES_FOLDER_ID
2735
stdin_open: true
2836
tty: true
2937
volumes:
3038
- images:/app/images
39+
sync:
40+
build:
41+
context: ./scripts
42+
dockerfile: sync-up.Dockerfile
43+
depends_on:
44+
- mongodb
45+
env_file: ./.env
46+
profiles:
47+
- tools
48+
volumes:
49+
- ./images:/data/images:ro
50+
- ./data:/data/db_dumps
51+
sync-down:
52+
build:
53+
context: ./scripts
54+
dockerfile: sync-down.Dockerfile
55+
depends_on:
56+
- mongodb
57+
env_file: ./.env
58+
profiles:
59+
- tools
60+
volumes:
61+
- images:/data/images
62+
- ./data:/data/db_dumps
63+
3164
volumes:
3265
db:
3366
images:

0 commit comments

Comments
 (0)