Skip to content
Merged

Dev #75

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
59 changes: 59 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Production Dockerfile for Abada Engine
# This uses a multi-stage build for optimized production images

# Stage 1: Build with Maven
FROM maven:3.9.6-eclipse-temurin-21 AS builder

WORKDIR /app

# Copy only pom.xml first to leverage Docker layer caching for dependencies
COPY pom.xml .
COPY .mvn .mvn
COPY mvnw .

# Download dependencies (this layer will be cached unless pom.xml changes)
RUN ./mvnw dependency:go-offline -B

# Copy source code
COPY src ./src

# Build the application
RUN ./mvnw clean package spring-boot:repackage -DskipTests

# Stage 2: Runtime
FROM eclipse-temurin:21-jre-alpine

WORKDIR /app

# Install su-exec for user switching
RUN apk add --no-cache su-exec

# Create a non-root user and group for security
RUN addgroup -S appgroup && adduser -S appuser -G appgroup

# Copy the fat JAR from the builder stage
COPY --from=builder /app/target/abada-engine-*.jar app.jar

# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

# Create logs directory and log file
RUN mkdir -p /app/logs && \
touch /app/logs/abada-engine.logs && \
chown -R appuser:appgroup /app/logs

# Create data directory for dev profile
RUN mkdir -p /app/data && \
chown -R appuser:appgroup /app/data

# Change ownership to the new user
RUN chown appuser:appgroup app.jar

# Note: We stay as root so entrypoint can fix volume permissions
# The entrypoint script will switch to appuser before running the app

EXPOSE 5601

# Run the application via entrypoint script
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh", "java", "-jar", "app.jar"]
47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,51 @@ All components are containerized and deploy independently. For design, boundarie

---

## Quick Start (Docker)
## Quick Start

Get up and running in minutes with our curated Compose stacks:
## Quick Start

- **Development**: Hot-reloading and debug ports exposed.
- **Production**: Optimized, secure, and scalable.
### 🚀 Launch Platform (Production/Demo)

See [`docs/docker-deployment.md`](docs/docker-deployment.md) for commands and [`docs/docker-deployment-plan.md`](docs/docker-deployment-plan.md) for the environment strategy.
The easiest way to run the full Abada Platform (Engine, Tenda, Orun, Observability) is using our automated quickstart script. You only need Docker installed.

```bash
curl -sSL https://raw.githubusercontent.com/bashizip/abada-engine/main/release/quickstart.sh | bash
```

### 💻 Development Environment

For developers contributing to the project:

Hosted with in-memory H2 database, pre-configured users, and full observability tools.

**Option 1: Build & Run (Recommended)**
Builds the engine locally (fast) and launches the **complete** stack.
```bash
./scripts/build-and-run-dev.sh
```

**Option 2: Start Only**
Starts the containers if the image is already built.
```bash
./scripts/start-dev.sh
```

**Option 3: Rebuild Engine Only (Fast Iteration)**
Rebuilds and restarts only the engine service to apply code changes.
```bash
./scripts/build-dev.sh
```

**Services:**
- **Abada Engine**: [http://localhost:5601/abada/api](http://localhost:5601/abada/api)
- **Abada Tenda** (Task UI): [http://localhost:5602](http://localhost:5602)
- **Abada Orun** (Monitoring UI): [http://localhost:5603](http://localhost:5603)
- **Grafana**: [http://localhost:3000](http://localhost:3000) (admin/admin123)
- **Jaeger**: [http://localhost:16686](http://localhost:16686)
- **Traefik Dashboard**: [http://localhost:8080](http://localhost:8080)

For production deployment and manual Docker Compose commands, see the detailed [Docker Deployment Guide](docs/operations/docker-deployment.md).

---

Expand Down
48 changes: 48 additions & 0 deletions docker-compose.hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3.8'

services:
# Abada Engine - Usage from Docker Hub
abada-engine:
# Use image from Docker Hub instead of local build
image: ${DOCKER_USERNAME:-bashizip}/abada-engine:${VERSION:-latest}
build:
context: .
dockerfile: Dockerfile.prod # Point to prod dockerfile just in case build is forced, but image takes precedence
pull_policy: always
restart: always

# Abada Tenda - Frontend
abada-tenda:
image: ${DOCKER_USERNAME:-bashizip}/abada-tenda:${VERSION:-latest}
container_name: abada-tenda-prod
ports:
- "5602:5602"
environment:
- NODE_ENV=production
networks:
- abada-network
restart: always
pull_policy: always
healthcheck:
test: [ "CMD", "wget", "--spider", "-q", "http://localhost:5602/health" ]
interval: 30s
timeout: 10s
retries: 3

# Abada Orun - Frontend
abada-orun:
image: ${DOCKER_USERNAME:-bashizip}/abada-orun:${VERSION:-latest}
container_name: abada-orun-prod
ports:
- "5603:5603"
environment:
- NODE_ENV=production
networks:
- abada-network
restart: always
pull_policy: always
healthcheck:
test: [ "CMD", "wget", "--spider", "-q", "http://localhost:5603/health" ]
interval: 30s
timeout: 10s
retries: 3
72 changes: 71 additions & 1 deletion docs/operations/docker-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,49 @@ GRAFANA_ADMIN_PASSWORD=admin123
POSTGRES_PASSWORD=secure_password
```

## Building Local Images

You can build the Docker image locally for either production or development.

### Production Build

The standard build is a multi-stage process that compiles the code inside the container. This ensures a consistent build environment but takes longer.

```bash
docker build -t abada-engine:latest .
```

### Development Build (Fast)

For faster iteration, you can build the JAR locally and inject it into the image. This skips the dependency download and build steps inside Docker.

1. Build the JAR file locally:

```bash
./mvnw clean package -DskipTests
```

2. Build the Docker image using the local JAR:

```bash
docker build --build-arg USE_LOCAL_JAR=true -t abada-engine:dev .
```

> [!TIP]
> **Helper Scripts available!**
> You can automate this process using the scripts in the `scripts/` directory:
> - `scripts/build-and-run-dev.sh`: Builds JAR, builds image, and starts full stack.
> - `scripts/build-dev.sh`: Rebuilds engine only (useful for iteration).


## Deployment Commands

### Development Environment

Single instance with H2 database, full observability, debug logging:

```bash
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
docker compose -f docker-compose.yml -f docker-compose.dev.yml up
```

**Access URLs:**
Expand Down Expand Up @@ -101,6 +136,41 @@ docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --scale ab
docker-compose -f docker-compose.yml -f docker-compose.prod.yml ps
```

## Quick Start (Recommended)

The easiest way to run the platform is using the automated quickstart script.

### 1. Download and Run
You only need `docker` and `docker compose` installed.

```bash
# Download and run the quickstart script
curl -sSL https://raw.githubusercontent.com/bashizip/abada-engine/main/release/quickstart.sh | bash
```

This script will:
1. Download the production configuration.
2. Start all services using `docker compose`.
3. Show you the access URLs.

### 2. Manual Setup (Alternative)

If you prefer to start it manually:

1. Download the [release configuration](https://raw.githubusercontent.com/bashizip/abada-engine/main/release/docker-compose.release.yml) to a file named `docker-compose.yml`.
2. Run:
```bash
docker compose up -d
```

### Access URLs

- **Abada Engine**: <http://localhost/abada/api> (via Traefik)
- **Abada Tenda**: <http://localhost:5602>
- **Abada Orun**: <http://localhost:5603>
- **Grafana**: <http://localhost:3000>
- **Traefik Dashboard**: <http://localhost:8080>

## Monitoring and Observability

### Metrics Flow
Expand Down
Loading
Loading