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
63 changes: 13 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Affected services: app1, app2
Suggestion: Use different host ports, e.g., 8080, 8081
```

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

## Quick Start

Expand Down Expand Up @@ -142,7 +142,7 @@ athena init go my-service --framework gin --with-mongodb

## Key Features

### 🚨 Enhanced Error Handling System (New!)
### 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
Expand Down Expand Up @@ -173,10 +173,17 @@ athena init go my-service --framework gin --with-mongodb
- Flask + PostgreSQL => Modern Python web development
- Docker ready => Multi-stage builds, Nginx reverse proxy included

### Syntax Highlighting (New!)
- **Beautiful DSL highlighting** for `.ath` files with customizable colors
- **Zed editor extension** ready to install in `syntax-highlighting/`
- **Smart color coding** for keywords, directives, template variables, and more
- **Easy customization** via `colors.json` make it your own!

## Documentation

### Core Documentation
- [Enhanced Error Handling (**New**)](docs/ERROR_HANDLING.md) - Complete guide to Athena's advanced error system.
- [Syntax Highlighting (**New**)](syntax-highlighting/README.md) - Beautiful colors for `.ath` files in Zed editor.
- [Installation Guide](docs/INSTALLATION.md)
- [Docker Compose Generator Usage](docs/DSL_REFERENCE.md)
- [Boilerplate Project Generator](docs/BOILERPLATE.md)
Expand Down Expand Up @@ -209,50 +216,6 @@ athena init go my-service --framework echo --with-postgresql
# Flask projects
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 All @@ -265,17 +228,17 @@ This **65-line configuration** generates a **220+ line** production-ready Docker
- Dockerfile integration when no image specified
- Dependency ordering with topological sort

## License

This project is licensed under the MIT License see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- **Pest** for powerful parsing capabilities
- **Clap** for excellent CLI framework
- **Docker Community** for container standards
- **Rust Community** for the amazing ecosystem

## License

This project is licensed under the MIT License see the [LICENSE](LICENSE) file for details.

---

Built with ❤️ using Rust | Production-ready DevOps made simple
42 changes: 21 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
# Generated by Athena v0.1.0 from test_no_conflicts deployment
# Developed by UNFAIR Team
# Generated: 2025-09-25 15:40:51 UTC
# Developed by UNFAIR Team: https://github.com/Jeck0v/Athena
# Generated: 2025-10-05 20:37:19 UTC
# Features: Intelligent defaults, optimized networking, enhanced health checks

# Services: 3 configured with intelligent defaults

services:
app3:
image: apache:latest
container_name: test-no-conflicts-app3
ports:
- 9000:80
restart: always
networks:
- test_no_conflicts_network
pull_policy: missing
labels:
athena.project: test_no_conflicts
athena.service: app3
athena.generated: 2025-10-05
athena.type: proxy

app1:
image: nginx:alpine
container_name: test-no-conflicts-app1
Expand All @@ -16,10 +31,10 @@ services:
- test_no_conflicts_network
pull_policy: missing
labels:
athena.generated: 2025-09-25
athena.type: proxy
athena.project: test_no_conflicts
athena.service: app1
athena.generated: 2025-10-05
athena.type: proxy

app2:
image: httpd:alpine
Expand All @@ -31,25 +46,10 @@ services:
- test_no_conflicts_network
pull_policy: missing
labels:
athena.type: generic
athena.service: app2
athena.type: generic
athena.project: test_no_conflicts
athena.generated: 2025-09-25

app3:
image: apache:latest
container_name: test-no-conflicts-app3
ports:
- 9000:80
restart: always
networks:
- test_no_conflicts_network
pull_policy: missing
labels:
athena.generated: 2025-09-25
athena.service: app3
athena.type: proxy
athena.project: test_no_conflicts
athena.generated: 2025-10-05
networks:
test_no_conflicts_network:
driver: bridge
Expand Down
93 changes: 93 additions & 0 deletions docs/PRESENTATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Athena Presentation Files Guide

This directory contains two presentation configurations demonstrating Athena's capabilities:

## Files Overview

### `presentation.ath` - Production Version
**Use for:** Demonstrating production-ready security practices

**Features:**
- ✅ **Secure**: Only nginx exposed (ports 80/443)
- ✅ **Internal services**: No external ports for databases/APIs
- ✅ **Production-ready**: Docker Swarm compatible
- ✅ **Comments**: Comprehensive documentation

**Exposed Ports:**
- `80, 443` - nginx_reverse_proxy (only entry point)
- `9090` - monitoring (Prometheus UI)

### `light_presentation.ath` - Demo/Testing Version
**Use for:** Live demonstrations, API testing, development

**Features:**
- ✅ **Testing-friendly**: All services accessible
- ✅ **Development mode**: NODE_ENV=development
- ✅ **Direct access**: Can test APIs individually
- ✅ **Database tools**: Direct database connections

**Exposed Ports:**
- `80, 443` - nginx_reverse_proxy (web entry)
- `3000` - api_gateway (REST API)
- `3001` - product_service (Catalog API)
- `3002` - auth_service (Authentication API)
- `5432` - database (PostgreSQL)
- `6379` - cache (Redis)
- `9090` - monitoring (Prometheus)

## Usage Examples

### Quick Demo
```bash
# Start demo environment
athena build light_presentation.ath
docker-compose up -d

# Test APIs directly
curl http://localhost:3000/health # API Gateway
curl http://localhost:3001/health # Product Service
curl http://localhost:3002/health # Auth Service

# Access monitoring
open http://localhost:9090 # Prometheus

