Skip to content

Commit 46e0dcf

Browse files
committed
Merge pull request #12 from cvmfs/server
Add stratum 0 and stratum 1 support.
2 parents 038bfd0 + e2f20ad commit 46e0dcf

File tree

9 files changed

+214
-11
lines changed

9 files changed

+214
-11
lines changed

README

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
This cvmfs module is designed to install, enable and configure
3-
CvmFS clients.
3+
CvmFS clients and servers.
44

55
For general details on CvmFS see
66
http://cernvm.cern.ch/portal/filesystem
@@ -14,10 +14,11 @@ These facts will only be available once cvmfs is installed and so configuration
1414
of cvmfs is skipped until cvmfs has been installed on the first puppet run.
1515
Two puppet runs are required to install and then configure cvmfs.
1616

17+
Client Configuration
18+
--------------------
19+
To configure a cvmfs client enable the module
1720

18-
To configured cvmfs enable the module
19-
20-
class {'cvmfs:'}
21+
include (cvmfs)
2122

2223
and then enable individual repositories optionally with a particular
2324
configuration on each repository. e.g.
@@ -64,9 +65,36 @@ since they are not managed by this puppet. Typically
6465
the domain.d files contains the values of 'CVMFS_PUBLIC_KEY'
6566
so this should be set at the global and/or per repository level.
6667

67-
Todo
68-
----
69-
Write rspec tests.
68+
Fsck Module
69+
-----------
70+
An optional class 'cvmfs::fsck' can be included to enable a cron job to regualarly
71+
run fsck on cvmfs systems.
72+
73+
include ('cvmfs::fsck')
74+
75+
Server Configuration
76+
--------------------
77+
A stratum zero can be configured with a simple.
78+
class{'cvmfs::server':
79+
repo => 'ilc.example.org',
80+
}
81+
See the docs in cvmfs::server for explanation of parameters.
82+
83+
Stratum One Configuration
84+
------------------------
85+
A stratum one can be configured for multiple repositories with
86+
a
87+
cvmfs::one{'mice.example.org':
88+
origin => 'http://cvmfs01.example.org/cvmfs',
89+
keys => ['/etc/cvmfs/keys/example1.pub','/etc/cvmfs/keys/example1.pub']
90+
}
91+
92+
See cvmfs::one.pp for more details of parameters.
93+
94+
ToDo
95+
---
96+
It's now possible to install multiple stratum zeros in the same
97+
node. This module does not support that and it should.
7098

7199
License
72100
-------

