Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quoteservice] Replace php-cli to php-apache #563

Merged
merged 8 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,5 @@ significant modifications will be credited to OpenTelemetry Authors.
([#513](https:/open-telemetry/opentelemetry-demo/pull/513))
* Added frontend instrumentation exporter custom url
([#512](https:/open-telemetry/opentelemetry-demo/pull/512))
* Replaced PHP-CLI to PHP-Apache for a more realistic service
([#563](https:/open-telemetry/opentelemetry-demo/pull/563))
19 changes: 10 additions & 9 deletions src/quoteservice/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM composer:2.4.1 AS build
FROM composer:2.4 AS build

WORKDIR /tmp/
COPY ./src/quoteservice/composer.json .
Expand All @@ -11,17 +11,18 @@ RUN composer install \
--no-dev \
--prefer-dist

FROM php:8.1-cli

# install GRPC (required for the OTel exporter)
# RUN apt-get -y update && apt install -y --no-install-recommends zlib1g-dev && \
# pecl install grpc protobuf-3.21.5 && \
# docker-php-ext-enable grpc protobuf
FROM php:8.1-apache

WORKDIR /var/www
COPY --from=build /tmp/vendor/ /var/www/vendor/
COPY --from=build /tmp/vendor/ ./vendor/
COPY ./src/quoteservice/ /var/www

ENV APACHE_DOCUMENT_ROOT /var/www/public
RUN sed -ri -e 's|/var/www/html|${APACHE_DOCUMENT_ROOT}|g' /etc/apache2/sites-available/*.conf
RUN a2enmod rewrite
RUN echo "ServerName quoteservice" >> /etc/apache2/apache2.conf

EXPOSE ${QUOTE_SERVICE_PORT}

ENTRYPOINT php -S 0.0.0.0:${QUOTE_SERVICE_PORT} -t public
ENTRYPOINT sed -i "s/80/${QUOTE_SERVICE_PORT}/g" /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf \
&& apache2-foreground
4 changes: 4 additions & 0 deletions src/quoteservice/public/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]