# Database access
psql -h localhost -p 5432 -U postgres
redis-cli -h localhost -p 6379
```

### Production Demo
```bash
# Show production security
athena build presentation.ath
docker-compose up -d

# Only nginx accessible externally
curl http://localhost # ✅ Works
curl http://localhost:3000 # ❌ Blocked (secure)
```

## Presentation Tips

1. **Start with `light_presentation.ath`** to show functionality
2. **Switch to `presentation.ath`** to demonstrate security
3. **Compare generated YAML** to highlight Athena's intelligence
4. **Show comment features** and intelligent defaults

## Key Differences

| Aspect | light_presentation.ath | presentation.ath |
|--------|----------------------|------------------|
| **Security** | Demo-friendly | Production-ready |
| **Port Exposure** | All services | Nginx only |
| **Testing** | Direct API access | Proxy-only access |
| **Environment** | Development | Production |
| **Use Case** | Demos, Testing | Production deployment |

## Generated Files

- `light_presentation.ath` → `docker-compose.yml` (with all ports)
- `presentation.ath` → `docker-compose.yml` (secure, minimal ports)

The presentation files will evolve as the project progresses (We will soon be working on more advanced support for swarm).
Both demonstrate Athena's intelligent defaults, healthchecks, and Docker Swarm readiness!
94 changes: 94 additions & 0 deletions examples/light_presentation.ath
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Modern E-commerce Platform - Demo/Testing Version with Exposed Ports
DEPLOYMENT-ID MODERN_ECOMMERCE_DEMO
VERSION-ID 2.0.0

ENVIRONMENT SECTION
NETWORK-NAME ecommerce_network
// Define persistent volumes for testing
VOLUME postgres_data
VOLUME redis_data

SERVICES SECTION

// Reverse proxy with SSL termination - Main entry point
SERVICE nginx_reverse_proxy
IMAGE-ID "nginx:alpine"
PORT-MAPPING 80 TO 80
PORT-MAPPING 443 TO 443
VOLUME-MAPPING "./nginx/conf.d" TO "/etc/nginx/conf.d" (ro)
RESOURCE-LIMITS CPU "0.2" MEMORY "256M"
DEPENDS-ON api_gateway
HEALTH-CHECK "curl -f http://localhost:80/health || exit 1"
// Athena auto-applies: restart=always for proxy type
END SERVICE

// API Gateway - Accessible for testing
SERVICE api_gateway
BUILD-ARGS NODE_ENV="development" API_VERSION="v2.1" JWT_EXPIRY="24h"
PORT-MAPPING 3000 TO 3000
ENV-VARIABLE {{JWT_SECRET}}
ENV-VARIABLE {{DATABASE_URL}}
ENV-VARIABLE {{REDIS_URL}}
RESOURCE-LIMITS CPU "0.5" MEMORY "512M"
DEPENDS-ON database
DEPENDS-ON cache
HEALTH-CHECK "curl -f http://localhost:3000/health || exit 1"
// Athena auto-applies: restart=unless-stopped for webapp type
END SERVICE

// Product catalog service - Exposed for direct testing
SERVICE product_service
BUILD-ARGS CATALOG_VERSION="v1.5" SEARCH_ENGINE="elasticsearch"
PORT-MAPPING 3001 TO 3000
ENV-VARIABLE {{DATABASE_URL}}
RESOURCE-LIMITS CPU "0.3" MEMORY "256M"
DEPENDS-ON database
HEALTH-CHECK "curl -f http://localhost:3000/health || exit 1"
END SERVICE

// User authentication service - Exposed for API testing
SERVICE auth_service
BUILD-ARGS AUTH_PROVIDER="oauth2" SESSION_TIMEOUT="1h"
PORT-MAPPING 3002 TO 3000
ENV-VARIABLE {{JWT_SECRET}}
ENV-VARIABLE {{DATABASE_URL}}
RESOURCE-LIMITS CPU "0.2" MEMORY "256M"
DEPENDS-ON database
HEALTH-CHECK "curl -f http://localhost:3000/health || exit 1"
END SERVICE

// Main database - Exposed for database tools/debugging
SERVICE database
IMAGE-ID "postgres:15"
PORT-MAPPING 5432 TO 5432
ENV-VARIABLE {{POSTGRES_USER}}
ENV-VARIABLE {{POSTGRES_PASSWORD}}
ENV-VARIABLE {{POSTGRES_DB}}
// Using named volume for persistence
VOLUME-MAPPING "postgres_data" TO "/var/lib/postgresql/data"
RESOURCE-LIMITS CPU "1.0" MEMORY "1024M"
HEALTH-CHECK "pg_isready -U ${POSTGRES_USER} || exit 1"
// Athena auto-applies: restart=always for database type
END SERVICE

// Redis cache - Exposed for Redis tools/monitoring
SERVICE cache
IMAGE-ID "redis:7-alpine"
PORT-MAPPING 6379 TO 6379
// Using named volume for persistence
VOLUME-MAPPING "redis_data" TO "/data"
RESOURCE-LIMITS CPU "0.3" MEMORY "512M"
HEALTH-CHECK "redis-cli ping || exit 1"
// Athena auto-applies: restart=always for cache type
END SERVICE

// Monitoring service - Prometheus for observability
SERVICE monitoring
IMAGE-ID "prom/prometheus:latest"
PORT-MAPPING 9090 TO 9090
VOLUME-MAPPING "./prometheus/prometheus.yml" TO "/etc/prometheus/prometheus.yml" (ro)
DEPENDS-ON api_gateway
DEPENDS-ON product_service
DEPENDS-ON auth_service
RESOURCE-LIMITS CPU "0.3" MEMORY "512M"
END SERVICE
Loading