]> git.openstreetmap.org Git - chef.git/commitdiff
Fix some bundle_config issues
authorTom Hughes <tom@compton.nu>
Thu, 20 Feb 2025 20:38:10 +0000 (20:38 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 20 Feb 2025 20:38:53 +0000 (20:38 +0000)
cookbooks/blogs/recipes/default.rb
cookbooks/ruby/resources/bundle_config.rb
cookbooks/serverinfo/attributes/default.rb [new file with mode: 0644]
cookbooks/serverinfo/metadata.rb
cookbooks/serverinfo/recipes/default.rb
test/data_bags/accounts/serverinfo.json [new file with mode: 0644]

index b7d47e445f7ce87a143c1737aed18f7c1d5c0fcd..1c18faba7ef34c3c12df10889f51248722f7827b 100644 (file)
@@ -45,10 +45,12 @@ git "/srv/blogs.openstreetmap.org" do
 end
 
 bundle_config "/srv/blogs.openstreetmap.org" do
+  action :nothing
   user "blogs"
   group "blogs"
   settings "deployment" => "true",
            "without" => "development:test"
+  subscribes :create, "git[/srv/blogs.openstreetmap.org]", :immediately
 end
 
 bundle_install "/srv/blogs.openstreetmap.org" do
index 6c1eae6ba5529d5f3fca1fb09385af30eab9e0bd..aa2e9504a7915d44a20dc12daff3c3b7991098da 100644 (file)
@@ -57,6 +57,6 @@ action_class do
 end
 
 def after_created
-  subscribes :run, "gem_package[bundler#{node[:ruby][:version]}-1]"
-  subscribes :run, "gem_package[bundler#{node[:ruby][:version]}-2]"
+  subscribes :create, "gem_package[bundler#{node[:ruby][:version]}-1]"
+  subscribes :create, "gem_package[bundler#{node[:ruby][:version]}-2]"
 end
diff --git a/cookbooks/serverinfo/attributes/default.rb b/cookbooks/serverinfo/attributes/default.rb
new file mode 100644 (file)
index 0000000..bd45555
--- /dev/null
@@ -0,0 +1 @@
+default[:accounts][:users][:serverinfo][:status] = :role
index 55d69f066a86c04d0e34089187d1410f87e39fea..48a196ad6783ca32bdcd987e11605073007ce6d7 100644 (file)
@@ -6,6 +6,7 @@ description       "Configures server-info web site"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "git"
 depends           "ruby"
index 3999ffe809def8de1d57b1b095aad6dc4cd0641d..6302e5a0dfd1c8c00f3f95f2fb6ca9ebb2ca3779 100644 (file)
@@ -17,6 +17,7 @@
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "git"
 include_recipe "ruby"
@@ -30,12 +31,18 @@ package %w[
   pkg-config
 ]
 
+directory "/srv/hardware.openstreetmap.org" do
+  owner "serverinfo"
+  group "serverinfo"
+  mode "755"
+end
+
 git "/srv/hardware.openstreetmap.org" do
   action :sync
   repository "https://github.com/osmfoundation/osmf-server-info.git"
   depth 1
-  user "root"
-  group "root"
+  user "serverinfo"
+  group "serverinfo"
   notifies :run, "bundle_install[/srv/hardware.openstreetmap.org]"
 end
 
@@ -45,52 +52,41 @@ roles = { :rows => search(:role, "*:*") }
 file "/srv/hardware.openstreetmap.org/_data/nodes.json" do
   content nodes.to_json
   mode "644"
-  owner "root"
-  group "root"
+  owner "serverinfo"
+  group "serverinfo"
   notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
 end
 
 file "/srv/hardware.openstreetmap.org/_data/roles.json" do
   content roles.to_json
   mode "644"
-  owner "root"
-  group "root"
+  owner "serverinfo"
+  group "serverinfo"
   notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
 end
 
-directory "/srv/hardware.openstreetmap.org/_site" do
-  mode "755"
-  owner "nobody"
-  group "nogroup"
-end
-
-directory "/srv/hardware.openstreetmap.org/vendor" do
-  action :create
-  owner "nobody"
-  group "nogroup"
-  notifies :run, "bundle_install[/srv/hardware.openstreetmap.org]", :immediately
-end
-
 bundle_config "/srv/hardware.openstreetmap.org" do
-  user "nobody"
-  group "nogroup"
+  action :create
+  user "serverinfo"
+  group "serverinfo"
   settings "deployment" => "true",
            "without" => "development:test",
            "jobs" => node.cpu_cores.to_s
+  notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
 end
 
 bundle_install "/srv/hardware.openstreetmap.org" do
   action :nothing
-  user "nobody"
-  group "nogroup"
+  user "serverinfo"
+  group "serverinfo"
   notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
 end
 
 bundle_exec "/srv/hardware.openstreetmap.org" do
   action :nothing
   command "jekyll build --trace --disable-disk-cache --baseurl=https://hardware.openstreetmap.org"
-  user "nobody"
-  group "nogroup"
+  user "serverinfo"
+  group "serverinfo"
   environment "LANG" => "C.UTF-8"
 end
 
diff --git a/test/data_bags/accounts/serverinfo.json b/test/data_bags/accounts/serverinfo.json
new file mode 100644 (file)
index 0000000..2b01af6
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "serverinfo",
+  "uid": "534",
+  "comment": "hardware.openstreetmap.org",
+  "manage_home": false
+}