httpd

package module
v0.7.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

Apache HTTP Server Cloud Native Buildpack

The HTTPD CNB provides the Apache HTTP Server binary distribution. The buildpack installs the HTTPD binary distribution onto the $PATH which makes it available for subsequent buildpacks, and sets up the start command which signals httpd to start.

A usage example can be found in the samples repository under the httpd directory.

The HTTPD buildpack is compatible with the following builder(s):

Integration

The Apache HTTPD CNB provides httpd as a dependency. Downstream buildpacks, like php-web can require the httpd dependency by generating a Build Plan TOML file that looks like the following:

[[requires]]

  # The name of the Apache HTTPD dependency is "httpd". This value is considered
  # part of the public API for the buildpack and will not change without a plan
  # for deprecation.
  name = "httpd"

  # The version of the Apache HTTPD dependency is not required. In the case it
  # is not specified, the buildpack will provide the newest version, which can
  # be seen in the buildpack.toml file.
  # If you wish to request a specific version, the buildpack supports
  # specifying a semver constraint in the form of "2.*", "2.4.*", or even
  # "2.4.43".
  version = "2.4.43"

  # The Apache HTTPD buildpack supports some non-required metadata options.
  [requires.metadata]

    # Setting the launch flag to true will ensure that the Apache HTTPD
    # dependency is available on the $PATH for the running application. If you
    # are writing an application that needs to run Apache HTTPD at runtime, this
    # flag should be set to true.
    launch = true

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh -v <version>

Configurations

Specifying the HTTP Server version through buildpack.yml configuration will be deprecated in Apache HTTP Server Buildpack v1.0.0.

To migrate from using buildpack.yml please set the following environment variables at build time either directly (ex. pack build my-app --env BP_ENVIRONMENT_VARIABLE=some-value) or through a project.toml file

BP_HTTPD_VERSION

The BP_HTTPD_VERSION variable allows you to specify the version of Apache HTTP Server that is installed.

BP_HTTPD_VERSION=2.4.43

This will replace the following structure in buildpack.yml:

httpd:
  # this allows you to specify a version constraint for the httpd dependency
  # any valid semver constraints (e.g. 2.* and 2.4.*) are also acceptable
  version: "2.4.43"

Zero Configuration Variables

The Apache HTTPD Server Buildpack now supports the ability for a user to just provide a static application without having a httpd.conf and the buildpack will now generate a default httpd.conf. In order to activate this workflow the BP_WEB_SERVER environment variable must be set to httpd.

BP_WEB_SERVER=httpd

While this will provide a default configuration there are a few modifications that can be made to this httpd.conf by setting the following environment variables and service bindings.

BP_WEB_SERVER_ROOT

The BP_WEB_SERVER_ROOT variable allows you to modify the location of the static files served by the web server by assigning the BP_WEB_SERVER_ROOT variable with an absolute file path or a file path relative to /workspace. For example, setting BP_WEB_SERVER_ROOT=my-build-directory would change the file path of served files to /workspace/my-build-directory.

BP_WEB_SERVER_ROOT=htdocs
BP_WEB_SERVER_ENABLE_PUSH_STATE

The BP_WEB_SERVER_ENABLE_PUSH_STATE variable to enable push state routing functionality.

BP_WEB_SERVER_ENABLE_PUSH_STATE=true
BP_WEB_SERVER_FORCE_HTTPS

The BP_WEB_SERVE_FORCE_HTTPS variable allows to enforce HTTPS for server connnections.

BP_WEB_SERVER_FORCE_HTTPS=true
Basic Authentication

You are able to provide basic authentication credentials via an htpasswd type service binding specifying the contents of a .htpasswd file. The service binding will have the following directory structure.

binding
├── type
└── .htpasswd

Stack support

The HTTPD buildpack requires that you use the Paketo Full builder to build applications. The buildpack does not run on the Base builder because it requires libexpat1 that's not present on the Base stack.

Documentation

Index

Constants

View Source
const PlanDependencyHTTPD = "httpd"

Variables

This section is empty.

Functions

func Build

func Build(
	buildEnvironment BuildEnvironment,
	entries EntryResolver,
	dependencies DependencyService,
	generateConfig GenerateConfig,
	sbomGenerator SBOMGenerator,
	clock chronos.Clock,
	logger scribe.Emitter,
) packit.BuildFunc

func Detect

func Detect(buildEnvironment BuildEnvironment, parser Parser) packit.DetectFunc

Types

type BindingResolver added in v0.4.0

type BindingResolver interface {
	Resolve(typ, provider, platformDir string) ([]servicebindings.Binding, error)
}

type BuildEnvironment added in v0.4.1

type BuildEnvironment struct {
	BasicAuthFile             string
	HTTPDVersion              string `env:"BP_HTTPD_VERSION"`
	Reload                    bool   `env:"BP_LIVE_RELOAD_ENABLED"`
	WebServer                 string `env:"BP_WEB_SERVER"`
	WebServerForceHTTPS       bool   `env:"BP_WEB_SERVER_FORCE_HTTPS"`
	WebServerPushStateEnabled bool   `env:"BP_WEB_SERVER_ENABLE_PUSH_STATE"`
	WebServerRoot             string `env:"BP_WEB_SERVER_ROOT"`
}

type BuildPlanMetadata

type BuildPlanMetadata struct {
	Version       string `toml:"version,omitempty"`
	VersionSource string `toml:"version-source,omitempty"`
	Launch        bool   `toml:"launch"`
}

type DependencyService

type DependencyService interface {
	Resolve(path, name, version, stack string) (postal.Dependency, error)
	Deliver(dependency postal.Dependency, cnbPath, layerPath, platformPath string) error
	GenerateBillOfMaterials(dependencies ...postal.Dependency) []packit.BOMEntry
}

type EntryResolver added in v0.0.169

type EntryResolver interface {
	Resolve(name string, entries []packit.BuildpackPlanEntry, priorites []interface{}) (packit.BuildpackPlanEntry, []packit.BuildpackPlanEntry)
	MergeLayerTypes(name string, entries []packit.BuildpackPlanEntry) (launch, build bool)
}

type GenerateConfig added in v0.4.0

type GenerateConfig interface {
	Generate(workingDir, platformPath string, buildEnvironment BuildEnvironment) error
}

type GenerateHTTPDConfig added in v0.4.0

type GenerateHTTPDConfig struct {
	// contains filtered or unexported fields
}

func NewGenerateHTTPDConfig added in v0.4.0

func NewGenerateHTTPDConfig(bindingResolver BindingResolver, logger scribe.Emitter) GenerateHTTPDConfig

func (GenerateHTTPDConfig) Generate added in v0.4.0

func (g GenerateHTTPDConfig) Generate(workingDir, platformPath string, buildEnvironment BuildEnvironment) error

type Parser added in v0.0.167

type Parser interface {
	ParseVersion(path string) (version, versionSource string, err error)
}

type SBOMGenerator added in v0.5.0

type SBOMGenerator interface {
	GenerateFromDependency(dependency postal.Dependency, dir string) (sbom.SBOM, error)
}

type VersionParser added in v0.0.167

type VersionParser struct{}

func NewVersionParser added in v0.0.167

func NewVersionParser() VersionParser

func (VersionParser) ParseVersion added in v0.0.167

func (v VersionParser) ParseVersion(path string) (string, string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL