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

Reliance on mime.types #1240

Closed
jacksgt opened this issue Aug 23, 2018 · 5 comments · Fixed by #1243
Closed

Reliance on mime.types #1240

jacksgt opened this issue Aug 23, 2018 · 5 comments · Fixed by #1243

Comments

@jacksgt
Copy link
Contributor

jacksgt commented Aug 23, 2018

Hey there,

excellent puppet module!

However, while experimenting with this module, I have stumbled upon a problem: the module blindly relies on the presence of a mime.types files (specifically in

include <%= @conf_dir %>/mime.types;
). While this will work for most distributions, it does not work when using a custom config directory (nginx::conf_dir).

In my case, the configuration gets generated as follows (nginx.conf):

# MANAGED BY PUPPET
user www-data;
worker_processes 1;
worker_rlimit_nofile 1024;
...
http {

  include       /mnt/etc/nginx/mime.types;
  default_type  application/octet-stream;
  ...
  include /mnt/etc/nginx/conf.d/*.conf;
  include /mnt/etc/nginx/sites-enabled/*;
}

Since /mnt/etc/nginx was created by the module itself, it is initially empty and therefore lacks mime.types.

Upon startup, nginx then complains:

nginx: [emerg] open() "/mnt/etc/nginx/mime.types" failed (2: No such file or directory) in /mnt/etc/nginx/nginx.conf:17
@jacksgt
Copy link
Contributor Author

jacksgt commented Aug 23, 2018

I see two possible ways out of this.

  1. Make the mime.type-file path configurable.
  2. Include a mime.type-file in this module and ensure it is present at the required location.

I'd prefer the second options, what do you think?

@ekohl
Copy link
Member

ekohl commented Aug 30, 2018

I think the first option is the least invasive one. The mime types file contents could easily go out of date or be different on various distros.

@martialblog
Copy link
Contributor

@ekohl I thought about maybe having a simple erb that gets filed with a hash, since the mime types file is rather simple. But yes, there could be variation in distros.

@jacksgt
Copy link
Contributor Author

jacksgt commented Aug 31, 2018

@martialblog Excellent idea!
Since the Nginx configuration is managed by this module anyway, I don't think the variations between distros are a problem.

@martialblog
Copy link
Contributor

I wrote a little example of a template based solution.

https://github.com/vision-it/puppet-nginx/commit/3a9a68d13cba85c07b3c7907ca0608573474d281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants