Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
648 changes: 0 additions & 648 deletions BOILERPLATE.md

This file was deleted.

79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,35 @@ END SERVICE

Athena expands this into **production-ready Docker Compose** with all the right defaults.

## Enhanced Error Handling

Athena now features **revolutionary error handling** with precise location information and intelligent suggestions:

### Before (Cryptic Errors)
```
Error: Parse error: Expected athena_file rule
```

### After (Enhanced Errors)
```
Error: Parse error at line 8, column 1: Missing 'END SERVICE' statement
|
8 | # Missing END SERVICE for demonstration
| ^ Error here

Suggestion: Each SERVICE block must be closed with 'END SERVICE'
```

### Smart Validation with Suggestions
```
Error: Port conflict detected! Host port 8080 is used by multiple services: app1, app2
Affected services: app1, app2

Suggestion: Use different host ports, e.g., 8080, 8081
```

**[📖 Learn more about Enhanced Error Handling →](docs/ERROR_HANDLING.md)**

## Quick Start

### Installation
Expand Down Expand Up @@ -113,6 +142,12 @@ athena init go my-service --framework gin --with-mongodb

## Key Features

### 🚨 Enhanced Error Handling System (New!)
- **Line & Column Precision** => Exact error locations with visual context
- **Intelligent Suggestions** => Automatic recommendations for common fixes
- **Advanced Validation** => Port conflicts, service references, circular dependencies
- **Fail-Fast Processing** => Immediate feedback with no partial generation

### Intelligent Defaults 2025+
- No more `version` field modern Docker Compose spec compliance
- Auto-detects service types database, Cache, WebApp, Proxy patterns
Expand Down Expand Up @@ -141,6 +176,7 @@ athena init go my-service --framework gin --with-mongodb
## Documentation

### Core Documentation
- [Enhanced Error Handling (**New**)](docs/ERROR_HANDLING.md) - Complete guide to Athena's advanced error system.
- [Installation Guide](docs/INSTALLATION.md)
- [Docker Compose Generator Usage](docs/DSL_REFERENCE.md)
- [Boilerplate Project Generator](docs/BOILERPLATE.md)
Expand Down Expand Up @@ -174,6 +210,49 @@ athena init go my-service --framework echo --with-postgresql
athena init flask my-app --with-postgresql
```

## Complete Example: Modern Web Application

The `presentation.ath` file demonstrates **all Athena features** in a production-ready web application:

```athena
DEPLOYMENT-ID MODERN_WEB_APP
VERSION-ID 1.0.0

ENVIRONMENT SECTION
NETWORK-NAME modern_app_network

SERVICES SECTION

SERVICE nginx_proxy
IMAGE-ID "nginx:alpine"
PORT-MAPPING 80 TO 80
DEPENDS-ON backend
END SERVICE

SERVICE backend
PORT-MAPPING 3000 TO 3000
ENV-VARIABLE {{NODE_ENV}}
DEPENDS-ON mongodb
END SERVICE

SERVICE mongodb
IMAGE-ID "mongo:7.0"
PORT-MAPPING 27017 TO 27017
RESTART-POLICY always
END SERVICE
```

**Generated Configuration Highlights:**

- **Automatic Dockerfile Detection**: Backend service gets `build.dockerfile: Dockerfile`
- **Service Type Detection**: MongoDB → Database type with optimized settings
- **Custom Network**: All services connected to `modern_app_network`
- **Smart Labels**: Project tracking and metadata automatically added
- **Dependency Ordering**: Services sorted automatically (mongodb → backend → nginx)
- **Health Checks**: Type-specific intervals and commands

This **65-line configuration** generates a **220+ line** production-ready Docker Compose file with all best practices included!

## What Athena Adds Automatically

- Smart service detection (Database, Cache, WebApp, Proxy)
Expand Down
224 changes: 193 additions & 31 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,218 @@
# Generated by Athena v0.1.0 from test_no_conflicts deployment
# Generated: 2025-09-17 13:08:45 UTC
# Generated by Athena v0.1.0 from MODERN_WEB_APP deployment
# Developed by UNFAIR Team
# Project Version: 1.0.0
# Generated: 2025-09-22 05:40:07 UTC
# Features: Intelligent defaults, optimized networking, enhanced health checks
# DO NOT EDIT MANUALLY - This file is auto-generated

# Services: 3 configured with intelligent defaults
# Services: 6 configured with intelligent defaults

services:
app2:
image: httpd:alpine
container_name: test-no-conflicts-app2
mongodb:
image: mongo:7.0
container_name: modern-web-app-mongodb
ports:
- 8081:8000
- 27017:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- MONGO_INITDB_DATABASE=${MONGO_INITDB_DATABASE}
volumes:
- ./data/mongodb:/data/db
- ./mongo-init:/docker-entrypoint-initdb.d:ro
healthcheck:
test:
- CMD-SHELL
- mongosh --eval 'db.adminCommand(ping)' || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: always
deploy:
resources:
limits:
cpus: '0.7'
memory: 1024M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
- modern_app_network
pull_policy: missing
labels:
athena.service: mongodb
athena.project: MODERN_WEB_APP
athena.type: webapp
athena.generated: 2025-09-22

backend:
build:
context: .
dockerfile: Dockerfile
container_name: modern-web-app-backend
ports:
- 3000:3000
environment:
- NODE_ENV=${NODE_ENV}
- JWT_SECRET=${JWT_SECRET}
- MONGODB_URI=${MONGODB_URI}
- API_PORT=${API_PORT}
command: npm start
depends_on:
- mongodb
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost:3000/api/health || exit 1
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
- test_no_conflicts_network
- modern_app_network
pull_policy: missing
labels:
athena.project: test_no_conflicts
athena.type: generic
athena.service: app2
athena.generated: 2025-09-17
athena.project: MODERN_WEB_APP
athena.generated: 2025-09-22
athena.service: backend

app1:
image: nginx:alpine
container_name: test-no-conflicts-app1
monitoring:
image: prom/prometheus:latest
container_name: modern-web-app-monitoring
ports:
- 8080:80
- 9090:9090
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./data/prometheus:/prometheus
depends_on:
- backend
restart: always
deploy:
resources:
limits:
cpus: '0.3'
memory: 512M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
- test_no_conflicts_network
- modern_app_network
pull_policy: missing
labels:
athena.service: app1
athena.type: proxy
athena.project: test_no_conflicts
athena.generated: 2025-09-17
athena.generated: 2025-09-22
athena.service: monitoring
athena.project: MODERN_WEB_APP
athena.type: generic

logs_collector:
image: fluent/fluent-bit:latest
container_name: modern-web-app-logs_collector
volumes:
- ./fluent-bit/fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf:ro
- /var/log:/var/log:ro
depends_on:
- backend
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.2'
memory: 128M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
- modern_app_network
pull_policy: missing
labels:
athena.generated: 2025-09-22
athena.service: logs_collector
athena.type: generic
athena.project: MODERN_WEB_APP

app3:
image: apache:latest
container_name: test-no-conflicts-app3
redis_cache:
image: redis:7-alpine
container_name: modern-web-app-redis_cache
ports:
- 6379:6379
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- ./data/redis:/data
healthcheck:
test:
- CMD-SHELL
- redis-cli ping || exit 1
interval: 15s
timeout: 3s
retries: 3
start_period: 20s
restart: always
deploy:
resources:
limits:
cpus: '0.3'
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
- modern_app_network
pull_policy: missing
labels:
athena.type: cache
athena.generated: 2025-09-22
athena.project: MODERN_WEB_APP
athena.service: redis_cache

nginx_proxy:
image: nginx:alpine
container_name: modern-web-app-nginx_proxy
ports:
- 9000:80
- 80:80
- 443:443
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- backend
healthcheck:
test:
- CMD-SHELL
- curl -f http://localhost:80/health || exit 1
interval: 20s
timeout: 5s
retries: 3
start_period: 30s
restart: always
networks:
- test_no_conflicts_network
- modern_app_network
pull_policy: missing
labels:
athena.service: nginx_proxy
athena.type: proxy
athena.project: test_no_conflicts
athena.service: app3
athena.generated: 2025-09-17
athena.project: MODERN_WEB_APP
athena.generated: 2025-09-22
networks:
test_no_conflicts_network:
modern_app_network:
driver: bridge
name: test_no_conflicts
name: MODERN_WEB_APP
Loading