1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# https://www.jenkins.io/doc/book/system-administration/reverse-proxy-configuration-with-jenkins/reverse-proxy-configuration-nginx/
# @param server_name
# The fully qualified domain name where jenkins should be found
# @param jenkins_port
# The local port revproxied to
class profiles::jenkins (
String $server_name,
Stdlib::Port $jenkins_port = 8090,
) {
include ::nginx
include ::profiles::certificate
letsencrypt::domain { $server_name:
cert_name => $profiles::certificate::cert_name,
}
nginx::resource::server { $server_name:
ipv6_enable => true,
ipv6_listen_options => '',
www_root => '/var/run/jenkins/war/',
use_default_location => false,
access_log => absent,
error_log => absent,
* => letsencrypt::conf::nginx($server_name),
}
@@dns_record { $server_name:
type => 'CNAME',
zone => $facts['domain'],
# TODO key should be $server_name local to domain name of host.
key => 'jenkins',
value => 'adrift.space.'
}
if $facts['letsencrypt_directory'][$server_name] {
nginx::resource::location {
default:
server => $server_name,
;
'jenkins static':
location => '~ "^/static/[0-9a-fA-F]{8}\/(.*)$"',
rewrite_rules => ['"^/static/[0-9a-fA-F]{8}\/(.*)" /$1 last'],
;
'jenkins /userContent':
location => '/userContent',
www_root => '/var/lib/jenkins/',
raw_append => @(EOF)
if (!-f $request_filename) {
rewrite (.*) /$1 last;
break;
}
| EOF
;
'jenkins /':
location => '/',
proxy => "http://[::]:${jenkins_port}",
index_files => [],
ssl => true,
ssl_only => true,
}
}
}
|