files/cvmfsr.logrotate

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Installed with puppet
2+
3+
/var/log/cvmfs/*.log {
4+
weekly
5+
compress
6+
copytruncate
7+
missingok
8+
}
9+

files/sync-cron.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
for r in $(cd /srv/cvmfs ; echo *.*)
4+
do
5+
(echo ""
6+
echo "Starting $r at $(date)"
7+
cvmfs_server snapshot $r || echo "ERROR from cvmfs_server"
8+
echo "Finished $r at $(date)"
9+
) >> /var/log/cvmfs/$r.log 2>&1
10+
done
11+

manifests/one.pp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# == Define: cvmfs::one
2+
# Sets up a stratum one service for CVMFS.
3+
#
4+
# === Parameters
5+
# [*repo*]
6+
# The name of the repostory, if the repo is not set the *namevar* will be used.
7+
#
8+
# [*origin*]
9+
# The URL prefix of the stratum zero endpoint, the repo name will be appended to the end.
10+
#
11+
# [*keys*]
12+
# An array of keys to use for a repository. The default value is
13+
# ['/etc/cvmfs/keys/cern.ch.pub','/etc/cvmfs/keys/cern-it1.cern.ch.pub','/etc/cvmfs/keys/cern-it2.cern.ch.pub']
14+
#
15+
# === Examples
16+
# cvmfs::one{'mice.example.org':
17+
# origin => 'http://cvmfs01.example.org/cvmfs',
18+
# keys => ['/etc/cvmfs/keys/example1.pub','/etc/cvmfs/keys/example1.pub']
19+
# }
20+
# === Copyright
21+
# Steve Traylen, <[email protected]>, CERN 2013.
22+
define cvmfs::one (
23+
$repo = $name,
24+
$origin = 'http://stratum0.example.org/cvmfs',
25+
$keys = ['/etc/cvmfs/keys/cern.ch.pub','/etc/cvmfs/keys/cern-it1.cern.ch.pub','/etc/cvmfs/keys/cern-it2.cern.ch.pub']
26+
) {
27+
include 'cvmfs::one::install'
28+
include 'cvmfs::one::config'
29+
30+
$joinedkeys = join($keys,':')
31+
exec{"replicate_${name}":
32+
command => "/usr/bin/cvmfs_server add-replica -o cvmfsr ${origin}/${repo} ${joinedkeys}",
33+
creates => "/etc/cvmfs/repositories.d/${repo}/replica.conf",
34+
require => [User['cvmfsr'],Package['cvmfs-server'],Service['httpd']],
35+
}
36+
file{"/etc/httpd/conf.d/cvmfs.${repo}.conf":
37+
ensure => file,
38+
mode => '0644',
39+
owner => root,
40+
group => root,
41+
content => template('cvmfs/cvmfs-strat1-httpd.conf.erb'),
42+
require => Package['httpd'],
43+
notify => Service['httpd']
44+
}
45+
}

manifests/one/config.pp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Class: cvmfs::one::config
2+
# Included once from the cvmfs::one defined type.
3+
class cvmfs::one::config {
4+
5+
firewall{'100 - allow access from 80':
6+
proto => 'tcp',
7+
dport => 80,
8+
action => 'accept'
9+
}
10+
11+
service{'httpd':
12+
ensure => running,
13+
enable => true,
14+
require => Package['httpd']
15+
}
16+
17+
user{'cvmfsr':
18+
ensure => present,
19+
home => '/var/lib/cvmfsr' ,
20+
comment => 'cvmfs repication account',
21+
managehome => true,
22+
system => true
23+
}
24+
25+
cron{'cvmfs_sync':
26+
user => cvmfsr,
27+
minute => [0,30],
28+
command => '/usr/local/sbin/sync-cron.sh',
29+
require => File['/usr/local/sbin/sync-cron.sh']
30+
}
31+
file{'/usr/local/sbin/sync-cron.sh':
32+
ensure => file,
33+
mode => '0755',
34+
owner => root,
35+
group => root,
36+
source => 'puppet:///modules/cvmfs/sync-cron.sh'
37+
}
38+
39+
file{'/var/log/cvmfs':
40+
ensure => directory,
41+
owner => cvmfsr,
42+
group => cvmfsr,
43+
require => User['cvmfsr']
44+
}
45+
file{'/etc/logrotate.d/cvmfsr':
46+
ensure => file,
47+
owner => root,
48+
group => root,
49+
source => 'puppet:///modules/cvmfs/cvmfsr.logrotate'
50+
}
51+
52+
}
53+

manifests/one/install.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Class: cvmfs::one::install,
2+
# included once from the cvmfs::one defined type.
3+
class cvmfs::one::install (
4+
$cvmfs_version = $::cvmfs::params::cvmfs_version
5+
) {
6+
class{'cvmfs::server::yum':}
7+
8+
package{'cvmfs-server':
9+
ensure => $cvmfs_version,
10+
require => Yumrepo['cvmfs'],
11+
}
12+
package{'httpd':
13+
ensure => present
14+
}
15+
}

manifests/server.pp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
# == Class cvmfs::server
22
# This class will set up a cvmfs server
3-
# === Variables
3+
4+
# === Parameters
45
# [*repo*]
56
# This is the namevar , it should be set to the name of repository, e.g mysoftware.example.org, if
67
# not set the namevar will be used.
78
# [*nfshost*]
89
# [*nfsshare*]
9-
# If set then an nfsvolume will be mounted early on before all the cvmfs configuration is done.
10-
# e.g nfsserver.example.org:/Volume/example
10+
# If *nfshost* and *nfsshare* are set then an nfsvolume will be mounted early on before all the cvmfs
11+
# configuration is done.
1112
# [*nfsoptions*]
1213
# Nfs options can be set, there is a sensible default as below.
14+
#
15+
# === Examples
16+
# class{'cvmfs::server':
17+
# repo => 'ilc.example.org',
18+
# }
19+
# or
20+
# class{'cvmfs::server':
21+
# repo => 'bute.example.org',
22+
# nfshost => 'nfs-server.example.org',
23+
# nfsshare => '/volume/bute'
24+
# nfsoptions => 'noatime',
25+
#
1326
class cvmfs::server ($repo = $name,
1427
$nfsshare = undef,
1528
$nfshost = undef,

manifests/server/config.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
$nfsshare = undef,
66
$nfsopts = 'rw,noatime,hard,nfsvers=3',
77
$user = 'shared',
8-
$uid = 101
8+
$uid = 101,
9+
$pubkey = 'cern-it1.cern.ch.pub'
910
) {
1011

1112
if $nfshost and $nfsshare {
@@ -78,5 +79,9 @@
7879
dport => 80,
7980
action => 'accept'
8081
}
82+
file{"/etc/cvmfs/keys/${repo}.pub":
83+
ensure => link,
84+
target => $pubkey
85+
}
8186

8287
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Installed with puppet it will over
2+
# the cvmfs_config created one.
3+
4+
Alias /cvmfs/<%= @repo %> /srv/cvmfs/<%= @repo %>
5+
Alias /opt/<%= @repo.split('.').first %> /srv/cvmfs/<%= @repo %>
6+
<Directory "/srv/cvmfs/<%= @repo %>">
7+
Options -MultiViews
8+
AllowOverride All
9+
Order allow,deny
10+
Allow from all
11+
12+
EnableMMAP Off
13+
EnableSendFile Off
14+
15+
AddType application/x-cvmfs .cvmfspublished .cvmfswhitelist
16+
17+
Header unset Last-Modified
18+
FileETag None
19+
20+
ExpiresActive On
21+
ExpiresDefault "access plus 3 days"
22+
ExpiresByType text/html "access plus 5 minutes"
23+
ExpiresByType application/x-cvmfs "access plus 2 minutes"
24+
</Directory>

0 commit comments

Comments
 (0)