Skip to content
Open
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
105 changes: 105 additions & 0 deletions doc/nginx/vhost.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@

# Channel database mapping for parallel Behat testing (default port keeps the app configuration)
map $server_port $fastcgi_database_name {
8081 "%DATABASE_NAME%_1";
8082 "%DATABASE_NAME%_2";
8083 "%DATABASE_NAME%_3";
8084 "%DATABASE_NAME%_4";
default "";
}

# Channel cache namespace mapping for parallel Behat testing
map $server_port $fastcgi_cache_namespace {
8081 "channel_1";
8082 "channel_2";
8083 "channel_3";
8084 "channel_4";
default "";
}

server {
listen %PORT%;
listen 8081;
listen 8082;
listen 8083;
listen 8084;
# Further documentation: http://nginx.org/en/docs/http/server_names.html
server_name %HOST_LIST%;

root %BASEDIR%/public;

# Additional Assetic rules
## Don't forget to run php bin/console assetic:dump --env=prod
## and make sure to comment these out in DEV environment.
#if[APP_ENV!=dev] include ez_params.d/ez_prod_rewrite_params;

# Include image rule for DFS or binary handler
include ez_params.d/ez_rewrite_%BINARY_DATA_HANDLER%image_params;

# Include remaining ez rewrite rules
include ez_params.d/ez_rewrite_params;

# upload max size
client_max_body_size %BODY_SIZE_LIMIT_M%;

# FPM fastcgi_read_timeout
fastcgi_read_timeout %TIMEOUT_S%;

# Gzip is enabled by default on most platforms, so here we just specify mime types to compress.
# NOTE: Using gzip on text/html can be a security issue, unless you somehow pad. See http://breachattack.com
gzip_types text/plain text/css application/json text/javascript application/javascript text/xml application/xml application/xml+rss;

location / {
location ~ ^/index\.php(/|$) {
include ez_params.d/ez_fastcgi_params;

# Channel database and cache routing
fastcgi_param DATABASE_NAME $fastcgi_database_name if_not_empty;
fastcgi_param CACHE_NAMESPACE $fastcgi_cache_namespace if_not_empty;

# FPM socket
# Possible values : unix:/var/run/php5-fpm.sock or 127.0.0.1:9000
fastcgi_pass %FASTCGI_PASS%;

## eZ Platform ENVIRONMENT variables, used for customizing index.php execution (not used by console commands)

# Environment.
# Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration
# Make sure to comment the "ez_params.d/ez_prod_rewrite_params" include above in dev.
# Defaults to "dev" if omitted
#if[APP_ENV] fastcgi_param APP_ENV %APP_ENV%;

# Whether to use debugging.
# Possible values: 0 or 1
# Defaults to 0 if omitted, unless APP_ENV is set to: "dev"
#if[APP_DEBUG] fastcgi_param APP_DEBUG "%APP_DEBUG%";

# Optional: Whether to use Symfony's builtin HTTP Caching Proxy.
# Disable it if you are using an external reverse proxy (e.g. Varnish)
# Possible values: 0 or 1
# Defaults to 1 if omitted, unless APP_ENV is set to: "dev"
#if[APP_HTTP_CACHE] fastcgi_param APP_HTTP_CACHE "%APP_HTTP_CACHE%";

# Optional: Defines the proxies to trust
# Needed when using Varnish as proxy, if so disable APP_HTTP_CACHE.
# Separate entries by a comma, example: "ip1,ip2"
# Defaults to not be set if env value is omitted or empty
#if[TRUSTED_PROXIES] fastcgi_param TRUSTED_PROXIES "%TRUSTED_PROXIES%";

# TIP: There are many more environment variables supported by eZ Platform. However unlike those listed above
# they should in most cases rather be set in the environment then in vhost config to make sure cronjobs
# and cli command usage takes them into account as well.
}

# Disable .php(3) and other executable extensions in the var directory
location ~ ^/var/.*(?i)\.(php3?|phar|phtml|sh|exe|pl|bin)$ {
return 403;
}
}

# Custom logs
# access_log %BASEDIR%/app/logs/httpd-access.log;
# error_log %BASEDIR%/app/logs/httpd-error.log notice;

include ez_params.d/ez_server_params;
}
3 changes: 2 additions & 1 deletion docker/base-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ services:
- MAX_BODY_SIZE=20
- FASTCGI_PASS=app:9000
- TIMEOUT=190
command: /bin/bash -c "cd /var/www && cp -a doc/nginx/ez_params.d /etc/nginx && bin/vhost.sh --basedir=/var/www --template-file=doc/nginx/vhost.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
- DATABASE_NAME
command: /bin/bash -c "cd /var/www && cp -a doc/nginx/ez_params.d /etc/nginx 2>/dev/null || true; ([ -f vendor/ibexa/docker/templates/nginx/vhost.template ] && cp vendor/ibexa/docker/templates/nginx/vhost.template doc/nginx/vhost.template 2>/dev/null || true); ([ -f vendor/ibexa/docker/scripts/vhost.sh ] && cp vendor/ibexa/docker/scripts/vhost.sh bin/vhost.sh && chmod +x bin/vhost.sh 2>/dev/null || true); bin/vhost.sh --basedir=/var/www --template-file=doc/nginx/vhost.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
networks:
- frontend
- backend
Expand Down
2 changes: 1 addition & 1 deletion docker/db-mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- ../../doc/docker/entrypoint/mysql/0_database_character_set.sh:/docker-entrypoint-initdb.d/0_database_character_set.sh:ro
- mysql:/var/lib/mysql
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-pleasechangethis}
- MYSQL_USER=ezp
- MYSQL_PASSWORD=SetYourOwnPassword
- MYSQL_DATABASE=ezp
Expand Down
2 changes: 1 addition & 1 deletion docker/db-mariadb11.4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- ../../doc/docker/entrypoint/mysql/0_database_character_set.sh:/docker-entrypoint-initdb.d/0_database_character_set.sh:ro
- mysql:/var/lib/mysql
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-pleasechangethis}
- MYSQL_USER=ezp
- MYSQL_PASSWORD=SetYourOwnPassword
- MYSQL_DATABASE=ezp
Expand Down
2 changes: 1 addition & 1 deletion docker/db-mysql8.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- ../../doc/docker/entrypoint/mysql/0_database_character_set.sh:/docker-entrypoint-initdb.d/0_database_character_set.sh:ro
- mysql:/var/lib/mysql
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-pleasechangethis}
- MYSQL_USER=ezp
- MYSQL_PASSWORD=SetYourOwnPassword
- MYSQL_DATABASE=ezp
Expand Down
2 changes: 1 addition & 1 deletion docker/db-mysql8.4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- ../../doc/docker/entrypoint/mysql/0_database_character_set.sh:/docker-entrypoint-initdb.d/0_database_character_set.sh:ro
- mysql:/var/lib/mysql
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-pleasechangethis}
- MYSQL_USER=ezp
- MYSQL_PASSWORD=SetYourOwnPassword
- MYSQL_DATABASE=ezp
Expand Down
7 changes: 6 additions & 1 deletion docker/entrypoint/mysql/0_database_character_set.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/usr/bin/env bash
echo "Altering database, setting character set to utf8mb4"
echo "ALTER DATABASE ${MYSQL_DATABASE} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" | "${mysql[@]}"
cmd=$(command -v mariadb || command -v mysql)
$cmd -uroot -p"${MYSQL_ROOT_PASSWORD:-pleasechangethis}" -e "ALTER DATABASE ${MYSQL_DATABASE} CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>/dev/null || true
if [[ -n "${MYSQL_USER}" ]]; then
echo "Granting privileges on channel databases"
$cmd -uroot -p"${MYSQL_ROOT_PASSWORD:-pleasechangethis}" -e "GRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}_%\`.* TO '${MYSQL_USER}'@'%'; FLUSH PRIVILEGES;" 2>/dev/null || true
fi
5 changes: 3 additions & 2 deletions docker/selenium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ services:
- "5900:5900"
environment:
- SE_VNC_NO_PASSWORD=1
- SE_NODE_MAX_SESSIONS=2
- SE_NODE_MAX_SESSIONS=${SE_NODE_MAX_SESSIONS:-4}
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
- SE_NODE_SESSION_TIMEOUT=300
networks:
- backend
# Because of: https://github.com/elgalu/docker-selenium/issues/20
shm_size: '2gb'
shm_size: '4gb'

