2 # Cookbook Name:: bubbleupnp-server
3 # Recipe:: docker-compose
5 # Copyright 2019-2022, whitestar
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 doc_url = 'https://github.com/wdstar/docker-bubbleupnpserver'
22 include_recipe 'platform_utils::kernel_user_namespace'
23 include_recipe 'docker-grid::compose'
25 app_dir = node['bubbleupnp-server']['docker-compose']['app_dir']
26 data_dir = node['bubbleupnp-server']['docker-compose']['data_dir']
27 dot_env = node['bubbleupnp-server']['docker-compose']['dot_env']
31 workdir = '/usr/share/bubbleupnpserver'
32 if dot_env['VER'] > '0.9-5' || dot_env['VER'] == 'latest'
33 file_owner = 'bubbleupnpserver'
35 workdir = '/opt/bubbleupnpserver'
41 "#{data_dir}/Playlists",
43 resources(directory: dir) rescue directory dir do
51 config_srvs = node['bubbleupnp-server']['docker-compose']['config']['services']
52 override_config_srvs = node.override['bubbleupnp-server']['docker-compose']['config']['services']
53 force_override_config_srvs = node.force_override['bubbleupnp-server']['docker-compose']['config']['services']
55 vols = config_srvs['bubbleupnp-server']['volumes'].to_a
57 # Note: the official image already contains the following volume definitions.
58 if dot_env['REGISTRY'] != 'bubblesoftapps'
60 vols.push("#{data_dir}/configuration.xml:#{workdir}/configuration.xml:rw")
61 vols.push("#{data_dir}/cache:#{workdir}/cache:rw")
62 vols.push("#{data_dir}/Playlists:#{workdir}/Playlists:rw")
65 # merge environment hash
66 force_override_config_srvs['bubbleupnp-server']['environment'] = envs unless envs.empty?
67 # reset volumes array.
68 override_config_srvs['bubbleupnp-server']['volumes'] = vols unless vols.empty?
70 file "#{data_dir}/configuration.xml" do
81 template "#{app_dir}/#{conf_file}" do
82 source "opt/docker-compose/app/bubbleupnp-server/#{conf_file}"
93 template "#{app_dir}/#{conf_file}" do
94 source "opt/docker-compose/app/bubbleupnp-server/#{conf_file}"
99 file_owner: file_owner,
100 file_group: file_group,
106 dockerfile_tpl = 'Dockerfile'
107 dockerfile_tpl = 'Dockerfile.armhf' if node['kernel']['machine'] == 'armv7l'
108 template "#{app_dir}/Dockerfile" do
109 source "opt/docker-compose/app/bubbleupnp-server/#{dockerfile_tpl}"
119 srv = 'bubbleupnp-server'
120 template "/etc/cron.d/#{srv}-local" do
121 source "etc/cron.d/#{srv}-local"
125 action :delete unless node['bubbleupnp-server']['docker-compose']['autopilot']['enabled']
128 log 'bubbleupnp-server docker-compose post install message' do
130 Note: You must execute the following command manually.
134 $ docker-compose up -d
136 $ docker-compose down