Skip to content

Commit

Permalink
webplatform/ops#124 we can now backup blog uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
renoirb committed Jun 8, 2015
1 parent 680d271 commit 1a21bcb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
16 changes: 15 additions & 1 deletion code/blog.sls
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include:
- cmd: rsync-blog

# @salt-master-dest
# do not put --delete in rsync. Otherwise it clears config caches too.
# do not put --delete in rsync. Otherwise it deletes images uploads and config caches too
rsync-blog:
cmd.run:
- name: "rsync -a --exclude '.git' --no-perms --password-file=/etc/codesync.secret codesync@salt::code/blog/repo/ /srv/webplatform/blog/"
Expand All @@ -31,6 +31,20 @@ rsync-blog:
- group
- mode

# @salt-master-dest
# Refer to rsync/init.sls
wp-content-uploads:
cmd.run:
- name: "rsync -az --no-perms --password-file=/etc/codesync.secret /srv/webplatform/blog/wp-content/uploads/ codesync@salt::wp-content-uploads/"
- user: root
- group: root
- onlyif: test -d /srv/webplatform/blog/wp-content/uploads/
- require:
- file: /etc/codesync.secret
- file: webplatform-sources
- require_in:
- cmd: rsync-blog

/srv/webplatform/blog/local.php:
file.managed:
- source: salt://code/files/blog/local.php.jinja
Expand Down
4 changes: 2 additions & 2 deletions rsync/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include:
- xinetd.rsyncd

{% for share in pillar['rsync_shares'] %}
{% for share in salt['pillar.get']('rsync:shares') %}
{{ share['secrets file'] }}:
file.managed:
- template: jinja
Expand All @@ -10,7 +10,7 @@ include:
- group: root
- mode: 600
- context:
rsync_secret: "{{ share['auth users'] }}:{{ pillar['rsync_secrets'][share['auth users']] }}"
rsync_secret: "{{ share['auth users'] }}:{{ pillar['rsync']['secrets'][share['auth users']] }}"
{% endfor %}

/etc/rsyncd.conf:
Expand Down
13 changes: 11 additions & 2 deletions rsync/rsyncd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ max connections = 10
log file = /var/log/rsync.log
timeout = 300

{% for share in pillar['rsync_shares'] %}
{% if share['auth users'] in pillar['rsync_secrets'] %}
{% for share in salt['pillar.get']('rsync:shares') %}
{% if share['auth users'] in salt['pillar.get']('rsync:secrets') %}
[{{ share['name'] }}]
comment = {{ share['comment'] }}
path = {{ share['path'] }}
Expand All @@ -15,5 +15,14 @@ gid = {{ share['gid'] }}
auth users = {{ share['auth users'] }}
secrets file = {{ share['secrets file'] }}
{% endif %}
{% endfor %}

{%- if salt['pillar.get']('rsync:shares_add') -%}
{% for share in salt['pillar.get']('rsync:shares_add') %}
[{{ share['name'] }}]
{% for k,v in share.items() -%}
{% if k != 'name' %}{{ k }} = {{ v }}{% endif %}
{% endfor %}
{% endfor %}
{% endif %}

4 changes: 2 additions & 2 deletions rsync/secret.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% for share in pillar['rsync_shares'] %}
{% for share in pillar['rsync']['shares'] %}
{{ share['client secret file'] }}:
file.managed:
- template: jinja
Expand All @@ -7,5 +7,5 @@
- group: root
- mode: 600
- context:
rsync_secret: "{{ pillar['rsync_secrets'][share['auth users']] }}"
rsync_secret: "{{ pillar['rsync']['secrets'][share['auth users']] }}"
{% endfor %}
2 changes: 1 addition & 1 deletion top.sls
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ base:
- python.mysqldb
- webplatform.swift-dreamobjects
# - backup.salt_master
# - backup.mediawiki_xml
- logging.syslog_ng
- logging.udp2log
- logging.remote-logs
# - backup.mediawiki_xml
'app*':
- php
- nutcracker
Expand Down

0 comments on commit 1a21bcb

Please sign in to comment.