diff --git a/compose.yaml b/compose.yaml index e2bc345c..56202025 100644 --- a/compose.yaml +++ b/compose.yaml @@ -87,6 +87,28 @@ services: - "traefik.http.routers.${COMPOSE_PROJECT_NAME}-varnish.tls=true" - "traefik.http.services.${COMPOSE_PROJECT_NAME}-varnish.loadbalancer.server.port=6081" - "traefik.docker.network=stonehenge-network" + elastic-proxy: + container_name: "${COMPOSE_PROJECT_NAME}-elastic-proxy" + image: nginxinc/nginx-unprivileged:alpine-perl + environment: + ELASTICSEARCH_URL: "http://elastic:9200" + volumes: + - ./docker/elastic-proxy/nginx.conf:/etc/nginx/nginx.conf + - ./docker/elastic-proxy/elastic.conf:/etc/nginx/templates/default.conf.template + networks: + - stonehenge-network + - internal + labels: + - "traefik.enable=true" + - "traefik.http.routers.nginx.entrypoints=https" + - "traefik.http.routers.nginx.rule=Host(`elastic-proxy-${DRUPAL_HOSTNAME}`)" + - "traefik.http.services.nginx.loadbalancer.server.port=8080" + - "traefik.http.routers.nginx.tls=true" + - "traefik.docker.network=stonehenge-network" + depends_on: + - elastic + profiles: + - search elastic: image: docker.elastic.co/elasticsearch/elasticsearch:8.4.0 container_name: "${COMPOSE_PROJECT_NAME}-elastic" diff --git a/composer.lock b/composer.lock index 80557284..cb9349ba 100644 --- a/composer.lock +++ b/composer.lock @@ -125,16 +125,16 @@ }, { "name": "chi-teck/drupal-code-generator", - "version": "3.5.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/Chi-teck/drupal-code-generator.git", - "reference": "74c2dc687e124bfc4001e73e9346b33067e2ec2b" + "reference": "7794c268309a6fd7aeecfd1246a01238c14384c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Chi-teck/drupal-code-generator/zipball/74c2dc687e124bfc4001e73e9346b33067e2ec2b", - "reference": "74c2dc687e124bfc4001e73e9346b33067e2ec2b", + "url": "https://api.github.com/repos/Chi-teck/drupal-code-generator/zipball/7794c268309a6fd7aeecfd1246a01238c14384c4", + "reference": "7794c268309a6fd7aeecfd1246a01238c14384c4", "shasum": "" }, "require": { @@ -179,9 +179,9 @@ "description": "Drupal code generator", "support": { "issues": "https://github.com/Chi-teck/drupal-code-generator/issues", - "source": "https://github.com/Chi-teck/drupal-code-generator/tree/3.5.0" + "source": "https://github.com/Chi-teck/drupal-code-generator/tree/3.6.0" }, - "time": "2024-04-11T11:23:44+00:00" + "time": "2024-05-20T12:50:42+00:00" }, { "name": "clue/stream-filter", @@ -3704,16 +3704,16 @@ }, { "name": "drupal/helfi_api_base", - "version": "2.7.3", + "version": "2.7.4", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base.git", - "reference": "85d95965224f56070116162d5b1f8789d0866a5f" + "reference": "bb8b9a188b5b0fa7a1bbf332609949223cb1b2c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-api-base/zipball/85d95965224f56070116162d5b1f8789d0866a5f", - "reference": "85d95965224f56070116162d5b1f8789d0866a5f", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-api-base/zipball/bb8b9a188b5b0fa7a1bbf332609949223cb1b2c3", + "reference": "bb8b9a188b5b0fa7a1bbf332609949223cb1b2c3", "shasum": "" }, "require": { @@ -3743,10 +3743,10 @@ ], "description": "Helfi - API Base", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/tree/2.7.3", + "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/tree/2.7.4", "issues": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/issues" }, - "time": "2024-04-30T10:10:25+00:00" + "time": "2024-05-08T07:00:11+00:00" }, { "name": "drupal/helfi_azure_fs", @@ -3794,12 +3794,12 @@ "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-tools.git", - "reference": "08fe754581afe4ba8d1d7324b193108f476dd548" + "reference": "9b33c808570b6e8daea537fd96885f9fe7246274" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-tools/zipball/08fe754581afe4ba8d1d7324b193108f476dd548", - "reference": "08fe754581afe4ba8d1d7324b193108f476dd548", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-tools/zipball/9b33c808570b6e8daea537fd96885f9fe7246274", + "reference": "9b33c808570b6e8daea537fd96885f9fe7246274", "shasum": "" }, "require": { @@ -3871,7 +3871,7 @@ "source": "https://github.com/City-of-Helsinki/drupal-tools/tree/main", "issues": "https://github.com/City-of-Helsinki/drupal-tools/issues" }, - "time": "2024-03-20T07:54:25+00:00" + "time": "2024-05-21T06:26:52+00:00" }, { "name": "drupal/image_style_quality", @@ -5328,17 +5328,17 @@ }, { "name": "drupal/raven", - "version": "4.0.28", + "version": "4.0.30", "source": { "type": "git", "url": "https://git.drupalcode.org/project/raven.git", - "reference": "4.0.28" + "reference": "4.0.30" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/raven-4.0.28.zip", - "reference": "4.0.28", - "shasum": "2de9574a2513ec283a8c54714014be1b47a8d31d" + "url": "https://ftp.drupal.org/files/projects/raven-4.0.30.zip", + "reference": "4.0.30", + "shasum": "20d85b6a13607f9998e8550f56a756ae8ec85bf5" }, "require": { "drupal/core": "^8 || ^9 || ^10", @@ -5348,13 +5348,13 @@ "drupal/csp": "^1.17", "drupal/monitoring": "^1.13", "drupal/seckit": "^2.0", - "drush/drush": "^10.6 || ^11.0 || ^12.0" + "drush/drush": "^10.6 || ^11.0 || ^12.0 || ^13.0" }, "type": "drupal-module", "extra": { "drupal": { - "version": "4.0.28", - "datestamp": "1711568882", + "version": "4.0.30", + "datestamp": "1715809773", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -7254,26 +7254,26 @@ }, { "name": "firebase/php-jwt", - "version": "v6.10.0", + "version": "v6.10.1", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" + "reference": "500501c2ce893c824c801da135d02661199f60c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", - "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/500501c2ce893c824c801da135d02661199f60c5", + "reference": "500501c2ce893c824c801da135d02661199f60c5", "shasum": "" }, "require": { - "php": "^7.4||^8.0" + "php": "^8.0" }, "require-dev": { - "guzzlehttp/guzzle": "^6.5||^7.4", + "guzzlehttp/guzzle": "^7.4", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "psr/cache": "^1.0||^2.0", + "psr/cache": "^2.0||^3.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" }, @@ -7311,9 +7311,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.10.1" }, - "time": "2023-12-01T16:26:39+00:00" + "time": "2024-05-18T18:05:11+00:00" }, { "name": "galbar/jsonpath", @@ -10746,20 +10746,20 @@ }, { "name": "psr/http-factory", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", - "reference": "e616d01114759c4c489f93b099585439f795fe35" + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", - "reference": "e616d01114759c4c489f93b099585439f795fe35", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": ">=7.0.0", + "php": ">=7.1", "psr/http-message": "^1.0 || ^2.0" }, "type": "library", @@ -10783,7 +10783,7 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interfaces for PSR-7 HTTP message factories", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", @@ -10795,9 +10795,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2023-04-10T20:10:41+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { "name": "psr/http-message", @@ -14494,16 +14494,16 @@ }, { "name": "twig/twig", - "version": "v3.9.3", + "version": "v3.10.3", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58" + "reference": "67f29781ffafa520b0bbfbd8384674b42db04572" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58", - "reference": "a842d75fed59cdbcbd3a3ad7fb9eb768fc350d58", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", + "reference": "67f29781ffafa520b0bbfbd8384674b42db04572", "shasum": "" }, "require": { @@ -14557,7 +14557,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.9.3" + "source": "https://github.com/twigphp/Twig/tree/v3.10.3" }, "funding": [ { @@ -14569,7 +14569,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T11:59:33+00:00" + "time": "2024-05-16T10:04:27+00:00" }, { "name": "twistor/flysystem-stream-wrapper", @@ -14660,30 +14660,31 @@ }, { "name": "webflo/drupal-finder", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webflo/drupal-finder.git", - "reference": "c8e5dbe65caef285fec8057a4c718a0d4138d1ee" + "reference": "1fa65484857c7a2e4dcf0d9e0b47198fe0681b8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/c8e5dbe65caef285fec8057a4c718a0d4138d1ee", - "reference": "c8e5dbe65caef285fec8057a4c718a0d4138d1ee", + "url": "https://api.github.com/repos/webflo/drupal-finder/zipball/1fa65484857c7a2e4dcf0d9e0b47198fe0681b8a", + "reference": "1fa65484857c7a2e4dcf0d9e0b47198fe0681b8a", "shasum": "" }, "require": { - "ext-json": "*" + "composer-runtime-api": "^2.2", + "php": ">=8.1" }, "require-dev": { "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^10.4" }, "type": "library", "autoload": { - "classmap": [ - "src/DrupalFinder.php" - ] + "psr-4": { + "DrupalFinder\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -14695,12 +14696,12 @@ "email": "florian@webflo.org" } ], - "description": "Helper class to locate a Drupal installation from a given path.", + "description": "Helper class to locate a Drupal installation.", "support": { "issues": "https://github.com/webflo/drupal-finder/issues", - "source": "https://github.com/webflo/drupal-finder/tree/1.2.2" + "source": "https://github.com/webflo/drupal-finder/tree/1.3.0" }, - "time": "2020-10-27T09:42:17+00:00" + "time": "2024-05-08T21:22:39+00:00" }, { "name": "webmozart/assert", @@ -16914,16 +16915,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -16972,9 +16973,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", diff --git a/conf/cmi/language/tr/core.date_format.html_month.yml b/conf/cmi/language/tr/core.date_format.html_month.yml deleted file mode 100644 index f885f992..00000000 --- a/conf/cmi/language/tr/core.date_format.html_month.yml +++ /dev/null @@ -1 +0,0 @@ -label: 'HTML Month' diff --git a/docker/elastic-proxy/elastic.conf b/docker/elastic-proxy/elastic.conf new file mode 100644 index 00000000..89203d0c --- /dev/null +++ b/docker/elastic-proxy/elastic.conf @@ -0,0 +1,26 @@ +server { + listen 8080 default_server; + server_name _; + client_max_body_size 50m; + + location /ping { + add_header Content-Type application/json; + return 200 '{"status":"success","result":"Proxy alive"}'; + } + + location ~ ^/([a-z][a-z_-]*)/(_search|_msearch)$ { + limit_except GET POST { + deny all; + } + proxy_pass ${ELASTICSEARCH_URL}; + proxy_redirect off; + proxy_set_header Authorization $elastic_authorization; + proxy_pass_header Authorization; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_pass_header Access-Control-Allow-Origin; + proxy_pass_header Access-Control-Allow-Methods; + proxy_hide_header Access-Control-Allow-Headers; + } +} diff --git a/docker/elastic-proxy/nginx.conf b/docker/elastic-proxy/nginx.conf new file mode 100644 index 00000000..b3eb4c1d --- /dev/null +++ b/docker/elastic-proxy/nginx.conf @@ -0,0 +1,60 @@ +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /tmp/nginx.pid; + +env ELASTICSEARCH_URL; +env ELASTIC_PASSWORD; +env ELASTIC_USER; + +load_module modules/ngx_http_perl_module.so; + +events { + worker_connections 1024; +} + +http { + proxy_temp_path /tmp/proxy_temp; + client_body_temp_path /tmp/client_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + perl_set $elastic_authorization ' + sub { + use MIME::Base64; + if (exists($ENV{"ELASTIC_USER"}) && exists($ENV{"ELASTIC_PASSWORD"})) { + return encode_base64($ENV{"ELASTIC_USER"} . ":" . $ENV{"ELASTIC_PASSWORD"}); + } + return ""; + } + '; + + # Log in JSON Format + log_format nginxlog_json escape=json '{ "timestamp": "$time_iso8601", ' + '"remote_addr": "$remote_addr", ' + '"body_bytes_sent": $body_bytes_sent, ' + '"request_time": $request_time, ' + '"response_status": $status, ' + '"request": "$request", ' + '"request_method": "$request_method", ' + '"host": "$host",' + '"upstream_addr": "$upstream_addr",' + '"http_x_forwarded_for": "$http_x_forwarded_for",' + '"http_referrer": "$http_referer", ' + '"http_user_agent": "$http_user_agent", ' + '"http_version": "$server_protocol", ' + '"nginx_access": true }'; + access_log /dev/stdout nginxlog_json; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/docker/openshift/entrypoints/20-deploy.sh b/docker/openshift/entrypoints/20-deploy.sh index 6a098241..4c02d6f1 100644 --- a/docker/openshift/entrypoints/20-deploy.sh +++ b/docker/openshift/entrypoints/20-deploy.sh @@ -1,5 +1,11 @@ #!/bin/bash +# Skip deployment script if ENV var is true +if [ "$SKIP_DEPLOY_SCRIPTS" = "true" ]; then + echo "SKIP_DEPLOY_SCRIPTS is true. Skipping the steps." + return +fi + source /init.sh function rollback_deployment { @@ -36,10 +42,9 @@ if [ "$CURRENT_DEPLOY_ID" != "$OPENSHIFT_BUILD_NAME" ]; then # @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/deploy-hooks.md drush helfi:pre-deploy || true # Run maintenance tasks (config import, database updates etc) - drush deploy - + OUTPUT=$(sh -c '(drush deploy); exit $?' 2>&1) if [ $? -ne 0 ]; then - rollback_deployment "drush deploy failed with {$?} exit code. See logs for more information." $CURRENT_DEPLOY_ID + rollback_deployment "drush deploy failed with {$?} exit code. ${OUTPUT}" $CURRENT_DEPLOY_ID exit 1 fi # Run post-deploy tasks. diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..cff028e4 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,12 @@ + + + + *.css + *.js + + + + + + +