app:
depends_on:
Expand Down
9 changes: 8 additions & 1 deletion scripts/vhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ template_vars=(${option_vars[*]})
template_vars+=("%BODY_SIZE_LIMIT_M%")
template_vars+=("%TIMEOUT_S%")
template_vars+=("%HOST_LIST%")
template_vars+=("%DATABASE_NAME%")

# Default options
declare -a template_values=(
Expand All @@ -46,6 +47,7 @@ declare -a template_values=(
"48m"
"90s"
"localhost *.localhost"
"ezp"
)

function show_help
Expand Down Expand Up @@ -130,6 +132,9 @@ function inject_environment_variables
}

inject_environment_variables
if [[ -n "${DATABASE_NAME}" ]]; then
template_values[16]="${DATABASE_NAME}"
fi

## Parse arguments
for i in "$@"
Expand Down Expand Up @@ -165,6 +170,9 @@ case $i in
--binary-data-handler=*)
template_values[12]="${i#*=}"
;;
--database-name=*)
template_values[16]="${i#*=}"
;;
--body-size-limit=*)
let template_values[9]="${i#*=}"*1024*1024
template_values[13]="${i#*=}m"
Expand Down Expand Up @@ -218,7 +226,6 @@ if [[ "${template_values[4]}" != "" ]] ; then
template_values[15]=$tmp
fi


## Generate template result and output

template=$(<$template_file)
Expand Down
26 changes: 26 additions & 0 deletions templates/nginx/vhost.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@

# Channel database mapping for parallel Behat testing (default port keeps the app configuration)
map $server_port $fastcgi_database_name {
8081 "%DATABASE_NAME%_1";
8082 "%DATABASE_NAME%_2";
8083 "%DATABASE_NAME%_3";
8084 "%DATABASE_NAME%_4";
default "";
}

# Channel cache namespace mapping for parallel Behat testing
map $server_port $fastcgi_cache_namespace {
8081 "channel_1";
8082 "channel_2";
8083 "channel_3";
8084 "channel_4";
default "";
}

server {
listen %PORT%;
listen 8081;
listen 8082;
listen 8083;
listen 8084;
# Further documentation: http://nginx.org/en/docs/http/server_names.html
server_name %HOST_LIST%;

Expand Down Expand Up @@ -31,6 +53,10 @@ server {
location ~ ^/index\.php(/|$) {
include ez_params.d/ez_fastcgi_params;

# Channel database and cache routing
fastcgi_param DATABASE_NAME $fastcgi_database_name if_not_empty;
fastcgi_param CACHE_NAMESPACE $fastcgi_cache_namespace if_not_empty;

# FPM socket
# Possible values : unix:/var/run/php5-fpm.sock or 127.0.0.1:9000
fastcgi_pass %FASTCGI_PASS%;
Expand Down
Loading