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
6 changes: 5 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ TRACETEST_IMAGE=kubeshop/tracetest:${TRACETEST_IMAGE_VERSION}
# Demo Platform
ENV_PLATFORM=local

# IPv6 Flag control
IPV6_ENABLED=false

# OpenTelemetry Collector
HOST_FILESYSTEM=/
DOCKER_SOCK=/var/run/docker.sock
Expand Down Expand Up @@ -81,9 +84,10 @@ FRONTEND_ADDR=frontend:${FRONTEND_PORT}
FRONTEND_DOCKERFILE=./src/frontend/Dockerfile

# Frontend Proxy (Envoy)
FRONTEND_HOST=frontend
ENVOY_ADDR=0.0.0.0
ENVOY_PORT=8080
ENVOY_ADMIN_PORT=10000
FRONTEND_HOST=frontend
FRONTEND_PROXY_ADDR=frontend-proxy:${ENVOY_PORT}
FRONTEND_PROXY_DOCKERFILE=./src/frontend-proxy/Dockerfile

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ the release.

## Unreleased

* [feat] add ipv6 support
([#2594](https://github.com/open-telemetry/opentelemetry-demo/pull/2594))
* [chore] Use pre-built nginx otel image
([#2614](https://github.com/open-telemetry/opentelemetry-demo/pull/2614))
* [grafana] Update grafana version to 12.2.0
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ services:
ports:
- "${CURRENCY_PORT}"
environment:
- IPV6_ENABLED
- CURRENCY_PORT
- VERSION=${IMAGE_VERSION}
- OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down Expand Up @@ -284,6 +285,7 @@ services:
- OTEL_SERVICE_NAME=frontend-proxy
- ENVOY_PORT
- ENVOY_ADMIN_PORT
- ENVOY_ADDR
- FLAGD_HOST
- FLAGD_PORT
- FLAGD_UI_HOST
Expand Down Expand Up @@ -382,6 +384,7 @@ services:
ports:
- "${PAYMENT_PORT}"
environment:
- IPV6_ENABLED
- FLAGD_HOST
- FLAGD_PORT
- PAYMENT_PORT
Expand Down Expand Up @@ -444,6 +447,7 @@ services:
ports:
- "${QUOTE_PORT}"
environment:
- IPV6_ENABLED
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_PHP_AUTOLOAD_ENABLED=true
Expand Down Expand Up @@ -507,6 +511,7 @@ services:
ports:
- "${SHIPPING_PORT}"
environment:
- IPV6_ENABLED
- SHIPPING_PORT
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ services:
- "${CURRENCY_PORT}"
environment:
- CURRENCY_PORT
- IPV6_ENABLED
- VERSION=${IMAGE_VERSION}
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
Expand Down Expand Up @@ -358,6 +359,7 @@ services:
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=frontend-proxy
- ENVOY_PORT
- ENVOY_ADDR
- ENVOY_ADMIN_PORT
- FLAGD_HOST
- FLAGD_PORT
Expand Down Expand Up @@ -459,6 +461,7 @@ services:
ports:
- "${PAYMENT_PORT}"
environment:
- IPV6_ENABLED
- PAYMENT_PORT
- FLAGD_HOST
- FLAGD_PORT
Expand Down Expand Up @@ -525,6 +528,7 @@ services:
ports:
- "${QUOTE_PORT}"
environment:
- IPV6_ENABLED
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_PHP_AUTOLOAD_ENABLED=true
Expand Down Expand Up @@ -590,6 +594,7 @@ services:
ports:
- "${SHIPPING_PORT}"
environment:
- IPV6_ENABLED
- SHIPPING_PORT
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down
12 changes: 11 additions & 1 deletion src/currency/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,17 @@ class CurrencyService final : public oteldemo::CurrencyService::Service

void RunServer(uint16_t port)
{
std::string address("0.0.0.0:" + std::to_string(port));
std::string ip("0.0.0.0");

const char* ipv6_enabled = std::getenv("IPV6_ENABLED");

if (ipv6_enabled == "true") {
ip = "[::]";
logger->Info("Overwriting Localhost IP: " + ip);
}

std::string address(ip + ":" + std::to_string(port));

CurrencyService currencyService;
HealthServer healthService;
ServerBuilder builder;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend-proxy/envoy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
address: "${ENVOY_ADDR}"
port_value: ${ENVOY_PORT}
filter_chains:
- filters:
Expand Down
16 changes: 14 additions & 2 deletions src/payment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@ server.addService(health.service, new health.Implementation({

server.addService(otelDemoPackage.oteldemo.PaymentService.service, { charge: chargeServiceHandler })

server.bindAsync(`0.0.0.0:${process.env['PAYMENT_PORT']}`, grpc.ServerCredentials.createInsecure(), (err, port) => {

let ip = "0.0.0.0";

const ipv6_enabled = process.env.IPV6_ENABLED;

if (ipv6_enabled == "true") {
ip = "[::]";
logger.info(`Overwriting Localhost IP: ${ip}`)
}

const address = ip + `:${process.env['PAYMENT_PORT']}`;

server.bindAsync(address, grpc.ServerCredentials.createInsecure(), (err, port) => {
if (err) {
return logger.error({ err })
}

logger.info(`payment gRPC server started on port ${port}`)
logger.info(`payment gRPC server started on ${address}`)
})

process.once('SIGINT', closeGracefully)
Expand Down
13 changes: 12 additions & 1 deletion src/quote/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,18 @@

return $response;
});
$address = '0.0.0.0:' . getenv('QUOTE_PORT');

$ip = "0.0.0.0";

$ipv6_enabled = getenv('IPV6_ENABLED');

if ($ipv6_enabled == "true") {
$ip = "[::]";
echo "Overwriting Localhost IP: {$ip}" . PHP_EOL;
}

$address = $ip . ':' . getenv('QUOTE_PORT');

$socket = new SocketServer($address);
$server->listen($socket);

Expand Down
12 changes: 11 additions & 1 deletion src/shipping/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ async fn main() -> std::io::Result<()> {
.expect("$SHIPPING_PORT is not set")
.parse()
.expect("$SHIPPING_PORT is not a valid port");
let addr = format!("0.0.0.0:{}", port);

let mut ip = "0.0.0.0".to_string();

if let Ok(ipv6_enabled) = env::var("IPV6_ENABLED") {
if ipv6_enabled == "true" {
ip = "[::]".to_string();
info!("Overwriting Localhost IP: {ip}");
}
}

let addr = format!("{}:{}", ip, port);
info!(
name = "ServerStartedSuccessfully",
addr = addr.as_str(),
Expand Down
Loading