puppetlabs / puppetlabs/puppetlabs-apache
Start apache without all vhosts
Nobody has claimed this yet.
- Dominant language
- Puppet
- Stars
- 356
- Forks
- 1.1k
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
Use Case
When creating a new site that uses a letsencrypt certificate, the non-ssl version needs to be deployed and run before the SSL configuration can be added and deployed.
e.g.
apache::vhost { "${servername}":
servername => $servername,
port => 80,
docroot => $docroot,
block => 'scm',
rewrites => [
{
comment => 'redirect non-SSL traffic to SSL site except letsencrypt',
rewrite_cond => ['%{HTTPS} off', '%{REQUEST_URI} !^/.well-known/acme-challenge'],
rewrite_rule => ['(.*) https://%{HTTP_HOST}%{REQUEST_URI}'],
}
],
}
->letsencrypt::certonly { "${servername}":
plugin => 'webroot',
webroot_paths => [$docroot],
domains => [$servername],
manage_cron => true,
cron_hour => [0,12],
cron_minute => '30',
cron_success_command => '/bin/systemctl reload apache2.service',
}
# This can't be uncommented on the first run as apache will fail due the files not existing yet
#apache::vhost { "${servername}-ssl":
# servername => $servername,
# port => 443,
# docroot => $docroot,
# block => 'scm',
# ssl => true,
# ssl_cert => "${$facts['letsencrypt_directory'][$servername]}/fullchain.pem",
# ssl_key => "${$facts['letsencrypt_directory'][$servername]}/privkey.pem",
#}
Describe the Solution You Would Like
Allow a vhost to be added and processed after apache has started
Describe Alternatives You've Considered
I've tried using puppet stages but this doesn't work, and also looked at transition but that doesn't seem to be quite what I need
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the apache::vhost declarations are processed relative to the Apache service, using the example with the non-SSL and SSL vhosts as the desired sequence. Review the attempted Puppet stages and transition approach for constraints. Done means Apache can start with the initial non-SSL vhost and later accept the SSL vhost after the certificate files exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100