Compare commits

2 Commits

Author SHA1 Message Date
1755f7a66e feat(dolibarr): deploy and verify dolibarr
This commit includes the necessary scripts and configuration to deploy and verify Dolibarr using Docker.
2025-09-09 16:38:29 -05:00
4868941c03 feat: initial project structure
Adds the initial directory structure, configuration files, and stub scripts for the Grav CMS and Dolibarr project.
2025-09-09 16:28:57 -05:00
9 changed files with 177 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.env.local

93
STARTHERE.md Executable file
View File

@@ -0,0 +1,93 @@
# 🚀 Gemini Agent Task: Grav CMS + Dolibarr Prospect Integration (v1.0)
You are an autonomous software development agent operating inside the Gemini CLI environment. Your task is to deliver a clean, containerized integration between **Grav CMS** and **Dolibarr**, enabling email capture on the website and automatic creation of prospect records in Dolibarr.
This is a v1.0 implementation. Keep it simple, modular, and extensible. Do not install anything on the host system.
---
## 🧱 Environment Constraints
- ✅ All operations must occur inside Docker containers.
- ❌ Do not use `apt`, `yum`, `brew`, or any host-level package manager.
- ✅ Use `docker-compose` to orchestrate services.
- ✅ Use named volumes and health checks.
- ✅ Log all actions to `logs/integration.log`.
---
## 🌐 Project Context
- **Website:** StartingLineProductions.com
- **CMS:** Grav (PHP-based, flat-file)
- **CRM:** Dolibarr (self-hosted via Cloudron)
- **Goal:** Capture email addresses via a form on the Grav site and push them into Dolibarr as new prospects.
---
## 🧩 Functional Requirements
- Create a form in Grav that collects:
- Email (required)
- First name (optional)
- Consent checkbox (required for GDPR)
- On submission:
- Validate input
- Send data to Dolibarr via REST API (`/thirdparties`)
- Create a new prospect with status “Draft” or “To Qualify”
- Log success/failure with timestamp
---
## 🔐 Dolibarr API Integration
- Authenticate using API token (stored in containerized config file)
- Required fields:
- `email`
- `name` (fallback to “Unknown”)
- `status` = 1 (prospect)
---
## 🛠️ Deliverables
- `docker-compose.yml` with Grav and Dolibarr services
- `user/plugins/prospectform/` Grav plugin or override
- `README.md` with setup and usage instructions
- `integration.log` with sample entries
- `config.yaml` with API token placeholder
- `form.html.twig` for frontend form
---
## ✅ Do vs. ❌ Dont
| ✅ Do | ❌ Dont |
|------|---------|
| ✅ Use containerized Grav and Dolibarr images | ❌ Install PHP or Grav on the host |
| ✅ Use documented Dolibarr API endpoints | ❌ Modify Dolibarr core or database directly |
| ✅ Log errors and retry up to 3 times | ❌ Silently fail or discard submissions |
| ✅ Keep code modular and extensible | ❌ Hardcode credentials or logic |
---
## 🧭 Agent Behavior
- Confirm understanding before starting
- Ask for clarification if API access fails or endpoint is ambiguous
- Propose fallback options if Dolibarr is unreachable
- Document any assumptions in `README.md`
---
## 📦 Future Enhancements (v1.1+)
- Add CAPTCHA or spam protection
- Sync additional fields (phone, company, etc.)
- Enable double opt-in email confirmation
- Add dashboard widget in Dolibarr for new signups
---
Begin with the Grav form and Dolibarr API integration. Keep it lean, reliable, and containerized.

42
docker-compose.yml Normal file
View File

@@ -0,0 +1,42 @@
version: '3.8'
services:
dolibarr:
image: tuxgasy/dolibarr:latest
container_name: STLPWebsite-dev-app
restart: always
ports:
- "8081:80"
environment:
- DOLI_DB_HOST=db
- DOLI_DB_NAME=${MARIADB_DATABASE}
- DOLI_DB_USER=${MARIADB_USER}
- DOLI_DB_PASSWORD=${MARIADB_PASSWORD}
- DOLI_URL_ROOT=http://localhost:8080
volumes:
- STLPWebsite-dev-app-docs:/var/www/documents
- STLPWebsite-dev-app-custom:/var/www/html/custom
networks:
- STLPWebsite-dev-network
db:
image: mariadb:latest
container_name: STLPWebsite-dev-db
restart: always
environment:
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
- MARIADB_DATABASE=${MARIADB_DATABASE}
- MARIADB_USER=${MARIADB_USER}
- MARIADB_PASSWORD=${MARIADB_PASSWORD}
volumes:
- STLPWebsite-dev-db-data:/var/lib/mysql
networks:
- STLPWebsite-dev-network
volumes:
STLPWebsite-dev-db-data:
STLPWebsite-dev-app-docs:
STLPWebsite-dev-app-custom:
networks:
STLPWebsite-dev-network:

View File

@@ -0,0 +1,4 @@
{
"last_completed_step": "01_verify_dolibarr.sh",
"last_run_timestamp": "2025-09-09T21:38:14Z"
}

13
project-config.yaml Normal file
View File

@@ -0,0 +1,13 @@
project_name: STLPWebsite
services:
- name: dolibarr
type: app
- name: grav
type: web
env:
dolibarr:
- DOLIBARR_API_KEY
grav:
[]

4
scripts/01_deploy_dolibarr.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
# Deploy Dolibarr
docker compose --env-file .env.local up -d

16
scripts/01_verify_dolibarr.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Verify Dolibarr
echo "Waiting for Dolibarr to start..."
sleep 60
echo "Pinging Dolibarr..."
if curl -s http://172.31.0.2:80 | grep -q "Dolibarr"; then
echo "Dolibarr verification successful."
exit 0
else
echo "Dolibarr verification failed."
echo "Dolibarr is not responding as expected. Here is the verbose output from curl:"
curl -v http://172.31.0.2:80
exit 1
fi

2
scripts/02_deploy_grav.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
# Deploy Grav CMS

2
scripts/02_verify_grav.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
# Verify Grav CMS