Archive abandoned project
This commit is contained in:
parent
bc8862d90b
commit
65be894048
501 changed files with 24305 additions and 0 deletions
69
esh_photoprism/recipes/compose.rb
Normal file
69
esh_photoprism/recipes/compose.rb
Normal file
|
@ -0,0 +1,69 @@
|
|||
#
|
||||
# Cookbook:: esh_photoprism
|
||||
# Recipe:: compose
|
||||
#
|
||||
# Copyright:: 2022, https://easyself.host
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
directory '/opt/photoprism' do
|
||||
owner 'photoprism'
|
||||
group 'photoprism'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
template '/opt/photoprism/docker-compose.yml' do
|
||||
owner 'photoprism'
|
||||
group 'photoprism'
|
||||
mode '0400'
|
||||
variables environment: node['esh']['photoprism']['environment'],
|
||||
volumes: node['esh']['photoprism']['volumes'],
|
||||
mariadb_volumes: node['esh']['photoprism']['mariadb']['volumes'],
|
||||
mariadb_password: node['esh']['photoprism']['mariadb']['password'],
|
||||
mariadb_root_password: node['esh']['photoprism']['mariadb']['root_password']
|
||||
action :create
|
||||
end
|
||||
|
||||
execute 'docker compose pull' do
|
||||
command 'docker compose pull --quiet'
|
||||
cwd '/opt/photoprism'
|
||||
live_stream true
|
||||
action :run
|
||||
end
|
||||
|
||||
systemd_unit 'photoprism.service' do
|
||||
content <<~EOU
|
||||
[Unit]
|
||||
Description=photoprism via docker compose
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=true
|
||||
WorkingDirectory=/opt/photoprism
|
||||
ExecStart=/usr/bin/docker compose up --detach
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOU
|
||||
action [:create, :enable]
|
||||
subscribes :restart, 'template[/opt/photoprism/docker-compose.yml]', :delayed
|
||||
end
|
||||
|
||||
service 'photoprism' do
|
||||
action :nothing
|
||||
subscribes :start, 'execute[docker compose pull]', :delayed
|
||||
end
|
17
esh_photoprism/recipes/default.rb
Normal file
17
esh_photoprism/recipes/default.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# Cookbook:: esh_photoprism
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright:: 2022, https://easyself.host
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
40
esh_photoprism/recipes/docker.rb
Normal file
40
esh_photoprism/recipes/docker.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
# Cookbook:: esh_photoprism
|
||||
# Recipe:: docker
|
||||
#
|
||||
# Copyright:: 2022, https://easyself.host
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
image = node['esh']['photoprism']['docker']['image']
|
||||
repo = image.split('/', 2)[1]
|
||||
tag = node['esh']['photoprism']['docker']['tag']
|
||||
env = node['esh']['photoprism']['docker']['env']
|
||||
volumes = node['esh']['photoprism']['docker']['volumes']
|
||||
|
||||
docker_image image do
|
||||
tag tag
|
||||
action :pull
|
||||
end
|
||||
|
||||
docker_container 'photoprism' do
|
||||
repo repo
|
||||
tag tag
|
||||
port '2342:2342'
|
||||
env env
|
||||
user '998:998'
|
||||
working_dir '/photoprism'
|
||||
security_opt ['seccomp:unconfined', 'apparmor:unconfined']
|
||||
volumes volumes
|
||||
restart_policy 'unless-stopped'
|
||||
action [:create, :start]
|
||||
end
|
34
esh_photoprism/recipes/mariadb.rb
Normal file
34
esh_photoprism/recipes/mariadb.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# Cookbook:: esh_photoprism
|
||||
# Recipe:: mariadb
|
||||
#
|
||||
# Copyright:: 2022, https://easyself.host
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apt_package 'mariadb-server'
|
||||
|
||||
mariadb_server_install 'MariaDB Server install' do
|
||||
version '10.5'
|
||||
setup_repo false
|
||||
end
|
||||
|
||||
mariadb_user 'photoprism' do
|
||||
password node['esh']['photoprism']['mariadb']['password']
|
||||
database_name 'photoprism'
|
||||
action [:create, :grant]
|
||||
end
|
||||
|
||||
mariadb_database 'photoprism' do
|
||||
action :create
|
||||
end
|
44
esh_photoprism/recipes/system.rb
Normal file
44
esh_photoprism/recipes/system.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Cookbook:: esh_photoprism
|
||||
# Recipe:: system
|
||||
#
|
||||
# Copyright:: 2022, https://easyself.host
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
group 'photoprism' do
|
||||
system true
|
||||
gid 998
|
||||
action :create
|
||||
end
|
||||
|
||||
user 'photoprism' do
|
||||
comment 'photoprism system user'
|
||||
gid 998
|
||||
uid 998
|
||||
home '/home/photoprism'
|
||||
manage_home true
|
||||
shell '/usr/bin/bash'
|
||||
system true
|
||||
action :create
|
||||
end
|
||||
|
||||
%w(originals storage).each do |name|
|
||||
directory "/var/lib/#{node['hostname']}-#{name}" do
|
||||
owner 'photoprism'
|
||||
group 'photoprism'
|
||||
mode '0750'
|
||||
not_if { ::Dir.exist?("/var/lib/#{node['hostname']}-#{name}") }
|
||||
action :create
|
||||
end
|
||||
end
|
39
esh_photoprism/recipes/undocker.rb
Normal file
39
esh_photoprism/recipes/undocker.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# Cookbook:: esh_photoprism
|
||||
# Recipe:: undocker
|
||||
#
|
||||
# Copyright:: 2022, https://easyself.host
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
url = node['esh']['photoprism']['docker']['url']
|
||||
image = node['esh']['photoprism']['docker']['image']
|
||||
tag = node['esh']['photoprism']['docker']['tag']
|
||||
network = node['esh']['photoprism']['docker']['network']
|
||||
service = node['esh']['photoprism']['docker']['service']
|
||||
env = node['esh']['photoprism']['docker']['env']
|
||||
|
||||
esh_undocker_download url do
|
||||
image image
|
||||
tag tag
|
||||
end
|
||||
|
||||
esh_undocker_extract image do
|
||||
tag tag
|
||||
network network
|
||||
env env
|
||||
end
|
||||
|
||||
esh_undocker_service image do
|
||||
content service
|
||||
end
|
Reference in a new issue