Commit 10be474a3e3693d6028b3321027b12c09a600282
1 parent
ecc98ee6
Exists in
master
and in
39 other branches
Adding cronjobs
Showing
6 changed files
with
107 additions
and
0 deletions
Show diff stats
puppet/hieradata/common.yaml
@@ -10,3 +10,5 @@ postfix::admin_email: test@test.test | @@ -10,3 +10,5 @@ postfix::admin_email: test@test.test | ||
10 | nginx::worker_processes: 8 | 10 | nginx::worker_processes: 8 |
11 | nginx::error_log: '/var/log/nginx/error.log' | 11 | nginx::error_log: '/var/log/nginx/error.log' |
12 | nginx::access_log: '/var/log/nginx/access.log' | 12 | nginx::access_log: '/var/log/nginx/access.log' |
13 | + | ||
14 | +# Remember to replace the id_rsa and id_rsa.pub on colab/files |
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +-----BEGIN RSA PRIVATE KEY----- | ||
2 | +MIIEpAIBAAKCAQEAuCnJ7elkn0ZoMiZZIbZ8wigD1gcMwKyTVrPfnel9eNK9c/8R | ||
3 | +6QsE6xrNoNQmjTsbGJF88RZkz7cYxX9YFIXatL+Wckq+GUirWMUm/2zIR8rqo31X | ||
4 | +l/0E/nXWED3k9L3ZZwB3PzY15vDhkt+Gv+zpdYQkL6Jj23IAeDM1Q5/cq3Ha2z5l | ||
5 | +1L0z7wN+rttfE879Jxv7plC3ceVzm7jj5aYRH2dZFgkjgr3DmAI0fh+15To4apkQ | ||
6 | +fw/tvGPfogIDRhQybts5UvY2UnK4/ize+IswBTgTlNV864bLqpkgcY8drdX04Kxu | ||
7 | +34qBG1FGtj4MDP3kjJdoFOolV4vn+5nGQ0A6awIDAQABAoIBAGO7ZbpskWxb8aNu | ||
8 | +9wf1znxKtUEb0kEpdCUZBfl7b9KVtblyoZ1ltUUo38DAAxyqrJLSfyoEaZW/Xy/d | ||
9 | +NbLvhjAqLOw6I9aHbxuEsQjUPWX7srPU9jG9+Q1gfQuQqUQM6AYKz4kw72HggxhJ | ||
10 | +6qxXPVrBs+MD+zXk9/IgMTEtCpDhDVNdy1bE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P3EL3sIiIvc/IKxw3E2faU8iPXWyXmYbL/vHDs5+BX | ||
26 | +h29DcOwAoANga1DxlQrJ6uGSb4yKkxaamTIJJMSJ5G9UUf90ie3Y2w== | ||
27 | +-----END RSA PRIVATE KEY----- | ||
28 | + |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4Kcnt6WSfRmgyJlkhtnzCKAPWBwzArJNWs9+d6X140r1z/xHpCwTrGs2g1CaNOxsYkXzxFmTPtxjFf1gUhdq0v5ZySr4ZSKtYxSb/bMhHyuqjfVeX/QT+ddYQPeT0vdlnAHc/NjXm8OGS34a/7Ol1hCQvomPbcgB4MzVDn9yrcdrbPmXUvTPvA36u218Tzv0nG/umULdx5XObuOPlphEfZ1kWCSOCvcOYAjR+H7XlOjhqmRB/D+28Y9+iAgNGFDJu2zlS9jZScrj+LN74izAFOBOU1XzrhsuqmSBxjx2t1fTgrG7fioEbUUa2PgwM/eSMl2gU6iVXi+f7mcZDQDpr demouser@demoserver |
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | + | ||
2 | +class colab::cronjobs { | ||
3 | + | ||
4 | + $virtualenv_python = "/home/colab/.virtualenvs/colab/bin/python" | ||
5 | + $manage_colab = "$virtualenv_python colab/src/manage.py" | ||
6 | + | ||
7 | + Cron { | ||
8 | + user => colab, | ||
9 | + } | ||
10 | + | ||
11 | + cron { 'update-haystack-index': | ||
12 | + command => "$manage_colab update_index --age=1", | ||
13 | + minute => '*', | ||
14 | + } | ||
15 | + | ||
16 | + cron { 'rebuild-haystack-index': | ||
17 | + command => "$manage_colab rebuild_index --noinput", | ||
18 | + hour => '2', | ||
19 | + minute => '34', | ||
20 | + } | ||
21 | + | ||
22 | + cron { 'import-mailman-messages': | ||
23 | + command => "$manage_colab import_emails --archives_path=/usr/local/django/colab/mnt/archives/ --exclude-list=saberes-divulgacao --exclude-list=pml --exclude-list=mailman --exclude-list=lexml-anuncios", | ||
24 | + hour => '*', | ||
25 | + minute => '*', | ||
26 | + } | ||
27 | + | ||
28 | + file { '/mnt/mailman/': | ||
29 | + ensure => directory, | ||
30 | + } | ||
31 | + | ||
32 | + file { '/mnt/mailman/archives/': | ||
33 | + ensure => directory, | ||
34 | + require => File['/mnt/mailman/'], | ||
35 | + } | ||
36 | + | ||
37 | + cron { 'mount-sshfs': | ||
38 | + command => 'test -e /mnt/mailman/archives/flag || sshfs root@listas.interlegis.gov.br:/var/lib/mailman/archives/private /mnt/mailman/archives/ -o ro,nosuid,nodev,max_read=65536,allow_other,IdentityFile=/root/.ssh/id_rsa && touch /mnt/mailman/archives/flag', | ||
39 | + minute => '*/5', | ||
40 | + user => 'root', | ||
41 | + require => [ | ||
42 | + File['/mnt/mailman/archives/'], | ||
43 | + File['root-ssh-private-key'], | ||
44 | + Package['sshfs'], | ||
45 | + ], | ||
46 | + } | ||
47 | + | ||
48 | +} |
puppet/modules/colab/manifests/init.pp
@@ -11,6 +11,7 @@ class colab { | @@ -11,6 +11,7 @@ class colab { | ||
11 | 11 | ||
12 | include supervisor | 12 | include supervisor |
13 | include colab::requirements | 13 | include colab::requirements |
14 | + include colab::cronjobs | ||
14 | 15 | ||
15 | apt::ppa { 'ppa:nginx/stable': } | 16 | apt::ppa { 'ppa:nginx/stable': } |
16 | 17 | ||
@@ -44,6 +45,30 @@ class colab { | @@ -44,6 +45,30 @@ class colab { | ||
44 | group => root, | 45 | group => root, |
45 | } | 46 | } |
46 | 47 | ||
48 | + file { 'root-ssh-dir': | ||
49 | + ensure => directory, | ||
50 | + mode => '0700', | ||
51 | + path => '/root/.ssh', | ||
52 | + } | ||
53 | + | ||
54 | + file { 'root-ssh-private-key': | ||
55 | + ensure => present, | ||
56 | + mode => '0600', | ||
57 | + path => '/root/.ssh/id_rsa', | ||
58 | + source => 'puppet:///modules/colab/root_id_rsa', | ||
59 | + owner => root, | ||
60 | + group => root, | ||
61 | + } | ||
62 | + | ||
63 | + file { 'root-ssh-public-key': | ||
64 | + ensure => present, | ||
65 | + mode => '0644', | ||
66 | + path => '/root/.ssh/id_rsa.pub', | ||
67 | + source => 'puppet:///modules/colab/root_id_rsa.pub', | ||
68 | + owner => root, | ||
69 | + group => root, | ||
70 | + } | ||
71 | + | ||
47 | supervisor::app { 'colab': | 72 | supervisor::app { 'colab': |
48 | command => '/home/colab/.virtualenvs/colab/bin/gunicorn colab.wsgi:application -c colab/gunicorn.conf.py', | 73 | command => '/home/colab/.virtualenvs/colab/bin/gunicorn colab.wsgi:application -c colab/gunicorn.conf.py', |
49 | directory => '/home/colab/colab/src/', | 74 | directory => '/home/colab/colab/src/', |
puppet/modules/colab/manifests/requirements.pp