Skip to content
Open
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
76 changes: 23 additions & 53 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,24 @@ java-buildpack/
├── bin/
│ ├── compile # Legacy V2 API entrypoint
│ ├── detect # Detection phase entrypoint
│ ├── release # Release phase entrypoint
│ ├── finalize # Finalize phase entrypoint (V3)
│ └── supply # Supply phase entrypoint (V3)
├── config/ # Component configurations
│ ├── components.yml # Component registry
│ ├── cache.yml # Caching configuration
│ ├── repository.yml # Dependency repository config
│ └── *.yml # Individual component configs
├── resources/ # Static resources for components
│ ├── tomcat/ # Tomcat configuration templates
│ ├── protect_app_security_provider/
│ └── ...
├── src/integration/ # Integraion tests
├── src/java/ # Go source code
| ├── common/ # Common libbuildpack integrations
│ ├── containers/ # Container implementations
│ ├── frameworks/ # Framework implementations
│ ├── jres/ # JRE implementations
| ├── resources/ # Resource configuration files
│ ├── supply/ # Supply phase orchestration
│ │ └── cli/ # Supply CLI entrypoint
│ └── finalize/ # Finalize phase orchestration
│ └── cli/ # Finalize CLI entrypoint
├── docs/ # Documentation
├── ci/ # CI scripts
└── scripts/ # Build and test scripts
```

Expand Down Expand Up @@ -139,7 +133,7 @@ The buildpack uses three main component types:

## Buildpack Lifecycle

The buildpack follows Cloud Foundry's V3 lifecycle with three phases:
The buildpack follows Cloud Foundry's V3 lifecycle with four phases:

### 1. Detect Phase

Expand Down Expand Up @@ -171,7 +165,7 @@ The buildpack follows Cloud Foundry's V3 lifecycle with three phases:

**Flow**:
```
1. Load component registry (config/components.yml)
1. Load component registries for containers, jres and frameworks
2. For each component type (JRE, Frameworks):
a. Run Detect() method
b. If detected, run Supply() method
Expand Down Expand Up @@ -222,6 +216,20 @@ The buildpack follows Cloud Foundry's V3 lifecycle with three phases:
- Generates runtime configuration
- Profile.d scripts run before app launch

### 4. Release Phase

**Purpose**: Assemble the start command that the Cloud Controller wil use to start
the running java process of the application.

**Entry Point**: `bin/release`

**Flow**:
```
Output the launch command written previouly in the finalize phase to $BUILD_DIR/tmp/java-buildpack-release-step.yml

Note that the java-buildpack-release-step.yml follows strict predefined structure which is expected from CC.
If anything except this yaml appears in release output, the staged application will fail to start.
```
---

## Key Architectural Patterns
Expand Down Expand Up @@ -436,44 +444,6 @@ export JAVA_OPTS="${JAVA_OPTS} -Dnewrelic.config.license_key=%s"

---

## Configuration System

### Component Registry

**File**: `config/components.yml`

**Purpose**: Declare available components

**Structure**:
```yaml
containers:
- "JavaBuildpack::Container::SpringBoot"
- "JavaBuildpack::Container::Tomcat"
# ...

jres:
- "JavaBuildpack::Jre::OpenJdkJRE"
# ...

frameworks:
- "JavaBuildpack::Framework::NewRelicAgent"
- "JavaBuildpack::Framework::JavaOpts"
# ...
```

### Component Configuration

**Pattern**: `config/<component_name>.yml`

**Purpose**: Configure individual components

**Example** (`config/new_relic_agent.yml`):
```yaml
version: 8.7.+
repository_root: https://download.run.pivotal.io/new-relic
enabled: true
```

### Environment Variable Overrides

Users can override configuration via environment variables:
Expand Down Expand Up @@ -573,12 +543,12 @@ Scripts in `<app>/.profile.d/` run before app launch:
### Supply Phase Order

1. **JREs** - Install Java runtime first
2. **Frameworks** - Process in `components.yml` order
2. **Frameworks** - Process in `registry.RegisterStandardFrameworks()` order

### Finalize Phase Order

1. **JRE** - Configure Java runtime
2. **Frameworks** - Process in `components.yml` order
2. **Frameworks** - Process in `registry.RegisterStandardFrameworks()` order
3. **Container** - Generate launch command (last)

**Important**: `JavaOpts` framework must be last to allow user overrides
Expand Down
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ The buildpack supports extension through the use of Git repository forking. The

This Go-based buildpack is a migration from the original Ruby-based Cloud Foundry Java Buildpack. For comprehensive information about the migration status, component parity, and architectural differences:

* **[Ruby vs Go Buildpack Comparison](comparison.md)** - Comprehensive comparison of components, features, and production readiness assessment (92.9% component parity, production-ready for 98%+ of Java applications)
* **[Dependency Installation Comparison](ruby_vs_go_buildpack_comparison.md)** - Technical deep-dive into how dependency extraction differs between Ruby and Go implementations
* **[Ruby vs Go Buildpack Comparison](ruby_vs_go_buildpack_comparison.md)** - Technical deep-dive into how dependency extraction differs between Ruby and Go implementations

**⚠️ Important Migration Note:** The Go buildpack does **NOT** support the Ruby buildpack's `repository_root` configuration approach for custom JREs (via `JBP_CONFIG_*` environment variables). Custom JREs now require forking the buildpack and modifying `manifest.yml`. See [Custom JRE Usage](docs/custom-jre-usage.md) for details.

Expand Down Expand Up @@ -197,16 +196,6 @@ For historical analysis documents from development sessions, see [`docs/archive/
* [GraalVM](docs/jre-graal_vm_jre.md) ([Configuration](docs/jre-graal_vm_jre.md#configuration))
* [IBM Semeru](docs/jre-ibm_jre.md) ([Configuration](docs/jre-ibm_jre.md#configuration))
* [Oracle](docs/jre-oracle_jre.md) ([Configuration](docs/jre-oracle_jre.md#configuration))
* [Extending](docs/extending.md)
* [Application](docs/extending-application.md)
* [Droplet](docs/extending-droplet.md)
* [BaseComponent](docs/extending-base_component.md)
* [VersionedDependencyComponent](docs/extending-versioned_dependency_component.md)
* [ModularComponent](docs/extending-modular_component.md)
* [Caches](docs/extending-caches.md) ([Configuration](docs/extending-caches.md#configuration))
* [Logging](docs/extending-logging.md) ([Configuration](docs/extending-logging.md#configuration))
* [Repositories](docs/extending-repositories.md) ([Configuration](docs/extending-repositories.md#configuration))
* [Utilities](docs/extending-utilities.md)
* [Debugging the Buildpack](docs/debugging-the-buildpack.md)
* [Buildpack Modes](docs/buildpack-modes.md)
* Related Projects
Expand Down Expand Up @@ -320,6 +309,7 @@ $ ./scripts/unit.sh
$ BUILDPACK_FILE="$(pwd)/build/buildpack.zip" \
./scripts/integration.sh --platform docker --parallel true --github-token MYTOKEN
```
For detailed guidelines about setting up and running tests please check this [Testing Guide](docs/TESTING.md)

[Running Cloud Foundry locally][] is useful for privately testing new features.

Expand Down
Loading