takeltau 0.39.0 → 0.39.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/takeltau/default.yml +7 -6
- data/lib/takeltau/docker/container/cli.rb +2 -0
- data/lib/takeltau/docker/container/lib.rb +1 -3
- data/lib/takeltau/docker/image/cli.rb +1 -0
- data/lib/takeltau/docker/image/update.rb +6 -5
- data/lib/takeltau/init/packer/templates/playbooksiteyml.tt +1 -1
- data/lib/takeltau/mutagen/check/daemon.rb +11 -25
- data/lib/takeltau/mutagen/socket/cli.rb +13 -0
- data/lib/takeltau/mutagen/socket/create.rb +0 -2
- data/lib/takeltau/mutagen/socket/docker.rb +41 -0
- data/lib/takeltau/version +1 -1
- data/lib/takeltau.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d954acca5a410dcd961154463864bc7368752fcae20f2ef837a3a8de71cdce78
|
4
|
+
data.tar.gz: 51fdda97c3c74121a4b0c6e6302b75941304b2676c0f3fbaa11384c7fa292334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7c3d8d019d6d433d04f3ebe58edc227503b4212f19af3ebdf3cf155b26ac831f29a1d158314312f8490a2a41b58cd76de8d0df57e0de9e0ff62bcd393233c3b
|
7
|
+
data.tar.gz: ddbd01a435c6409566286153fc9feb11721eb743e7d1634011f3766c7f8342eba67c66ef3e546cdb2b52eaa0097410c26d8cf0c36fe94e940fef965ce9a52b1f
|
data/lib/takeltau/default.yml
CHANGED
@@ -4,7 +4,7 @@ cmd_docker_check_daemon_docker_info: 'docker info'
|
|
4
4
|
cmd_docker_container_check_existing_docker_ps: 'docker ps --filter name=^%{container}$ --quiet'
|
5
5
|
cmd_docker_container_check_network_docker_network: 'docker network ls --quiet --filter name=^%{network}$'
|
6
6
|
cmd_docker_container_check_orphaned_docker_exec: 'docker exec --interactive %{container} ps a'
|
7
|
-
cmd_docker_container_create: 'docker run --detach --env TAKELAGE_PROJECT_BASE_DIR=%{workdir} --env TZ=%{timezone} --hostname %{container} --name %{container} --network %{container} --rm --shm-size %{shmsize} --tty --volume %{
|
7
|
+
cmd_docker_container_create: 'docker run --detach --env TAKELAGE_PROJECT_BASE_DIR=%{workdir} --env TZ=%{timezone} --hostname %{container} --name %{container} --network %{container} --rm --shm-size %{shmsize} --tty --volume %{homedir}:/hostdir --volume %{workdir}:/project %{volume_dev} --workdir /project %{docker_run_options} %{image} %{entrypoint} --gid %{gid} --home %{homedir} --uid %{uid} --username %{username} --extra=%{extra} %{entrypoint_options}'
|
8
8
|
cmd_docker_container_create_network: 'docker network create %{network}'
|
9
9
|
cmd_docker_container_enter_container: 'docker exec --interactive --tty %{container} %{loginpoint} --username %{username}'
|
10
10
|
cmd_docker_container_get_container_name: 'docker ps --filter id=%{container} --format "{{.Names}}"'
|
@@ -14,7 +14,7 @@ cmd_docker_container_docker_exec: 'docker exec %{container} su %{username} -c "L
|
|
14
14
|
cmd_docker_container_stop_container: 'docker stop %{container}'
|
15
15
|
cmd_docker_image_tag_check_docker_images: 'docker images --quiet %{image}'
|
16
16
|
cmd_docker_image_tag_list_docker_images: 'docker images %{docker_user}\/%{docker_repo} --format "{{.Tag}}"'
|
17
|
-
|
17
|
+
cmd_docker_image_update_docker_pull: 'docker pull %{docker_user}/%{docker_repo}:%{docker_tag}'
|
18
18
|
cmd_docker_image_update_docker_remove_dangling: 'docker image prune --force'
|
19
19
|
cmd_git: 'git'
|
20
20
|
cmd_git_check_clean_git_unstaged: 'git diff --exit-code'
|
@@ -46,13 +46,13 @@ cmd_init_lib_git_commit_initial: 'git commit -m "Initial commit"'
|
|
46
46
|
cmd_init_lib_hg_clone: 'bash hgclone'
|
47
47
|
cmd_mutagen: 'mutagen'
|
48
48
|
cmd_mutagen_check_daemon_host_connection: 'mutagen forward list --label-selector="%{hostlabel}"'
|
49
|
-
cmd_mutagen_check_daemon_version: 'mutagen version'
|
50
49
|
cmd_mutagen_forward_socket_create: 'mutagen forward create --name=%{socketname} --label=%{hostlabel} --label=%{takellabel} docker://%{username}@%{container}:unix:%{containersock} unix:%{hostsock}'
|
50
|
+
cmd_mutagen_forward_socket_docker: 'mutagen forward create --name=%{socketname} --label=%{hostlabel} --label=%{takellabel} --socket-group-source=docker --socket-permission-mode=0660 docker://root@%{container}:unix:/var/run/docker.sock unix:%{hostsock}'
|
51
51
|
cmd_mutagen_forward_socket_check: 'mutagen forward list %{socketname}'
|
52
52
|
cmd_mutagen_forward_socket_terminate: 'mutagen forward terminate %{socketname}'
|
53
53
|
cmd_mutagen_forward_socket_remove: 'rm -f ~/.mutagen/daemon/*'
|
54
54
|
cmd_mutagen_forward_socket_list: 'mutagen forward list --label-selector="%{takellabel}"'
|
55
|
-
docker_debug: 'ansible/roles/
|
55
|
+
docker_debug: 'ansible/roles/takel_takelage/files/takelscripts'
|
56
56
|
docker_entrypoint_extra: '.config/gcloud'
|
57
57
|
docker_entrypoint_options: ''
|
58
58
|
docker_registry: 'https://registry.hub.docker.com'
|
@@ -65,10 +65,11 @@ git_hg_branch: 'main'
|
|
65
65
|
info_project_main: 'project.yml'
|
66
66
|
info_project_private: 'private/project.yml'
|
67
67
|
login_wait_for_sockets: '0'
|
68
|
-
|
69
|
-
mutagen_socket_path_mutagen_host: '~/.mutagen/daemon/daemon.sock'
|
68
|
+
mutagen_socket_path_docker_host: '/var/run/docker.sock'
|
70
69
|
mutagen_socket_path_gpg_container: '~/.gnupg/S.gpg-agent'
|
71
70
|
mutagen_socket_path_gpg_host: '~/.gnupg/S.gpg-agent'
|
71
|
+
mutagen_socket_path_mutagen_container: '~/.mutagen/daemon/daemon.sock'
|
72
|
+
mutagen_socket_path_mutagen_host: '~/.mutagen/daemon/daemon.sock'
|
72
73
|
mutagen_socket_path_ssh_container: '~/.gnupg/S.gpg-agent.ssh'
|
73
74
|
mutagen_socket_path_ssh_host: '~/.gnupg/S.gpg-agent.ssh'
|
74
75
|
mutagen_socket_takelage_label: 'type=takelage'
|
@@ -22,6 +22,7 @@ module Takeltau
|
|
22
22
|
include MutagenCheckDaemon
|
23
23
|
include MutagenSocketCheck
|
24
24
|
include MutagenSocketCreate
|
25
|
+
include MutagenSocketDocker
|
25
26
|
include MutagenSocketTerminate
|
26
27
|
|
27
28
|
# Initialize docker container
|
@@ -40,6 +41,7 @@ module Takeltau
|
|
40
41
|
@hostname = _docker_container_lib_hostname
|
41
42
|
@hostlabel = "hostname=#{@hostname}"
|
42
43
|
@takellabel = config.active['mutagen_socket_takelage_label']
|
44
|
+
@dockersock_host = config.active['mutagen_socket_path_docker_host']
|
43
45
|
@mutagensock_container = config.active['mutagen_socket_path_mutagen_container']
|
44
46
|
@mutagensock_host = config.active['mutagen_socket_path_mutagen_host']
|
45
47
|
@gpgsock_container = config.active['mutagen_socket_path_gpg_container']
|
@@ -8,8 +8,7 @@ module DockerContainerLib
|
|
8
8
|
|
9
9
|
# Create mutagen sockets
|
10
10
|
def _docker_container_lib_start_sockets
|
11
|
-
|
12
|
-
|
11
|
+
mutagen_socket_docker @dockersock_host
|
13
12
|
mutagen_socket_create 'mutagen', @mutagensock_container, @mutagensock_host
|
14
13
|
mutagen_socket_create 'gpg', @gpgsock_container, @gpgsock_host
|
15
14
|
mutagen_socket_create 'ssh', @sshsock_container, @sshsock_host
|
@@ -91,7 +90,6 @@ module DockerContainerLib
|
|
91
90
|
config.active['cmd_docker_container_create'],
|
92
91
|
container: container,
|
93
92
|
docker_run_options: config.active['docker_run_options'],
|
94
|
-
dockersock: '/var/run/docker.sock',
|
95
93
|
entrypoint: entrypoint,
|
96
94
|
entrypoint_options: config.active['docker_entrypoint_options'],
|
97
95
|
extra: config.active['docker_entrypoint_extra'],
|
@@ -6,22 +6,23 @@ module DockerImageUpdate
|
|
6
6
|
def docker_image_update
|
7
7
|
return false unless docker_check_daemon
|
8
8
|
|
9
|
-
|
9
|
+
cmd_docker_pull = _docker_image_update_cmd_docker_pull
|
10
10
|
|
11
11
|
cmd_docker_remove_dangling =
|
12
12
|
config.active['cmd_docker_image_update_docker_remove_dangling']
|
13
13
|
|
14
|
-
run_and_exit "#{
|
14
|
+
run_and_exit "#{cmd_docker_pull} && #{cmd_docker_remove_dangling}"
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
19
|
# Prepare dpcker pull latest command.
|
20
|
-
def
|
20
|
+
def _docker_image_update_cmd_docker_pull
|
21
21
|
format(
|
22
|
-
config.active['
|
22
|
+
config.active['cmd_docker_image_update_docker_pull'],
|
23
23
|
docker_user: @docker_user,
|
24
|
-
docker_repo: @docker_repo
|
24
|
+
docker_repo: @docker_repo,
|
25
|
+
docker_tag: @docker_tag
|
25
26
|
)
|
26
27
|
end
|
27
28
|
end
|
@@ -5,17 +5,18 @@ module MutagenCheckDaemon
|
|
5
5
|
# Backend method for mutagen check daemon.
|
6
6
|
# @return [Boolean] is mutagen available?
|
7
7
|
# rubocop:disable Metrics/MethodLength
|
8
|
+
# rubocop:disable Metrics/AbcSize
|
8
9
|
def mutagen_check_daemon
|
9
10
|
return true if @mutagen_daemon_available
|
10
11
|
|
11
12
|
log.debug 'Check mutagen status'
|
12
13
|
|
13
|
-
return false unless
|
14
|
+
return false unless command_available_else_error? config.active['cmd_mutagen']
|
14
15
|
|
15
|
-
# are we
|
16
|
+
# are we inside a takelage container?
|
16
17
|
unless _docker_container_lib_check_matrjoschka
|
17
|
-
unless
|
18
|
-
log.error 'The mutagen
|
18
|
+
unless _file_exists? config.active['mutagen_socket_path_mutagen_host']
|
19
|
+
log.error 'The mutagen socket path on the host is not available'
|
19
20
|
return false
|
20
21
|
end
|
21
22
|
|
@@ -24,6 +25,11 @@ module MutagenCheckDaemon
|
|
24
25
|
return true
|
25
26
|
end
|
26
27
|
|
28
|
+
unless _file_exists? config.active['mutagen_socket_path_mutagen_container']
|
29
|
+
log.error 'The mutagen socket path in the container is not available'
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
|
27
33
|
unless _mutagen_check_daemon_host_connection
|
28
34
|
log.error 'A mutagen host connection is not available'
|
29
35
|
return false
|
@@ -33,25 +39,11 @@ module MutagenCheckDaemon
|
|
33
39
|
@mutagen_daemon_available = true
|
34
40
|
true
|
35
41
|
end
|
42
|
+
# rubocop:enable Metrics/AbcSize
|
36
43
|
# rubocop:enable Metrics/MethodLength
|
37
44
|
|
38
45
|
private
|
39
46
|
|
40
|
-
# Check mutagen prerequisites
|
41
|
-
def _mutagen_check_check_prerequisites
|
42
|
-
unless _file_exists? config.active['mutagen_socket_path_mutagen_container']
|
43
|
-
log.error 'The mutagen socket path in the container is not available'
|
44
|
-
return false
|
45
|
-
end
|
46
|
-
|
47
|
-
unless _file_exists? config.active['mutagen_socket_path_mutagen_host']
|
48
|
-
log.error 'The mutagen socket path on the host is not available'
|
49
|
-
return false
|
50
|
-
end
|
51
|
-
|
52
|
-
command_available_else_error? config.active['cmd_mutagen']
|
53
|
-
end
|
54
|
-
|
55
47
|
# Check mutagen host connection
|
56
48
|
# rubocop:disable Metrics/MethodLength
|
57
49
|
def _mutagen_check_daemon_host_connection
|
@@ -75,10 +67,4 @@ module MutagenCheckDaemon
|
|
75
67
|
true
|
76
68
|
end
|
77
69
|
# rubocop:enable Metrics/MethodLength
|
78
|
-
|
79
|
-
# Check mutagen version
|
80
|
-
def _mutagen_check_daemon_version
|
81
|
-
version = try config.active['cmd_mutagen_check_daemon_version']
|
82
|
-
version.exitstatus.zero?
|
83
|
-
end
|
84
70
|
end
|
@@ -17,6 +17,7 @@ module Takeltau
|
|
17
17
|
include MutagenCheckDaemon
|
18
18
|
include MutagenSocketCheck
|
19
19
|
include MutagenSocketCreate
|
20
|
+
include MutagenSocketDocker
|
20
21
|
include MutagenSocketList
|
21
22
|
include MutagenSocketTidy
|
22
23
|
include MutagenSocketTerminate
|
@@ -61,6 +62,18 @@ module Takeltau
|
|
61
62
|
exit mutagen_socket_create name, containersock, hostsock
|
62
63
|
end
|
63
64
|
|
65
|
+
#
|
66
|
+
# mutagen socket create
|
67
|
+
#
|
68
|
+
desc 'docker [OUT]', 'Create a mutagen docker socket [OUT] of the container'
|
69
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
70
|
+
Create a mutagen docker socket [OUT] of the container
|
71
|
+
LONGDESC
|
72
|
+
# Create a mutagen docker socket [OUT] of the container.
|
73
|
+
def docker(hostsock)
|
74
|
+
exit mutagen_socket_docker hostsock
|
75
|
+
end
|
76
|
+
|
64
77
|
#
|
65
78
|
# mutagen socket list
|
66
79
|
#
|
@@ -10,8 +10,6 @@ module MutagenSocketCreate
|
|
10
10
|
log.debug "Create the mutagen socket \"#{socketname}\" in the container " \
|
11
11
|
"at \"#{containersock}\" pointing to the host at \"#{hostsock}\""
|
12
12
|
|
13
|
-
return false unless mutagen_check_daemon
|
14
|
-
|
15
13
|
return false if mutagen_socket_check socketname
|
16
14
|
|
17
15
|
socket_created = _mutagen_socket_create_socket(socketname, containersock, hostsock)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# tau mutagen socket docker
|
4
|
+
module MutagenSocketDocker
|
5
|
+
# Backend method for mutagen socket docker.
|
6
|
+
# rubocop:disable Metrics/MethodLength
|
7
|
+
def mutagen_socket_docker(hostsock)
|
8
|
+
# See DockerContainerLib::_docker_container_lib_hostname
|
9
|
+
socketname = "#{@hostname[-11..-1]}-docker"
|
10
|
+
log.debug "Create the mutagen docker socket \"#{socketname}\" in the container " \
|
11
|
+
"pointing to the host at \"#{hostsock}\""
|
12
|
+
|
13
|
+
return false if mutagen_socket_check socketname
|
14
|
+
|
15
|
+
socket_created = _mutagen_socket_docker_socket(socketname, hostsock)
|
16
|
+
|
17
|
+
unless socket_created.include? 'Created session'
|
18
|
+
log.debug "Unable to create mutagen docker socket \"#{socketname}\""
|
19
|
+
return false
|
20
|
+
end
|
21
|
+
|
22
|
+
log.debug "Created the mutagen docker socket \"#{socketname}\""
|
23
|
+
true
|
24
|
+
end
|
25
|
+
# rubocop:enable Metrics/MethodLength
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Get git branch.
|
30
|
+
def _mutagen_socket_docker_socket(socketname, hostsock)
|
31
|
+
cmd_create_socket = format(
|
32
|
+
config.active['cmd_mutagen_forward_socket_docker'],
|
33
|
+
socketname: socketname,
|
34
|
+
hostsock: hostsock,
|
35
|
+
container: @hostname,
|
36
|
+
hostlabel: @hostlabel,
|
37
|
+
takellabel: @takellabel
|
38
|
+
)
|
39
|
+
run cmd_create_socket
|
40
|
+
end
|
41
|
+
end
|
data/lib/takeltau/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.39.
|
1
|
+
0.39.16
|
data/lib/takeltau.rb
CHANGED
@@ -40,6 +40,7 @@ require_relative 'takeltau/init/cli'
|
|
40
40
|
require_relative 'takeltau/mutagen/check/daemon'
|
41
41
|
require_relative 'takeltau/mutagen/socket/check'
|
42
42
|
require_relative 'takeltau/mutagen/socket/create'
|
43
|
+
require_relative 'takeltau/mutagen/socket/docker'
|
43
44
|
require_relative 'takeltau/mutagen/socket/terminate'
|
44
45
|
require_relative 'takeltau/mutagen/socket/tidy'
|
45
46
|
require_relative 'takeltau/docker/check/daemon'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: takeltau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.39.
|
4
|
+
version: 0.39.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takelwerk
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- lib/takeltau/mutagen/socket/check.rb
|
273
273
|
- lib/takeltau/mutagen/socket/cli.rb
|
274
274
|
- lib/takeltau/mutagen/socket/create.rb
|
275
|
+
- lib/takeltau/mutagen/socket/docker.rb
|
275
276
|
- lib/takeltau/mutagen/socket/list.rb
|
276
277
|
- lib/takeltau/mutagen/socket/terminate.rb
|
277
278
|
- lib/takeltau/mutagen/socket/tidy.rb
|