From a4c35329e9f0c1b2291caecd71d9decd3ec0917f Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 26 Nov 2025 16:16:12 +0100 Subject: [PATCH 1/3] Expose profile setting to configure EPR_PROXY_TO --- README.md | 2 ++ internal/profile/_static/config.yml.example | 13 +++++++++---- internal/registry/client.go | 4 ++-- .../stack/_static/Dockerfile.package-registry.tmpl | 2 +- internal/stack/boot.go | 3 ++- internal/stack/resources.go | 3 +++ 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5129f14b31..13c6dab1f0 100644 --- a/README.md +++ b/README.md @@ -686,6 +686,8 @@ The following settings are available per profile: Defaults to false. * `stack.elastic_cloud.host` can be used to override the address when connecting with the Elastic Cloud APIs. It defaults to `https://cloud.elastic.co`. +* `stack.epr_proxy_to` indicates the local Package Registry to proxy requests to the configured + endpoint. When not set, it uses `https://epr.elastic.co`. * `stack.geoip_dir` defines a directory with GeoIP databases that can be used by Elasticsearch in stacks managed by elastic-package. It is recommended to use an absolute path, out of the `.elastic-package` directory. diff --git a/internal/profile/_static/config.yml.example b/internal/profile/_static/config.yml.example index d9f00f00a8..4f73273f90 100644 --- a/internal/profile/_static/config.yml.example +++ b/internal/profile/_static/config.yml.example @@ -1,9 +1,18 @@ +## Elasticssearch settings # Directory containing GeoIP databases for stacks managed by elastic-agent. # stack.geoip_dir: "/path/to/geoip_dir/" +# +# Flag to enable the logs index mode in logs data stream. +# stack.logsdb_enabled: true + ## Elastic Cloud # Host URL # stack.elastic_cloud.host: https://cloud.elastic.co +## Package Registry settings +# Package Registry used to proxy requests to (EPR_PROXY_TO environment variable). +# stack.epr_proxy_to: https://epr.elastic.co + ## Serverless stack provider # Project type # stack.serverless.type: observability @@ -14,10 +23,6 @@ # Flag to enable apm-server in elastic-package stack profile config # stack.apm_enabled: true -## Logs DB -# Flag to enable the logs index mode in logs data stream. -# stack.logsdb_enabled: true - ## Enable logstash for testing # Flag to enable logstash in elastic-package stack profile config # stack.logstash_enabled: true diff --git a/internal/registry/client.go b/internal/registry/client.go index f9a9caa76d..f148a9f9ce 100644 --- a/internal/registry/client.go +++ b/internal/registry/client.go @@ -12,12 +12,12 @@ import ( ) const ( - productionURL = "https://epr.elastic.co" + ProductionURL = "https://epr.elastic.co" ) var ( // Production is a pre-configured production client - Production = NewClient(productionURL) + Production = NewClient(ProductionURL) ) // Client is responsible for exporting dashboards from Kibana. diff --git a/internal/stack/_static/Dockerfile.package-registry.tmpl b/internal/stack/_static/Dockerfile.package-registry.tmpl index 848cd1aa31..3551f31e9b 100644 --- a/internal/stack/_static/Dockerfile.package-registry.tmpl +++ b/internal/stack/_static/Dockerfile.package-registry.tmpl @@ -6,7 +6,7 @@ ARG PROFILE ENV EPR_DISABLE_PACKAGE_VALIDATION=true ENV EPR_FEATURE_PROXY_MODE=true -ENV EPR_PROXY_TO=https://epr.elastic.co +ENV EPR_PROXY_TO={{ fact "epr_proxy_to" }} COPY profiles/${PROFILE}/stack/package-registry.yml /package-registry/config.yml COPY stack/development/ /packages/development diff --git a/internal/stack/boot.go b/internal/stack/boot.go index 9f8e501c0e..da94a2e345 100644 --- a/internal/stack/boot.go +++ b/internal/stack/boot.go @@ -17,6 +17,7 @@ import ( "github.com/elastic/elastic-package/internal/configuration/locations" "github.com/elastic/elastic-package/internal/files" "github.com/elastic/elastic-package/internal/profile" + "github.com/elastic/elastic-package/internal/registry" ) // baseComposeProjectName is the base name of the Docker Compose project used to boot up @@ -69,7 +70,7 @@ func BootUp(ctx context.Context, options Options) error { } options.Printer.Println("Local package-registry will serve packages from these sources:") - options.Printer.Println("- Proxy to https://epr.elastic.co") + options.Printer.Printf("- Proxy to %s\n", options.Profile.Config(configElasticEPRProxyTo, registry.ProductionURL)) if found { options.Printer.Printf("- Local directory %s\n", buildPackagesPath) diff --git a/internal/stack/resources.go b/internal/stack/resources.go index 802119a656..44db573988 100644 --- a/internal/stack/resources.go +++ b/internal/stack/resources.go @@ -19,6 +19,7 @@ import ( "github.com/elastic/go-resource" "github.com/elastic/elastic-package/internal/profile" + "github.com/elastic/elastic-package/internal/registry" ) //go:embed _static @@ -64,6 +65,7 @@ const ( configLogsDBEnabled = "stack.logsdb_enabled" configLogstashEnabled = "stack.logstash_enabled" configSelfMonitorEnabled = "stack.self_monitor_enabled" + configElasticEPRProxyTo = "stack.epr_proxy_to" configElasticSubscription = "stack.elastic_subscription" ) @@ -180,6 +182,7 @@ func applyResources(profile *profile.Profile, stackVersion string, agentVersion "logsdb_enabled": profile.Config(configLogsDBEnabled, "false"), "logstash_enabled": profile.Config(configLogstashEnabled, "false"), "self_monitor_enabled": profile.Config(configSelfMonitorEnabled, "false"), + "epr_proxy_to": profile.Config(configElasticEPRProxyTo, registry.ProductionURL), "elastic_subscription": elasticSubscriptionProfile, }) From 52001a2e6e15b214eb0448fe40cc659920a3e54a Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 26 Nov 2025 18:30:10 +0100 Subject: [PATCH 2/3] Update also the README template --- tools/readme/readme.md.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/readme/readme.md.tmpl b/tools/readme/readme.md.tmpl index 70bef635e6..ab1c8f4250 100644 --- a/tools/readme/readme.md.tmpl +++ b/tools/readme/readme.md.tmpl @@ -192,6 +192,8 @@ The following settings are available per profile: Defaults to false. * `stack.elastic_cloud.host` can be used to override the address when connecting with the Elastic Cloud APIs. It defaults to `https://cloud.elastic.co`. +* `stack.epr_proxy_to` indicates the local Package Registry to proxy requests to the configured + endpoint. When not set, it uses `https://epr.elastic.co`. * `stack.geoip_dir` defines a directory with GeoIP databases that can be used by Elasticsearch in stacks managed by elastic-package. It is recommended to use an absolute path, out of the `.elastic-package` directory. From 9c65eb7636a84f6bc8fd8500454a95d6788c9602 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 26 Nov 2025 18:37:48 +0100 Subject: [PATCH 3/3] Namespace setting --- README.md | 2 +- internal/profile/_static/config.yml.example | 2 +- internal/stack/resources.go | 2 +- tools/readme/readme.md.tmpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 13c6dab1f0..9bcedc007a 100644 --- a/README.md +++ b/README.md @@ -686,7 +686,7 @@ The following settings are available per profile: Defaults to false. * `stack.elastic_cloud.host` can be used to override the address when connecting with the Elastic Cloud APIs. It defaults to `https://cloud.elastic.co`. -* `stack.epr_proxy_to` indicates the local Package Registry to proxy requests to the configured +* `stack.epr.proxy_to` indicates the local Package Registry to proxy requests to the configured endpoint. When not set, it uses `https://epr.elastic.co`. * `stack.geoip_dir` defines a directory with GeoIP databases that can be used by Elasticsearch in stacks managed by elastic-package. It is recommended to use diff --git a/internal/profile/_static/config.yml.example b/internal/profile/_static/config.yml.example index 4f73273f90..d481529821 100644 --- a/internal/profile/_static/config.yml.example +++ b/internal/profile/_static/config.yml.example @@ -11,7 +11,7 @@ ## Package Registry settings # Package Registry used to proxy requests to (EPR_PROXY_TO environment variable). -# stack.epr_proxy_to: https://epr.elastic.co +# stack.epr.proxy_to: https://epr.elastic.co ## Serverless stack provider # Project type diff --git a/internal/stack/resources.go b/internal/stack/resources.go index 44db573988..09039ea965 100644 --- a/internal/stack/resources.go +++ b/internal/stack/resources.go @@ -65,7 +65,7 @@ const ( configLogsDBEnabled = "stack.logsdb_enabled" configLogstashEnabled = "stack.logstash_enabled" configSelfMonitorEnabled = "stack.self_monitor_enabled" - configElasticEPRProxyTo = "stack.epr_proxy_to" + configElasticEPRProxyTo = "stack.epr.proxy_to" configElasticSubscription = "stack.elastic_subscription" ) diff --git a/tools/readme/readme.md.tmpl b/tools/readme/readme.md.tmpl index ab1c8f4250..679ee8f8a9 100644 --- a/tools/readme/readme.md.tmpl +++ b/tools/readme/readme.md.tmpl @@ -192,7 +192,7 @@ The following settings are available per profile: Defaults to false. * `stack.elastic_cloud.host` can be used to override the address when connecting with the Elastic Cloud APIs. It defaults to `https://cloud.elastic.co`. -* `stack.epr_proxy_to` indicates the local Package Registry to proxy requests to the configured +* `stack.epr.proxy_to` indicates the local Package Registry to proxy requests to the configured endpoint. When not set, it uses `https://epr.elastic.co`. * `stack.geoip_dir` defines a directory with GeoIP databases that can be used by Elasticsearch in stacks managed by elastic-package. It is recommended to use