Skip to content

Commit

Permalink
Merge pull request #33 from City-of-Helsinki/UHF-10819
Browse files Browse the repository at this point in the history
Add x-robots-tag: noindex, nofollow header to all test/staging environments
  • Loading branch information
tuutti authored Oct 24, 2024
2 parents 7185c83 + 684d3f0 commit e91b452
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
26 changes: 13 additions & 13 deletions openshift/drupal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,23 @@ ARG PHP_SHORT_VERSION
# see https://secure.php.net/manual/en/opcache.installation.php
# we set enable_file_override as files won't change while container is up.
RUN { \
echo 'opcache.memory_consumption=512'; \
echo 'opcache.interned_strings_buffer=64'; \
echo 'opcache.max_accelerated_files=30000'; \
echo 'opcache.enable_file_override=1'; \
echo 'opcache.validate_timestamps=0'; \
} > /etc/php${PHP_SHORT_VERSION}/conf.d/opcache-recommended.ini
echo 'opcache.memory_consumption=512'; \
echo 'opcache.interned_strings_buffer=64'; \
echo 'opcache.max_accelerated_files=30000'; \
echo 'opcache.enable_file_override=1'; \
echo 'opcache.validate_timestamps=0'; \
} > /etc/php${PHP_SHORT_VERSION}/conf.d/opcache-recommended.ini

# Override memory limit and upload max filesize and post max size
# to enable bigger uploads
RUN { \
echo 'memory_limit=512M'; \
echo 'upload_max_filesize=32M'; \
echo 'post_max_size=32M'; \
echo 'max_execution_time=180'; \
echo 'realpath_cache_size=8M'; \
echo 'apc.shm_size=64M'; \
} > /etc/php${PHP_SHORT_VERSION}/conf.d/php-overrides.ini
echo 'memory_limit=512M'; \
echo 'upload_max_filesize=32M'; \
echo 'post_max_size=32M'; \
echo 'max_execution_time=180'; \
echo 'realpath_cache_size=8M'; \
echo 'apc.shm_size=64M'; \
} > /etc/php${PHP_SHORT_VERSION}/conf.d/php-overrides.ini

# Override default fpm pool conf to run nginx and php-fpm as same user.
COPY php-fpm-pool.conf /etc/php${PHP_SHORT_VERSION}/php-fpm.d/www.conf
3 changes: 2 additions & 1 deletion openshift/drupal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Testing environment uses `*-dev` images by default and it's highly recommended t
- Build the image: `make build-php81-dev` (change `php81` to whatever is your actual PHP version)
- Find the image ID of latest `docker images ghcr.io/city-of-helsinki/drupal-docker-base` image and copy the image ID
- Change project's `DRUPAL_IMAGE` (in `.env` file) to image ID from previous step
- Change app container's volume from `/app` to `/var/www/html` (in `docker-compose.yml` file)
- Add `SIMPLETEST_DB: "mysql://drupal:drupal@db:3306/drupal"` to `app` service's environments in `compose.yaml`
- Change app container's volume from `/app` to `/var/www/html` (in `compose.yaml` file)
- Re/start containers: `docker-compose stop && docker compose up -d`

### Building
Expand Down
4 changes: 4 additions & 0 deletions openshift/drupal/files/entrypoints/99-nginx.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/sh

if echo "$APP_ENV" | grep -Eq '(local|dev|development|test|testing|stage|staging)'; then
echo 'add_header X-Robots-Tag "noindex, nofollow";' >> /etc/nginx/conf.d/global-headers
fi

echo "Start up Nginx..."

nginx -g 'daemon off;'
Empty file.
2 changes: 2 additions & 0 deletions openshift/drupal/files/etc/nginx/http.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ server {
proxy_pass http://127.0.0.1:8080/$1$is_args$args;
}

include conf.d/global-headers;

# Allow locations to be added without overriding the whole conf.
include conf.d/custom.locations;

Expand Down

0 comments on commit e91b452

Please sign in to comment.