chef-repo
chef-repo copied to clipboard
ssl configuration is only added to the nginx conf on second run after adding ssl_info to an app.
Reproduce:
- Deploy an app without
ssl_info
. Make sure there are no leftover certificate files on the server. - Add
ssl_info
with dummy strings for key and crt. - Provision the server.
- Certificate files are now being generated on server.
- Check nginx vhost, note it does not contain the ssl-blocks, yet.
- Provision the server.
- Check nginx vhost, it does now contain the ssl-blocks.
Problem is the :enable_ssl => File.exists?("#{applications_root}/#{app}/shared/config/certificate.crt")
part in the recipes.
When you run this before the parts where the SSL-files are being generated on the server, the enable_ssl will be false. It appears this line is evaluated/ran before the files are being generated. AFAIK chef will first compile the recipes and will then evaluate such lines. And only later on run the recipe as a whole.