File tree Expand file tree Collapse file tree 4 files changed +46
-2
lines changed Expand file tree Collapse file tree 4 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,22 @@ ADD https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef_1
13
13
RUN set -e -x ; \
14
14
export DEBIAN_FRONTEND=noninteractive ; \
15
15
apt-get update -q --yes ; \
16
- apt-get install -q --yes logrotate vim-nox ; \
16
+ apt-get install -q --yes logrotate vim-nox hardlink ; \
17
17
dpkg -i /tmp/chef-server-core.deb /tmp/chef.deb ; \
18
18
rm -rf /tmp/*.deb /var/lib/apt/lists/* /var/cache/apt/archives/* /etc/opscode ; \
19
19
mkdir -p /etc/cron.hourly ; \
20
20
ln -sfv /var/opt/opscode/log /var/log/opscode ; \
21
21
ln -sfv /var/opt/opscode/etc /etc/opscode ; \
22
22
ln -sfv /opt/opscode/sv/logrotate /opt/opscode/service ; \
23
- ln -sfv /opt/opscode/embedded/bin/sv /opt/opscode/init/logrotate
23
+ ln -sfv /opt/opscode/embedded/bin/sv /opt/opscode/init/logrotate ; \
24
+ chef-apply -e 'chef_gem "knife-opc"'
24
25
25
26
ADD init.rb /init.rb
26
27
ADD chef-server.rb /.chef/chef-server.rb
27
28
ADD logrotate /opt/opscode/sv/logrotate
29
+ ADD knife.rb /etc/chef/knife.rb
30
+ ADD backup.sh /usr/local/bin/chef-server-backup
31
+
32
+ ENV KNIFE_HOME /etc/chef
28
33
29
34
CMD [ "/opt/opscode/embedded/bin/ruby" , "/init.rb" ]
Original file line number Diff line number Diff line change @@ -132,6 +132,14 @@ A sample nginx configuration looks like this:
132
132
133
133
### Backup and restore
134
134
135
+ $ docker exec chef-server chef-server-backup
136
+
137
+ Backup will be created in ` /var/opt/opscode/backup/latest ` , and all
138
+ previous backups will be in their own timestamped directories. Backups
139
+ will use hardlinks to share unchanged files.
140
+
141
+ Alternatively:
142
+
135
143
1 . ` docker stop chef-server `
136
144
2 . Archive ` /var/opt/opscode ` volume (delete the ` bootstrapped ` file
137
145
from the archive to force ` chef-server-ctl reconfigure ` run on the
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ set -e
3
+
4
+ ts=$( date -r backup -u +%Y%m%dT%H%M%SZ)
5
+ destdir=/var/opt/opscode/backup/$ts
6
+
7
+ mkdir -p $destdir
8
+ cd $destdir
9
+
10
+ mkdir users
11
+ for user in $( chef-server-ctl user-list) ; do
12
+ chef-server-ctl user-show -l -F json $user > users/$user .json
13
+ done
14
+
15
+ mkdir organizations
16
+ for org in $( chef-server-ctl org-list) ; do
17
+ chef-server-ctl org-show -l -F json $org > organizations/$org .json
18
+ mkdir organizations/$org
19
+ env CHEF_ORGANIZATION=$org knife download --chef-repo-path=organizations/$org /
20
+ done
21
+
22
+ cd ..
23
+ hardlink .
24
+
25
+ test -d latest~ && rm -rf latest~
26
+ test -d latest && mv latest latest~
27
+ cp -al $ts latest
28
+ rm -rf latest~
Original file line number Diff line number Diff line change
1
+ instance_eval ( File . read ( "/etc/opscode/pivotal.rb" ) )
2
+ chef_server_url "#{ chef_server_url } /organizations/#{ ENV [ 'CHEF_ORGANIZATION' ] } " if ENV [ 'CHEF_ORGANIZATION' ]
3
+ versioned_cookbooks true
You can’t perform that action at this time.
0 commit comments