Problem when "local-docker-compose-nginx-volumes" was removed in 11.0.0

We are using the local-docker-compose-nginx-volumes patch to customize nginx config, for example:

- ../plugins/<plugin>/apps/configs/nginx/nginx.conf:/etc/nginx/nginx.conf:ro

Since it was removed in tutor 11.0.0, we have to build the nginx Docker image just for changing some settings. Also, we think that this patch is not just used for serving media assets, but also it can be utilized to customize the nginx. Thus, we would like to ask you if this patch can be added again. Or if you have any other suggestions, we really appreciate it.

Thank you very much for your efforts! :blush:

Hi @blackrabbit8205! Could you please describe what changes you are making to the nginx configuration? Couldn’t these changes go to _tutor.conf?

Thank you for your reply. We add GeoIP module to nginx to analyze the data.

load_module modules/;


geoip_country /etc/nginx/GeoIP.dat;
geoip_city /etc/nginx/GeoIPCity.dat;

These changes can only be made in /etc/nginx/nginx.conf. Otherwise, it will fail (link to the issue for reference):

"load_module" directive is not allowed here in /etc/nginx/conf.d/<any_file>.conf

We also change the tutor log format in _tutor.conf file. These changes are solved easily by using the patch.

I’m not quite sure how you modify the “tutor” log format? Are you mounting a different _tutor.conf file in the nginx container?

Since you are modifying the core configuration of the nginx service I think it is only fair if you build your own nginx image. Would this be a problem?

Yes, we mount the custom config file at the same path to replace the default _tutor.conf. To maintain a strict separation of config from the container, mounting is a better solution than rebuilding the image whenever the config changes.

Just for your reference, this is how we change the _tutor.conf:

  - ../plugins/<plugin_name>/apps/configs/nginx/json_analytics.conf:/etc/nginx/conf.d/_tutor.conf:ro
# Allow long domain names
server_names_hash_bucket_size 128;

# Set a short ttl for proxies to allow restarts
resolver [::1]:5353 valid=10s;

# Configure logging
log_format tutor escape=json '{'
  '"msec": "$msec", ' # request unixtime in seconds with a milliseconds resolution
  '"connection": "$connection", ' # connection serial number
  '"connection_requests": "$connection_requests", ' # number of requests made in connection
  '"pid": "$pid", ' # process pid
  '"request_id": "$request_id", ' # the unique request id

If the patched cannot be added again, we will go with another solution. Thank you :blush:

I have an alternative solution for you: you could create a docker-compose.override.yml file in tutor/env/local that contains:

version: "3.7"
    - ../plugins/<plugin_name>/apps/configs/nginx/json_analytics.conf:/etc/nginx/conf.d/_tutor.conf:ro

Would that work for you?

1 Like

Thank you for your suggestion. Yes, it will work. It has some cons, but still better than rebuild the image. We have some rules and standards in the production environment, so any changes required a comparison among solutions. Sorry if this question bothers you. Thank you for your work on this product, it helps us experiment with the latest release faster :wink: