OSDN Git Service

add backup cron configuration. bubbleupnp-server-0.2.3
authorwhitestar <whitestar@users.osdn.me>
Tue, 4 Jan 2022 08:11:16 +0000 (17:11 +0900)
committerwhitestar <whitestar@users.osdn.me>
Tue, 4 Jan 2022 08:11:16 +0000 (17:11 +0900)
cookbooks/bubbleupnp-server/CHANGELOG.md
cookbooks/bubbleupnp-server/README.md
cookbooks/bubbleupnp-server/attributes/default.rb
cookbooks/bubbleupnp-server/recipes/docker-compose.rb
cookbooks/bubbleupnp-server/templates/default/etc/cron.d/bubbleupnp-server-local
cookbooks/bubbleupnp-server/templates/default/opt/docker-compose/app/bubbleupnp-server/restore.sh
cookbooks/bubbleupnp-server/version

index 9e61d84..e09da87 100644 (file)
@@ -1,5 +1,9 @@
 # bubbleupnp-server CHANGELOG
 
+0.2.3
+-----
+- add backup cron configuration.
+
 0.2.2
 -----
 - fix the restore script.
index 7ea22e6..0f9b153 100644 (file)
@@ -86,7 +86,7 @@ override_attributes(
       'config' => {
         'services' => {
           'bubbleupnp-server' => {
-            'restart' => 'no',
+            'restart' => 'unless-stopped',
           },
         },
       },
index 31c98a9..fa56e97 100644 (file)
@@ -65,7 +65,7 @@ version_2_config = {
   'services' => {
     'bubbleupnp-server' => {
       'image' => '${REGISTRY}/${NAME}:${VER}',
-      'restart' => 'always',
+      'restart' => 'unless-stopped',
       'network_mode' => 'host',
       'volumes' => [
         # These volumes will be set by the bubbleupnp-server::docker-compose recipe automatically.
index 24a1c8c..b9879c5 100644 (file)
@@ -26,8 +26,12 @@ app_dir = node['bubbleupnp-server']['docker-compose']['app_dir']
 data_dir = node['bubbleupnp-server']['docker-compose']['data_dir']
 dot_env = node['bubbleupnp-server']['docker-compose']['dot_env']
 
+file_owner = 'root'
+file_group = 'root'
 workdir = '/usr/share/bubbleupnpserver'
 if dot_env['VER'] > '0.9-5' || dot_env['VER'] == 'latest'
+  file_owner = 'bubbleupnpserver'
+  file_group = 'users'
   workdir = '/opt/bubbleupnpserver'
 end
 
@@ -92,6 +96,8 @@ end
     group 'root'
     mode '0755'
     variables(
+      file_owner: file_owner,
+      file_group: file_group,
       workdir: workdir
     )
   end
index 8615a8b..9a2e104 100644 (file)
@@ -14,3 +14,4 @@ APP_HOME=<%= node['bubbleupnp-server']['docker-compose']['app_dir'] %>
 OPTS='<%= opts %>'
 
 @reboot root sleep <%= wait_time %> && date "$DATE_F" > $LOG && cd $APP_HOME && docker-compose $OPTS stop >> $LOG 2>&1 && docker-compose $OPTS up -d >> $LOG 2>&1 && docker-compose ps >> $LOG 2>&1
+30 * * * * root date "$DATE_F" >> $LOG && cd $APP_HOME && ./backup.sh >> $LOG 2>&1
index a3b5439..74351c6 100755 (executable)
@@ -9,4 +9,4 @@ sudo docker cp ./${backup_dir}/cache ${container_id}:<%= @workdir %>/
 sudo docker cp ./${backup_dir}/Playlists ${container_id}:<%= @workdir %>/
 
 # fix file owner
-sudo docker exec -u root ${container_id} chown -R bubbleupnpserver:users <%= @workdir %>/{configuration.xml,cache,Playlists}
+sudo docker exec -u root ${container_id} chown -R <%= @file_owner %>:<%= @file_group %> <%= @workdir %>/{configuration.xml,cache,Playlists}