takeltau 0.44.14 → 0.44.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -26
- data/lib/takeltau/default.yml +5 -3
- data/lib/takeltau/docker/check/daemon.rb +0 -2
- data/lib/takeltau/docker/container/cli.rb +0 -2
- data/lib/takeltau/docker/container/lib.rb +0 -2
- data/lib/takeltau/docker/container/list.rb +0 -4
- data/lib/takeltau/docker/image/tag/check.rb +0 -2
- data/lib/takeltau/git/lib.rb +0 -2
- data/lib/takeltau/info/status/bar.rb +0 -2
- data/lib/takeltau/info/status/gopass.rb +0 -2
- data/lib/takeltau/info/status/gpg.rb +0 -2
- data/lib/takeltau/info/status/ssh.rb +0 -2
- data/lib/takeltau/init/takelage/cli.rb +0 -2
- data/lib/takeltau/lib/config.rb +1 -9
- data/lib/takeltau/lib/system.rb +35 -25
- data/lib/takeltau/mutagen/check/daemon.rb +0 -4
- data/lib/takeltau/mutagen/socket/create.rb +0 -4
- data/lib/takeltau/mutagen/socket/docker.rb +0 -2
- data/lib/takeltau/ship/cli.rb +19 -19
- data/lib/takeltau/ship/container/clean.rb +0 -2
- data/lib/takeltau/ship/container/cli.rb +14 -0
- data/lib/takeltau/ship/container/lib.rb +10 -3
- data/lib/takeltau/ship/container/logs.rb +29 -0
- data/lib/takeltau/ship/ports/lib.rb +0 -6
- data/lib/takeltau/ship/project/cli.rb +27 -12
- data/lib/takeltau/ship/project/create.rb +21 -0
- data/lib/takeltau/ship/project/start.rb +0 -12
- data/lib/takeltau/version +1 -1
- data/lib/takeltau.rb +2 -1
- metadata +3 -2
- data/lib/takeltau/ship/project/logs.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2bf72dba1a70d249a5b716a7e35489df7a27eee29371a2c02e232ad2fb6b825
|
4
|
+
data.tar.gz: cfe4d2c9092835f058934b24b7ebc231472be53b5e0f710f343a6703f879743b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c1379e557d982bf0f4b95a02e06f7f513746177b686b4e55cc0f0d9fcd89a53c031f6de4d07ba9eda568e41d8d1a84783f0063a9d92a30a8f5f5d9fcc89a65a
|
7
|
+
data.tar.gz: b2371e261a20852f750e9ac2613c971e53d9aa79d88a9af4b224474894f3cb566250980bb7a0c7a9638920f298af701ac4d4aee8dea372183febabb66fa7ebb8
|
data/README.md
CHANGED
@@ -67,14 +67,14 @@ You can list the *tau* commands by running
|
|
67
67
|
or *tau commands*:
|
68
68
|
|
69
69
|
Command | Description
|
70
|
-
|
70
|
+
- |-
|
71
71
|
tau [completion bash](features/cucumber/features/completion/completion.bash.feature) | Print bash completion code
|
72
72
|
tau [docker check daemon](features/cucumber/features/docker/docker.check.daemon.feature) | Check if docker daemon is running
|
73
73
|
tau [docker container check existing](features/cucumber/features/docker/docker.container.check.existing.feature) [CONTAINER] | Check if docker [CONTAINER] is existing
|
74
74
|
tau [docker container check network](features/cucumber/features/docker/docker.container.check.network.feature) [NETWORK] | Check if docker [NETWORK] is existing
|
75
75
|
tau [docker container check orphaned](features/cucumber/features/docker/docker.container.check.orphaned.feature) [CONTAINER] | Check if docker [CONTAINER] is orphaned
|
76
76
|
tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature) | Remove all docker containers
|
77
|
-
tau [docker container command](features/cucumber/features/docker/docker.container.command.feature) [CMD] | Run [CMD] in a docker container
|
77
|
+
tau [docker container command](features/cucumber/features/docker/docker.container.command.feature) [CMD] | Run [CMD] in a docker container
|
78
78
|
tau [docker container daemon](features/cucumber/features/docker/docker.container.daemon.feature) | Run docker container in daemon mode
|
79
79
|
tau [docker container list](features/cucumber/features/docker/docker.container.list.feature) | List docker containers
|
80
80
|
tau [docker container login](features/cucumber/features/docker/docker.container.login.feature) | Log in to latest local docker container
|
@@ -82,23 +82,23 @@ tau [docker container prune](features/cucumber/features/docker/docker.container.
|
|
82
82
|
tau [docker image tag check](features/cucumber/features/docker/docker.image.tag.check.feature) [TAG] | Check if local docker image [TAG] exists
|
83
83
|
tau [docker image tag latest](features/cucumber/features/docker/docker.image.tag.latest.feature) | Print latest local docker image tag
|
84
84
|
tau [docker image tag list](features/cucumber/features/docker/docker.image.tag.list.feature) | Print local docker image tags
|
85
|
-
tau [docker image update](features/cucumber/features/docker/docker.image.update.feature) | Get latest remote docker container
|
85
|
+
tau [docker image update](features/cucumber/features/docker/docker.image.update.feature) | Get latest remote docker container
|
86
86
|
tau [git check clean](features/cucumber/features/git/git.check.clean.feature) | Check if the git workspace is clean
|
87
87
|
tau [git check hg](features/cucumber/features/git/git.check.hg.feature) | Check if we are on the git hg branch
|
88
|
-
tau [git check workspace](features/cucumber/features/git/git.check.workspace.feature) | Check if a git workspace exists
|
88
|
+
tau [git check workspace](features/cucumber/features/git/git.check.workspace.feature) | Check if a git workspace exists
|
89
89
|
tau [hg list](features/cucumber/features/hg/hg.list.feature) | List hg repos
|
90
90
|
tau [hg pull](features/cucumber/features/hg/hg.pull.feature) | Pull hg repos
|
91
91
|
tau [hg push](features/cucumber/features/hg/hg.push.feature) | Push hg repos
|
92
92
|
tau [info project active](features/cucumber/features/info/info.project.active.feature) | Print active project info
|
93
93
|
tau [info project dir](features/cucumber/features/info/info.project.dir.feature) | Print project root directory
|
94
|
-
tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
|
94
|
+
tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
|
95
95
|
tau [info project private](features/cucumber/features/info/info.project.private.feature) | Print private project info
|
96
96
|
tau [info status bar](features/cucumber/features/info/info.status.bar.feature) | Print status bar
|
97
97
|
tau [info status arch](features/cucumber/features/info/info.status.arch.feature) | Check arch status
|
98
98
|
tau [info status git](features/cucumber/features/info/info.status.git.feature) | Check git status
|
99
99
|
tau [info status gopass](features/cucumber/features/info/info.status.gopass.feature) | Check gopass status
|
100
100
|
tau [info status gpg](features/cucumber/features/info/info.status.gpg.feature) | Check gpg status
|
101
|
-
tau [info status hg](features/cucumber/features/info/info.status.hg.feature) | Check hg status
|
101
|
+
tau [info status hg](features/cucumber/features/info/info.status.hg.feature) | Check hg status
|
102
102
|
tau [info status mutagen](features/cucumber/features/info/info.status.mutagen.feature) | Check mutagen status
|
103
103
|
tau [info status ssh](features/cucumber/features/info/info.status.ssh.feature) | Check ssh status
|
104
104
|
tau [init packer docker](features/cucumber/features/init/init.packer.docker.feature) | Initialize packer project for docker images
|
@@ -108,34 +108,36 @@ tau [mutagen socket check](features/cucumber/features/mutagen/mutagen.socket.che
|
|
108
108
|
tau [mutagen socket create](features/cucumber/features/mutagen/mutagen.socket.create.feature) [NAME] [IN] [OUT] | Create a mutagen socket [NAME] from [IN] to [OUT] of the container
|
109
109
|
tau [mutagen socket list](features/cucumber/features/mutagen/mutagen.socket.list.feature) | List mutagen sockets
|
110
110
|
tau [mutagen socket terminate](features/cucumber/features/mutagen/mutagen.socket.terminate.feature) [SOCKET] | Terminate a mutagen [SOCKET]
|
111
|
-
tau [mutagen socket tidy](features/cucumber/features/mutagen/mutagen.socket.tidy.feature) | Remove mutagen daemon files
|
111
|
+
tau [mutagen socket tidy](features/cucumber/features/mutagen/mutagen.socket.tidy.feature) | Remove mutagen daemon files
|
112
112
|
tau [self commands](features/cucumber/features/self/self.commands.feature) | List all commands
|
113
113
|
tau [self config active](features/cucumber/features/self/self.config.active.feature) | Print active takelage configuration
|
114
114
|
tau [self config default](features/cucumber/features/self/self.config.default.feature) | Print takelage default configuration
|
115
115
|
tau [self config home](features/cucumber/features/self/self.config.home.feature) | Print takelage home config file configuration
|
116
116
|
tau [self config project](features/cucumber/features/self/self.config.project.feature) | Print takelage project config file configuration
|
117
117
|
tau [self version](features/cucumber/features/self/self.version.feature) | Print tau semantic version number
|
118
|
-
tau [ship completion bash](features/cucumber/features/ship/completion/completion.bash.feature) | Print bash completion code for ship subcommand
|
118
|
+
tau [ship completion bash](features/cucumber/features/ship/completion/completion.bash.feature) | Print bash completion code for ship subcommand
|
119
119
|
tau [ship container check existing](features/cucumber/features/ship/container/ship.container.check.existing.feature) | Check if a takelship is existing
|
120
120
|
tau [ship container clean](features/cucumber/features/ship/container/ship.container.clean.feature) | Stop all takelships
|
121
121
|
tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) [COMMAND] | Run a [COMMAND] in a takelship container
|
122
|
-
tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) | List takelships
|
122
|
+
tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) | List takelships
|
123
123
|
tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature) | Log in to a takelship
|
124
|
+
tau [ship container logs](features/cucumber/features/ship/container/ship.container.logs.feature) | Print the takelship logs
|
124
125
|
tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) [COMMAND] | Run a podman [COMMAND] in a takelship
|
125
126
|
tau [ship container stop](features/cucumber/features/ship/container/ship.container.stop.feature) | Stop a takelship
|
126
127
|
tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) [COMMAND] | Run a sudo [COMMAND] in a takelship
|
127
128
|
tau [ship container update](features/cucumber/features/ship/container/ship.container.update.feature) | Update takelship image
|
128
129
|
tau [ship info takelconfig](features/cucumber/features/ship/info/ship.info.takelconfig.feature) | Print takelage config
|
129
130
|
tau [ship info takelship](features/cucumber/features/ship/info/ship.info.takelship.feature) | Print takelship info
|
130
|
-
tau [ship project
|
131
|
-
tau [ship project
|
132
|
-
tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature) [PROJECT] | Start a takelship [PROJECT]
|
131
|
+
tau [ship project create](features/cucumber/features/ship/project/ship.project.create.feature) [PROJECT] | Create a takelship [PROJECT]
|
132
|
+
tau [ship project list](features/cucumber/features/ship/project/ship.project.list.feature) | List takelship projects
|
133
|
+
tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature) [PROJECT] | Start a takelship [PROJECT]
|
133
134
|
tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature) | Stop a takelship project
|
134
|
-
tau
|
135
|
+
tau [ship project update](features/cucumber/features/ship/project/ship.project.create.feature) [PROJECT] | Update a takelship [PROJECT]
|
136
|
+
tau ship board | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature)
|
135
137
|
tau ship command [COMMAND] | Alias for tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature)
|
136
138
|
tau ship list | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature)
|
137
|
-
tau ship login | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature)
|
138
|
-
tau ship logs
|
139
|
+
tau ship login | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature)
|
140
|
+
tau ship logs | Alias for [tau ship container logs](features/cucumber/features/ship/container/ship.container.logs.feature)
|
139
141
|
tau ship ls | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature)
|
140
142
|
tau ship podman [COMMAND] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature)
|
141
143
|
tau ship sail [PROJECT] | Alias for tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature)
|
@@ -144,17 +146,17 @@ tau ship stop | Alias for tau [ship project stop](features/cucumber/features/shi
|
|
144
146
|
tau ship sudo [COMMAND] | Alias for tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature)
|
145
147
|
tau ship wreck | Alias for tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature)
|
146
148
|
tau ship update | Alias for tau [ship container update](features/cucumber/features/ship/container/ship.container.update.feature)
|
147
|
-
tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
|
149
|
+
tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
|
148
150
|
tau commands | Alias for tau [self commands](features/cucumber/features/self/self.commands.feature)
|
149
151
|
tau config | Alias for tau [self config active](features/cucumber/features/self/self.config.active.feature)
|
150
152
|
tau list | Alias for tau [docker container list](features/cucumber/features/docker/docker.container.list.feature)
|
151
153
|
tau ls | Alias for tau [docker container list](features/cucumber/features/docker/docker.container.list.feature)
|
152
|
-
tau login | Alias for tau [docker container login](features/cucumber/features/docker/docker.container.login.feature)
|
154
|
+
tau login | Alias for tau [docker container login](features/cucumber/features/docker/docker.container.login.feature)
|
153
155
|
tau project | Alias for tau [info project active](features/cucumber/features/info/info.project.active.feature)
|
154
|
-
tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
|
156
|
+
tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
|
155
157
|
tau status | Alias for tau [docker info status bar](features/cucumber/features/info/info.status.bar.feature)
|
156
158
|
tau update | Alias for tau [docker image update](features/cucumber/features/docker/docker.image.update.feature)
|
157
|
-
tau version | Alias for tau [self version](features/cucumber/features/self/self.version.feature)
|
159
|
+
tau version | Alias for tau [self version](features/cucumber/features/self/self.version.feature)
|
158
160
|
|
159
161
|
**Warning: *tau update* will call *docker image prune* and remove all dangling images!**
|
160
162
|
|
@@ -170,9 +172,9 @@ or *tau config*.
|
|
170
172
|
|
171
173
|
| Filename | Precedence | Description |
|
172
174
|
|-|-|-|
|
173
|
-
| *default.yml* | lowest | Shipped with *takelage-cli*. Sets defaults where applicable
|
174
|
-
| *~/.takelage.yml* | normal | User-wide configuration file in your home directory. This is your normal custom configuration file
|
175
|
-
| *takelage.yml* | highest | Project-specific configuration file next to your main Rakefile. Some projects need special configuration
|
175
|
+
| *default.yml* | lowest | Shipped with *takelage-cli*. Sets defaults where applicable.|
|
176
|
+
| *~/.takelage.yml* | normal | User-wide configuration file in your home directory. This is your normal custom configuration file.|
|
177
|
+
| *takelage.yml* | highest | Project-specific configuration file next to your main Rakefile. Some projects need special configuration.|
|
176
178
|
| TAKELAGE_TAU_CONFIG_* | ultimate | Fileless configuration through TAKELAGE_TAU_CONFIG environment variables. |
|
177
179
|
|
178
180
|
The tau command line tool is directory-aware so it is important that you can set the working directory of the tau command.
|
@@ -238,7 +240,7 @@ or *tau project*.
|
|
238
240
|
|
239
241
|
| Default filename | Config key | Precedence | Description |
|
240
242
|
| -------- | ---------- | ---------- | ----------- |
|
241
|
-
| *project.yml* | info_project_main | normal | Main project file
|
243
|
+
| *project.yml* | info_project_main | normal | Main project file.|
|
242
244
|
| *private/project.yml* | info_project_private | highest | Private project file. Should be in *.gitignore*. |
|
243
245
|
|
244
246
|
### Bash Completion
|
@@ -270,8 +272,8 @@ You need to whitelist it in your host's docker engine configuration:
|
|
270
272
|
|
271
273
|
```json
|
272
274
|
{
|
273
|
-
|
274
|
-
|
275
|
-
|
275
|
+
"insecure-registries": [
|
276
|
+
"host.docker.internal:5005"
|
277
|
+
]
|
276
278
|
}
|
277
279
|
```
|
data/lib/takeltau/default.yml
CHANGED
@@ -58,12 +58,12 @@ cmd_mutagen_forward_socket_list: 'mutagen forward list --label-selector="%{takel
|
|
58
58
|
cmd_mutagen_forward_socket_remove: 'rm -f ~/.mutagen/daemon/*'
|
59
59
|
cmd_mutagen_forward_socket_terminate: 'mutagen forward terminate %{socketname}'
|
60
60
|
cmd_ship_container_docker: '%{ship_docker} exec --interactive %{tty} %{ship_hostname} %{command}'
|
61
|
+
cmd_ship_container_logs: '%{ship_docker} logs %{ship_hostname} %{args}'
|
61
62
|
cmd_ship_container_login: 'bash'
|
62
63
|
cmd_ship_docker: 'docker'
|
63
64
|
cmd_ship_docker_check: 'docker --version'
|
64
|
-
|
65
|
-
|
66
|
-
cmd_ship_project_start_docker_run_privileged: '%{ship_docker} run --privileged --rm --detach --name %{ship_hostname} --hostname %{ship_hostname} %{ship_env} %{ports} --volume ./%{ship_data_dir}:/home/podman/takelship %{image} %{command}'
|
65
|
+
cmd_ship_project_start_docker_run_nonprivileged: '%{ship_docker} run --rm --interactive %{ship_run_args_nonprivileged} %{image} %{command}'
|
66
|
+
cmd_ship_project_start_docker_run_privileged: '%{ship_docker} run --privileged --rm --detach --name %{ship_hostname} --hostname %{ship_hostname} %{ship_env} %{ports} --volume %{project_root_dir}/%{ship_data_dir}:/home/podman/takelship %{ship_run_args_privileged} %{image} %{command}'
|
67
67
|
cmd_ship_project_start_docker_stop: '%{ship_docker} stop %{ship_hostname}'
|
68
68
|
docker_container_check_matrjoschka: 'true'
|
69
69
|
docker_debug: 'ansible/roles/takel_takelage/files/takelscripts'
|
@@ -98,6 +98,8 @@ ship_name: 'takelship'
|
|
98
98
|
ship_podman_localhost: '127.0.0.1'
|
99
99
|
ship_port_expose_podman_socket: 'false'
|
100
100
|
ship_repo: 'takelship'
|
101
|
+
ship_run_args_nonprivileged: ''
|
102
|
+
ship_run_args_privileged: ''
|
101
103
|
ship_tag: 'latest'
|
102
104
|
ship_takelship_yml: '%{pwd}/%{ship_data_dir}/compose/takelship.yml'
|
103
105
|
ship_user: 'takelwerk'
|
@@ -4,7 +4,6 @@
|
|
4
4
|
module DockerCheckDaemon
|
5
5
|
# Backend method for docker check daemon.
|
6
6
|
# @return [Boolean] is the docker daemon running?
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
7
|
# rubocop:disable Metrics/AbcSize
|
9
8
|
def docker_check_daemon(docker = 'cmd_docker', docker_check = 'cmd_docker_check')
|
10
9
|
return false unless command_available_else_error? config.active[docker_check]
|
@@ -25,5 +24,4 @@ module DockerCheckDaemon
|
|
25
24
|
true
|
26
25
|
end
|
27
26
|
# rubocop:enable Metrics/AbcSize
|
28
|
-
# rubocop:enable Metrics/MethodLength
|
29
27
|
end
|
@@ -28,7 +28,6 @@ module Takeltau
|
|
28
28
|
|
29
29
|
# Initialize docker container
|
30
30
|
# rubocop:disable Metrics/AbcSize
|
31
|
-
# rubocop:disable Metrics/MethodLength
|
32
31
|
def initialize(args = [], local_options = {}, configuration = {})
|
33
32
|
# initialize thor parent class
|
34
33
|
super args, local_options, configuration
|
@@ -50,7 +49,6 @@ module Takeltau
|
|
50
49
|
@sshsock_container = config.active['mutagen_socket_path_ssh_container']
|
51
50
|
@sshsock_host = config.active['mutagen_socket_path_ssh_host']
|
52
51
|
end
|
53
|
-
# rubocop:enable Metrics/MethodLength
|
54
52
|
# rubocop:enable Metrics/AbcSize
|
55
53
|
|
56
54
|
desc 'check [COMMAND]', 'Check docker container'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# tau docker container lib
|
4
|
-
# rubocop:disable Metrics/ModuleLength
|
5
4
|
# rubocop:disable Style/IfUnlessModifier
|
6
5
|
module DockerContainerLib
|
7
6
|
private
|
@@ -201,4 +200,3 @@ module DockerContainerLib
|
|
201
200
|
end
|
202
201
|
end
|
203
202
|
# rubocop:enable Style/IfUnlessModifier
|
204
|
-
# rubocop:enable Metrics/ModuleLength
|
@@ -12,8 +12,6 @@ module DockerContainerList
|
|
12
12
|
private
|
13
13
|
|
14
14
|
# Get the current inventory
|
15
|
-
# rubocop:disable Metrics/AbcSize
|
16
|
-
# rubocop:disable Metrics/MethodLength
|
17
15
|
def _docker_container_list_get_inventory
|
18
16
|
destination = '/project'
|
19
17
|
docker = config.active['cmd_docker']
|
@@ -29,8 +27,6 @@ module DockerContainerList
|
|
29
27
|
end
|
30
28
|
inventory
|
31
29
|
end
|
32
|
-
# rubocop:enable Metrics/MethodLength
|
33
|
-
# rubocop:enable Metrics/AbcSize
|
34
30
|
|
35
31
|
# Create a new inventory
|
36
32
|
def _docker_container_list_new_inventory
|
@@ -23,7 +23,6 @@ module DockerImageTagCheck
|
|
23
23
|
private
|
24
24
|
|
25
25
|
# Check if image exists.
|
26
|
-
# rubocop:disable Metrics/MethodLength
|
27
26
|
def _docker_image_check_image?(image)
|
28
27
|
cmd_docker_images =
|
29
28
|
format(
|
@@ -39,5 +38,4 @@ module DockerImageTagCheck
|
|
39
38
|
|
40
39
|
true
|
41
40
|
end
|
42
|
-
# rubocop:enable Metrics/MethodLength
|
43
41
|
end
|
data/lib/takeltau/git/lib.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
# tau git lib
|
4
4
|
module GitLib
|
5
5
|
# Prepare git workspace.
|
6
|
-
# rubocop:disable Metrics/MethodLength
|
7
6
|
def git_lib_prepare_git_workspace
|
8
7
|
log.debug 'Prepare git workspace'
|
9
8
|
|
@@ -24,7 +23,6 @@ module GitLib
|
|
24
23
|
log.error 'Unable to pull git workspace'
|
25
24
|
false
|
26
25
|
end
|
27
|
-
# rubocop:enable Metrics/MethodLength
|
28
26
|
|
29
27
|
# Push git workspace.
|
30
28
|
def git_lib_push_hg_dirs
|
@@ -4,7 +4,6 @@
|
|
4
4
|
module InfoStatusBar
|
5
5
|
# Backend method for info status bar.
|
6
6
|
# @return [String] status info bar
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
7
|
def info_status_bar
|
9
8
|
log.debug 'Get status info bar'
|
10
9
|
|
@@ -24,7 +23,6 @@ module InfoStatusBar
|
|
24
23
|
say @bar_list.join(' | ')
|
25
24
|
@bar_status
|
26
25
|
end
|
27
|
-
# rubocop:enable Metrics/MethodLength
|
28
26
|
|
29
27
|
private
|
30
28
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
module InfoStatusGopass
|
5
5
|
# Backend method for info status gopass.
|
6
6
|
# @return [Boolean] is gopass available?
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
7
|
def info_status_gopass
|
9
8
|
log.debug 'Check gopass status'
|
10
9
|
|
@@ -25,7 +24,6 @@ module InfoStatusGopass
|
|
25
24
|
log.debug 'gopass is available'
|
26
25
|
true
|
27
26
|
end
|
28
|
-
# rubocop:enable Metrics/MethodLength
|
29
27
|
|
30
28
|
private
|
31
29
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
module InfoStatusGPG
|
5
5
|
# Backend method for info status gpg.
|
6
6
|
# @return [Boolean] is GPG available?
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
7
|
def info_status_gpg
|
9
8
|
log.debug 'Check gpg status'
|
10
9
|
|
@@ -21,7 +20,6 @@ module InfoStatusGPG
|
|
21
20
|
log.debug 'gpg is available'
|
22
21
|
true
|
23
22
|
end
|
24
|
-
# rubocop:enable Metrics/MethodLength
|
25
23
|
|
26
24
|
private
|
27
25
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
module InfoStatusSSH
|
5
5
|
# Backend method for info status ssh.
|
6
6
|
# @return [Boolean] is ssh available?
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
7
|
def info_status_ssh
|
9
8
|
log.debug 'Check ssh status'
|
10
9
|
|
@@ -29,7 +28,6 @@ module InfoStatusSSH
|
|
29
28
|
log.debug 'ssh is available'
|
30
29
|
true
|
31
30
|
end
|
32
|
-
# rubocop:enable Metrics/MethodLength
|
33
31
|
|
34
32
|
private
|
35
33
|
|
@@ -16,7 +16,6 @@ module Takeltau
|
|
16
16
|
argument :name
|
17
17
|
|
18
18
|
# Define templates
|
19
|
-
# rubocop:disable Metrics/MethodLength
|
20
19
|
def initialize(args = [], local_options = {}, configuration = {})
|
21
20
|
# initialize thor parent class
|
22
21
|
super args, local_options, configuration
|
@@ -38,7 +37,6 @@ module Takeltau
|
|
38
37
|
template: '../templates/Rakefile.tt'
|
39
38
|
}
|
40
39
|
end
|
41
|
-
# rubocop:enable Metrics/MethodLength
|
42
40
|
|
43
41
|
# Provide template path for Thor:Actions
|
44
42
|
def self.source_root
|
data/lib/takeltau/lib/config.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# tau config module
|
4
|
-
# rubocop:disable Metrics/ModuleLength
|
5
4
|
module ConfigModule
|
6
5
|
# tau config class.
|
7
6
|
class TakeltauConfig
|
@@ -23,7 +22,7 @@ module ConfigModule
|
|
23
22
|
# Initialize config
|
24
23
|
# rubocop:disable Metrics/AbcSize
|
25
24
|
def initialize_config(workdir)
|
26
|
-
project_root_dir = _get_project_root_dir workdir
|
25
|
+
project_root_dir = File.expand_path _get_project_root_dir workdir
|
27
26
|
|
28
27
|
log.debug "takelage version: #{Takeltau::VERSION}"
|
29
28
|
log.debug "Current working directory: #{Dir.pwd}"
|
@@ -119,7 +118,6 @@ module ConfigModule
|
|
119
118
|
end
|
120
119
|
|
121
120
|
# Merge active config.
|
122
|
-
# rubocop:disable Metrics/AbcSize
|
123
121
|
def _config_merge_active
|
124
122
|
# make a clone or else we'll change the original hash
|
125
123
|
default = TakeltauConfig.instance.default.clone
|
@@ -133,12 +131,9 @@ module ConfigModule
|
|
133
131
|
project_over_home = home.merge!(envvars_over_project)
|
134
132
|
default.merge!(project_over_home).sort.to_h
|
135
133
|
end
|
136
|
-
# rubocop:enable Metrics/AbcSize
|
137
134
|
|
138
135
|
# Get project root directory.
|
139
136
|
# @return [String] project root directory
|
140
|
-
# rubocop:disable Metrics/MethodLength
|
141
|
-
# rubocop:disable Metrics/AbcSize
|
142
137
|
def _get_project_root_dir(workdir)
|
143
138
|
tau_workdir_root_dir = _get_workdir_root_dir workdir
|
144
139
|
unless tau_workdir_root_dir.empty?
|
@@ -161,8 +156,6 @@ module ConfigModule
|
|
161
156
|
log.debug "Setting root dir to current working dir \"#{Dir.pwd}\""
|
162
157
|
Dir.pwd
|
163
158
|
end
|
164
|
-
# rubocop:enable Metrics/AbcSize
|
165
|
-
# rubocop:enable Metrics/MethodLength
|
166
159
|
|
167
160
|
# Return a command line workdir
|
168
161
|
def _get_workdir_root_dir(workdir)
|
@@ -177,4 +170,3 @@ module ConfigModule
|
|
177
170
|
path_rakefile
|
178
171
|
end
|
179
172
|
end
|
180
|
-
# rubocop:enable Metrics/ModuleLength
|
data/lib/takeltau/lib/system.rb
CHANGED
@@ -69,12 +69,14 @@ module SystemModule
|
|
69
69
|
# Run a command and return the standard output.
|
70
70
|
# @return [String] stdout of command
|
71
71
|
def run(command)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
Dir.chdir(config.active['project_root_dir']) do
|
73
|
+
log.debug "Running command \"#{command}\""
|
74
|
+
stdout_str, stderr_str, status = Open3.capture3 command
|
75
|
+
log.debug "Command \"#{command}\" has stdout:\n\"\"\"\n#{stdout_str}\"\"\""
|
76
|
+
log.debug "Command \"#{command}\" has stderr:\n\"\"\"\n#{stderr_str}\"\"\""
|
77
|
+
log.debug "Command \"#{command}\" has exit status: \"#{status.exitstatus}\""
|
78
|
+
stdout_str
|
79
|
+
end
|
78
80
|
end
|
79
81
|
|
80
82
|
# Run a command and return the standard output
|
@@ -82,25 +84,31 @@ module SystemModule
|
|
82
84
|
# @return [[String, String, Integer]] array of
|
83
85
|
# stdout, stderr, exitstatus of command
|
84
86
|
def run_and_capture(command)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
Dir.chdir(config.active['project_root_dir']) do
|
88
|
+
log.debug "Running and capturing command \"#{command}\""
|
89
|
+
stdout_str, stderr_str, status = Open3.capture3 command
|
90
|
+
log.debug "Command \"#{command}\" has stdout:\n\"\"\"\n#{stdout_str}\"\"\""
|
91
|
+
log.debug "Command \"#{command}\" has stderr:\n\"\"\"\n#{stderr_str}\"\"\""
|
92
|
+
log.debug "Command \"#{command}\" has exit status: \"#{status.exitstatus}\""
|
93
|
+
[stdout_str, stderr_str, status.exitstatus]
|
94
|
+
end
|
91
95
|
end
|
92
96
|
|
93
97
|
# Use Kernel#exec to replace the ruby process with a command.
|
94
98
|
def run_and_exit(command)
|
95
|
-
|
96
|
-
|
99
|
+
Dir.chdir(config.active['project_root_dir']) do
|
100
|
+
log.debug "Running command \"#{command}\" and exiting afterwards"
|
101
|
+
exec command
|
102
|
+
end
|
97
103
|
end
|
98
104
|
|
99
105
|
# Use Kernel#fork and Kernel#exec to run a command as a background process.
|
100
106
|
def run_and_fork(command)
|
101
107
|
log.debug "Running command \"#{command}\" as a background process"
|
102
108
|
job = fork do
|
103
|
-
|
109
|
+
Dir.chdir(config.active['project_root_dir']) do
|
110
|
+
exec command
|
111
|
+
end
|
104
112
|
end
|
105
113
|
Process.detach(job)
|
106
114
|
end
|
@@ -108,25 +116,28 @@ module SystemModule
|
|
108
116
|
# Run a command and return the result.
|
109
117
|
# @return [Boolean] success of command run
|
110
118
|
def try(command)
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
119
|
+
Dir.chdir(config.active['project_root_dir']) do
|
120
|
+
log.debug "Running command \"#{command}\""
|
121
|
+
stdout_str, stderr_str, status = Open3.capture3 command
|
122
|
+
log.debug "Command \"#{command}\" has stdout:\n\"\"\"\n#{stdout_str}\"\"\""
|
123
|
+
log.debug "Command \"#{command}\" has stderr:\n\"\"\"\n#{stderr_str}\"\"\""
|
124
|
+
log.debug "Command \"#{command}\" has exit status: \"#{status.exitstatus}\""
|
125
|
+
status
|
126
|
+
end
|
117
127
|
end
|
118
128
|
|
119
129
|
private
|
120
130
|
|
121
131
|
# Check if command is available
|
122
|
-
# rubocop:disable Metrics/MethodLength
|
123
132
|
def _command_available?(command)
|
124
133
|
return true if _command_already_checked command
|
125
134
|
|
126
135
|
log.debug "Check if the command \"#{command}\" is available"
|
127
136
|
begin
|
128
|
-
|
129
|
-
|
137
|
+
Dir.chdir(config.active['project_root_dir']) do
|
138
|
+
status = try command
|
139
|
+
return false unless status.exitstatus.zero?
|
140
|
+
end
|
130
141
|
rescue Errno::ENOENT => e
|
131
142
|
log.debug 'The command failed with an error.'
|
132
143
|
log.debug "Class of error: #{e.class}"
|
@@ -135,7 +146,6 @@ module SystemModule
|
|
135
146
|
end
|
136
147
|
true
|
137
148
|
end
|
138
|
-
# rubocop:enable Metrics/MethodLength
|
139
149
|
|
140
150
|
# Check if command has already been checked
|
141
151
|
def _command_already_checked(command)
|
@@ -4,7 +4,6 @@
|
|
4
4
|
module MutagenCheckDaemon
|
5
5
|
# Backend method for mutagen check daemon.
|
6
6
|
# @return [Boolean] is mutagen available?
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
7
|
# rubocop:disable Metrics/AbcSize
|
9
8
|
def mutagen_check_daemon
|
10
9
|
log.debug 'Check mutagen status'
|
@@ -36,12 +35,10 @@ module MutagenCheckDaemon
|
|
36
35
|
true
|
37
36
|
end
|
38
37
|
# rubocop:enable Metrics/AbcSize
|
39
|
-
# rubocop:enable Metrics/MethodLength
|
40
38
|
|
41
39
|
private
|
42
40
|
|
43
41
|
# Check mutagen host connection
|
44
|
-
# rubocop:disable Metrics/MethodLength
|
45
42
|
def _mutagen_check_daemon_host_connection
|
46
43
|
check_host_connection = format(
|
47
44
|
config.active['cmd_mutagen_check_daemon_host_connection'],
|
@@ -62,5 +59,4 @@ module MutagenCheckDaemon
|
|
62
59
|
|
63
60
|
true
|
64
61
|
end
|
65
|
-
# rubocop:enable Metrics/MethodLength
|
66
62
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# tau mutagen socket create
|
4
4
|
module MutagenSocketCreate
|
5
5
|
# Backend method for mutagen socket create.
|
6
|
-
# rubocop:disable Metrics/MethodLength
|
7
6
|
def mutagen_socket_create(name, containersock, hostsock)
|
8
7
|
# See DockerContainerLib::_docker_container_lib_hostname
|
9
8
|
socketname = "#{@hostname[-11..]}-#{name}"
|
@@ -22,12 +21,10 @@ module MutagenSocketCreate
|
|
22
21
|
log.debug "Created the mutagen socket \"#{socketname}\""
|
23
22
|
true
|
24
23
|
end
|
25
|
-
# rubocop:enable Metrics/MethodLength
|
26
24
|
|
27
25
|
private
|
28
26
|
|
29
27
|
# Get git branch.
|
30
|
-
# rubocop:disable Metrics/MethodLength
|
31
28
|
def _mutagen_socket_create_socket(socketname, containersock, hostsock)
|
32
29
|
cmd_create_socket = format(
|
33
30
|
config.active['cmd_mutagen_forward_socket_create'],
|
@@ -41,5 +38,4 @@ module MutagenSocketCreate
|
|
41
38
|
)
|
42
39
|
run cmd_create_socket
|
43
40
|
end
|
44
|
-
# rubocop:enable Metrics/MethodLength
|
45
41
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
# tau mutagen socket docker
|
4
4
|
module MutagenSocketDocker
|
5
5
|
# Backend method for mutagen socket docker.
|
6
|
-
# rubocop:disable Metrics/MethodLength
|
7
6
|
def mutagen_socket_docker(hostsock)
|
8
7
|
# See DockerContainerLib::_docker_container_lib_hostname
|
9
8
|
socketname = "#{@hostname[-11..]}-docker"
|
@@ -22,7 +21,6 @@ module MutagenSocketDocker
|
|
22
21
|
log.debug "Created the mutagen docker socket \"#{socketname}\""
|
23
22
|
true
|
24
23
|
end
|
25
|
-
# rubocop:enable Metrics/MethodLength
|
26
24
|
|
27
25
|
private
|
28
26
|
|
data/lib/takeltau/ship/cli.rb
CHANGED
@@ -53,7 +53,7 @@ module Takeltau
|
|
53
53
|
LONGDESC
|
54
54
|
# ship command: {Takeltau::ShipContainer#command}
|
55
55
|
def command(*args)
|
56
|
-
Takeltau::ShipContainer.new.command
|
56
|
+
Takeltau::ShipContainer.new.command(*args)
|
57
57
|
end
|
58
58
|
|
59
59
|
desc 'list', 'List takelships'
|
@@ -66,14 +66,24 @@ module Takeltau
|
|
66
66
|
Takeltau::ShipContainer.new.list
|
67
67
|
end
|
68
68
|
|
69
|
-
desc '
|
69
|
+
desc 'login', 'Log in to a takelship'
|
70
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
71
|
+
Log in to a takelship as root.
|
72
|
+
Alias for ship container login.
|
73
|
+
LONGDESC
|
74
|
+
# ship login: {Takeltau::ShipContainer#login}
|
75
|
+
def login
|
76
|
+
Takeltau::ShipContainer.new.login
|
77
|
+
end
|
78
|
+
|
79
|
+
desc 'logs [OPTIONS]', 'Print the takelship logs'
|
70
80
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
71
|
-
|
72
|
-
Alias for ship
|
81
|
+
Print the takelship logs.
|
82
|
+
Alias for ship container logs.
|
73
83
|
LONGDESC
|
74
|
-
# ship logs: {Takeltau::
|
75
|
-
def logs(
|
76
|
-
Takeltau::
|
84
|
+
# ship logs: {Takeltau::ShipContainer#logs}
|
85
|
+
def logs(*args)
|
86
|
+
Takeltau::ShipContainer.new.logs(*args)
|
77
87
|
end
|
78
88
|
|
79
89
|
desc 'ls', 'List takelships'
|
@@ -86,16 +96,6 @@ module Takeltau
|
|
86
96
|
Takeltau::ShipContainer.new.list
|
87
97
|
end
|
88
98
|
|
89
|
-
desc 'login', 'Log in to a takelship'
|
90
|
-
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
91
|
-
Log in to a takelship as root.
|
92
|
-
Alias for ship container login.
|
93
|
-
LONGDESC
|
94
|
-
# ship login: {Takeltau::ShipContainer#login}
|
95
|
-
def login
|
96
|
-
Takeltau::ShipContainer.new.login
|
97
|
-
end
|
98
|
-
|
99
99
|
desc 'podman [COMMAND]', 'Run a podman [COMMAND] in a takelship'
|
100
100
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
101
101
|
Run a podman command as user podman in a takelship container.
|
@@ -103,7 +103,7 @@ module Takeltau
|
|
103
103
|
LONGDESC
|
104
104
|
# ship podman: {Takeltau::ShipContainer#podman}
|
105
105
|
def podman(*args)
|
106
|
-
Takeltau::ShipContainer.new.podman
|
106
|
+
Takeltau::ShipContainer.new.podman(*args)
|
107
107
|
end
|
108
108
|
|
109
109
|
desc 'sudo [COMMAND]', 'Run a sudo [COMMAND] in a takelship'
|
@@ -113,7 +113,7 @@ module Takeltau
|
|
113
113
|
LONGDESC
|
114
114
|
# ship sudo: {Takeltau::ShipContainer#sudo}
|
115
115
|
def sudo(*args)
|
116
|
-
Takeltau::ShipContainer.new.sudo
|
116
|
+
Takeltau::ShipContainer.new.sudo(*args)
|
117
117
|
end
|
118
118
|
|
119
119
|
desc 'start [PROJECT]', 'Start takelship [PROJECT]'
|
@@ -10,7 +10,6 @@ module ShipContainerClean
|
|
10
10
|
private
|
11
11
|
|
12
12
|
# Remove all takelship containers
|
13
|
-
# rubocop:disable Metrics/MethodLength
|
14
13
|
def _ship_container_clean_remove_containers
|
15
14
|
ship_name = config.active['ship_name']
|
16
15
|
log.debug "Getting all #{ship_name} containers"
|
@@ -26,5 +25,4 @@ module ShipContainerClean
|
|
26
25
|
_ship_container_lib_remove_container container
|
27
26
|
end
|
28
27
|
end
|
29
|
-
# rubocop:enable Metrics/MethodLength
|
30
28
|
end
|
@@ -13,6 +13,7 @@ module Takeltau
|
|
13
13
|
include ShipContainerClean
|
14
14
|
include ShipContainerList
|
15
15
|
include ShipContainerLogin
|
16
|
+
include ShipContainerLogs
|
16
17
|
include ShipContainerPodman
|
17
18
|
include ShipContainerCommand
|
18
19
|
include ShipContainerSudo
|
@@ -66,6 +67,19 @@ module Takeltau
|
|
66
67
|
ship_container_login
|
67
68
|
end
|
68
69
|
|
70
|
+
#
|
71
|
+
# ship container logs
|
72
|
+
#
|
73
|
+
desc 'logs [OPTIONS]', 'Print the takelship logs'
|
74
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
75
|
+
Print the takelship logs.
|
76
|
+
Accepts docker logs options.
|
77
|
+
See: docker help logs
|
78
|
+
LONGDESC
|
79
|
+
def logs(*args)
|
80
|
+
ship_container_logs args
|
81
|
+
end
|
82
|
+
|
69
83
|
#
|
70
84
|
# ship container podman
|
71
85
|
#
|
@@ -5,10 +5,13 @@ module ShipContainerLib
|
|
5
5
|
private
|
6
6
|
|
7
7
|
# Run nonprivileged docker command
|
8
|
-
def _ship_container_lib_docker_nonprivileged(command)
|
8
|
+
def _ship_container_lib_docker_nonprivileged(command, args = '')
|
9
|
+
args_nonprivileged = config.active['ship_run_args_nonprivileged']
|
10
|
+
args = "#{args} #{args_nonprivileged}" if config.active['ship_run_args_nonprivileged']
|
9
11
|
cmd_docker_run_command = format(
|
10
12
|
config.active['cmd_ship_project_start_docker_run_nonprivileged'],
|
11
13
|
ship_docker: config.active['cmd_ship_docker'],
|
14
|
+
ship_run_args_nonprivileged: args,
|
12
15
|
image: _ship_container_lib_image,
|
13
16
|
command: command
|
14
17
|
)
|
@@ -18,7 +21,9 @@ module ShipContainerLib
|
|
18
21
|
# Run privileged docker command
|
19
22
|
# rubocop:disable Metrics/AbcSize
|
20
23
|
# rubocop:disable Metrics/MethodLength
|
21
|
-
def _ship_container_lib_docker_privileged(ports, command)
|
24
|
+
def _ship_container_lib_docker_privileged(ports, command, args = '')
|
25
|
+
args_privileged = config.active['ship_run_args_privileged']
|
26
|
+
args = "#{args} #{args_privileged}" if config.active['ship_run_args_privileged']
|
22
27
|
ship_data_dir = config.active['ship_data_dir']
|
23
28
|
ship_env = [config.active['ship_env']]
|
24
29
|
ports.each do |key, port|
|
@@ -33,7 +38,9 @@ module ShipContainerLib
|
|
33
38
|
ship_hostname: _ship_container_lib_ship_hostname,
|
34
39
|
ship_env: ship_env.join(' '),
|
35
40
|
ports: ports,
|
41
|
+
project_root_dir: config.active['project_root_dir'],
|
36
42
|
ship_data_dir: ship_data_dir,
|
43
|
+
ship_run_args_privileged: args,
|
37
44
|
image: _ship_container_lib_image,
|
38
45
|
command: command
|
39
46
|
)
|
@@ -66,7 +73,7 @@ module ShipContainerLib
|
|
66
73
|
# Create unique docker hostname
|
67
74
|
def _ship_container_lib_ship_hostname
|
68
75
|
ship_name = config.active['ship_name']
|
69
|
-
workdir =
|
76
|
+
workdir = config.active['project_root_dir']
|
70
77
|
unique_name = "#{ship_name}_#{workdir}"
|
71
78
|
digest = Digest::SHA256.bubblebabble unique_name
|
72
79
|
unique = digest[0..10]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# tau ship container logs
|
4
|
+
module ShipContainerLogs
|
5
|
+
# Start a takelship
|
6
|
+
def ship_container_logs(args)
|
7
|
+
ship_hostname = _ship_container_lib_ship_hostname
|
8
|
+
|
9
|
+
unless ship_container_check_existing
|
10
|
+
say "The takelship #{ship_hostname} is not sailing."
|
11
|
+
return false
|
12
|
+
end
|
13
|
+
|
14
|
+
log.debug 'Printing docker logs'
|
15
|
+
_ship_container_logs_print(ship_hostname, args.join(' '))
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def _ship_container_logs_print(ship_hostname, args)
|
21
|
+
cmd_follow_logs = format(
|
22
|
+
config.active['cmd_ship_container_logs'],
|
23
|
+
ship_docker: config.active['cmd_ship_docker'],
|
24
|
+
ship_hostname: ship_hostname,
|
25
|
+
args: args
|
26
|
+
)
|
27
|
+
run_and_exit cmd_follow_logs
|
28
|
+
end
|
29
|
+
end
|
@@ -5,7 +5,6 @@ module ShipPortsLib
|
|
5
5
|
private
|
6
6
|
|
7
7
|
# get the ports of a takelship
|
8
|
-
# rubocop:disable Metrics/MethodLength
|
9
8
|
def _ship_ports_lib_get_ports(takelship, takelproject)
|
10
9
|
ports = _ship_ports_lib_get_ports_docker(takelship)
|
11
10
|
takelship['projects'].each do |project|
|
@@ -22,7 +21,6 @@ module ShipPortsLib
|
|
22
21
|
end
|
23
22
|
ports
|
24
23
|
end
|
25
|
-
# rubocop:enable Metrics/MethodLength
|
26
24
|
|
27
25
|
# write ports to project takelage.yml
|
28
26
|
def _ship_ports_lib_write_ports(ports, project)
|
@@ -48,7 +46,6 @@ module ShipPortsLib
|
|
48
46
|
|
49
47
|
# map the podman socket port (aka "DOCKER_HOST")
|
50
48
|
# returns a hash unlike the get_port method
|
51
|
-
# rubocop:disable Metrics/MethodLength
|
52
49
|
def _ship_ports_lib_get_ports_docker(takelship)
|
53
50
|
takel_docker = takelship['docker_host']
|
54
51
|
docker_key = "ship_ports_docker_host_docker_#{takel_docker}"
|
@@ -64,10 +61,8 @@ module ShipPortsLib
|
|
64
61
|
}
|
65
62
|
}
|
66
63
|
end
|
67
|
-
# rubocop:enable Metrics/MethodLength
|
68
64
|
|
69
65
|
# map a takelship port
|
70
|
-
# rubocop:disable Metrics/MethodLength
|
71
66
|
def _ship_ports_lib_get_port(key, port, service)
|
72
67
|
localhost = _ship_ports_lib_get_localhost_port key, port['port']
|
73
68
|
unless port.key?('description')
|
@@ -87,7 +82,6 @@ module ShipPortsLib
|
|
87
82
|
'description' => port['description']
|
88
83
|
}
|
89
84
|
end
|
90
|
-
# rubocop:enable Metrics/MethodLength
|
91
85
|
|
92
86
|
# get new port on localhost for takelport
|
93
87
|
def _ship_ports_lib_get_localhost_port(key, port)
|
@@ -13,34 +13,36 @@ module Takeltau
|
|
13
13
|
include ShipContainerStop
|
14
14
|
include ShipInfoLib
|
15
15
|
include ShipPortsLib
|
16
|
+
include ShipProjectCreate
|
16
17
|
include ShipProjectList
|
17
|
-
include ShipProjectLogs
|
18
18
|
include ShipProjectStart
|
19
19
|
|
20
20
|
#
|
21
|
-
# ship
|
21
|
+
# ship project dump
|
22
22
|
#
|
23
|
-
desc '
|
23
|
+
desc 'create [PROJECT]', 'Create a takelship [PROJECT]'
|
24
24
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
25
|
-
|
25
|
+
Create a takelship [PROJECT].
|
26
|
+
This command will create the configuration files of a takelship [PROJECT].
|
27
|
+
It will neither run the [PROJECT] in a takelship nor create service data.
|
26
28
|
LONGDESC
|
27
|
-
def
|
28
|
-
|
29
|
+
def create(project = 'default')
|
30
|
+
say ship_project_create project
|
29
31
|
end
|
30
32
|
|
31
33
|
#
|
32
|
-
# ship
|
34
|
+
# ship project list
|
33
35
|
#
|
34
|
-
desc '
|
36
|
+
desc 'list', 'List takelship projects'
|
35
37
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
36
|
-
|
38
|
+
List all available takelship projects.
|
37
39
|
LONGDESC
|
38
|
-
def
|
39
|
-
|
40
|
+
def list
|
41
|
+
ship_project_list
|
40
42
|
end
|
41
43
|
|
42
44
|
#
|
43
|
-
# ship
|
45
|
+
# ship project start
|
44
46
|
#
|
45
47
|
desc 'start [PROJECT]', 'Start takelship [PROJECT]'
|
46
48
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
@@ -61,5 +63,18 @@ module Takeltau
|
|
61
63
|
def stop
|
62
64
|
say ship_container_stop
|
63
65
|
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# ship project update
|
69
|
+
#
|
70
|
+
desc 'update [PROJECT]', 'Update a takelship [PROJECT]'
|
71
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
72
|
+
Update a takelship [PROJECT].
|
73
|
+
This command will update the configuration files of a takelship [PROJECT].
|
74
|
+
It will neither run the [PROJECT] in a takelship nor touch the service data.
|
75
|
+
LONGDESC
|
76
|
+
def update(project = 'default')
|
77
|
+
say ship_project_create project, 'Updated'
|
78
|
+
end
|
64
79
|
end
|
65
80
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# tau ship project create
|
4
|
+
module ShipProjectCreate
|
5
|
+
# Start a takelship
|
6
|
+
def ship_project_create(project, verb = 'Created')
|
7
|
+
takelship = _ship_info_lib_get_takelshipinfo
|
8
|
+
project = _ship_info_lib_get_project project, takelship
|
9
|
+
return false unless _ship_project_start_valid_project? takelship, project
|
10
|
+
|
11
|
+
log.debug "Dumping takelship project \"#{project}\""
|
12
|
+
ports = _ship_ports_lib_get_ports(takelship, project)
|
13
|
+
project_root_dir = config.active['project_root_dir']
|
14
|
+
ship_data_dir = config.active['ship_data_dir']
|
15
|
+
args = []
|
16
|
+
args << "--volume #{project_root_dir}/#{ship_data_dir}:/home/podman/takelship"
|
17
|
+
args << '--env TAKELSHIP_DUMP=true'
|
18
|
+
_ship_container_lib_docker_privileged ports, project, args.join(' ')
|
19
|
+
"#{verb} takelship project \"#{project}\"."
|
20
|
+
end
|
21
|
+
end
|
@@ -3,17 +3,14 @@
|
|
3
3
|
# tau ship project start
|
4
4
|
module ShipProjectStart
|
5
5
|
# Start a takelship
|
6
|
-
# rubocop:disable Metrics/MethodLength
|
7
6
|
def ship_project_start(project)
|
8
7
|
return false unless _ship_project_start_matrjoschka?
|
9
8
|
|
10
9
|
takelship = _ship_info_lib_get_takelshipinfo
|
11
10
|
project = _ship_info_lib_get_project project, takelship
|
12
|
-
|
13
11
|
return false unless _ship_project_start_valid_project? takelship, project
|
14
12
|
|
15
13
|
ports = _ship_ports_lib_get_ports(takelship, project)
|
16
|
-
|
17
14
|
return false unless _ship_project_start_sailing? project, ports
|
18
15
|
|
19
16
|
log.debug 'Writing port configuration to takelage.yml'
|
@@ -24,7 +21,6 @@ module ShipProjectStart
|
|
24
21
|
say "Started project \"#{project}\" on takelship \"#{_ship_container_lib_ship_hostname}\".\n\n"
|
25
22
|
_ship_project_start_print_ports ports
|
26
23
|
end
|
27
|
-
# rubocop:enable Metrics/MethodLength
|
28
24
|
|
29
25
|
private
|
30
26
|
|
@@ -55,8 +51,6 @@ module ShipProjectStart
|
|
55
51
|
end
|
56
52
|
|
57
53
|
# print ports after starting a takelship
|
58
|
-
# rubocop:disable Metrics/MethodLength
|
59
|
-
# rubocop:disable Metrics/AbcSize
|
60
54
|
def _ship_project_start_print_ports(ports)
|
61
55
|
output = []
|
62
56
|
max_length = _ship_project_start_get_maxlength ports
|
@@ -71,12 +65,8 @@ module ShipProjectStart
|
|
71
65
|
end
|
72
66
|
output.join("\n")
|
73
67
|
end
|
74
|
-
# rubocop:enable Metrics/AbcSize
|
75
|
-
# rubocop:enable Metrics/MethodLength
|
76
68
|
|
77
69
|
# get max length of left column
|
78
|
-
# rubocop:disable Metrics/MethodLength
|
79
|
-
# rubocop:disable Metrics/AbcSize
|
80
70
|
def _ship_project_start_get_maxlength(ports)
|
81
71
|
max_length = {}
|
82
72
|
max_length['url'] = 0
|
@@ -93,6 +83,4 @@ module ShipProjectStart
|
|
93
83
|
end
|
94
84
|
max_length
|
95
85
|
end
|
96
|
-
# rubocop:enable Metrics/AbcSize
|
97
|
-
# rubocop:enable Metrics/MethodLength
|
98
86
|
end
|
data/lib/takeltau/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.44.
|
1
|
+
0.44.15
|
data/lib/takeltau.rb
CHANGED
@@ -91,6 +91,7 @@ require_relative 'takeltau/ship/info/lib'
|
|
91
91
|
require_relative 'takeltau/ship/container/list'
|
92
92
|
require_relative 'takeltau/ship/container/clean'
|
93
93
|
require_relative 'takeltau/ship/container/command'
|
94
|
+
require_relative 'takeltau/ship/container/logs'
|
94
95
|
require_relative 'takeltau/ship/container/login'
|
95
96
|
require_relative 'takeltau/ship/container/podman'
|
96
97
|
require_relative 'takeltau/ship/container/sudo'
|
@@ -101,8 +102,8 @@ require_relative 'takeltau/ship/info/cli'
|
|
101
102
|
require_relative 'takeltau/ship/ports/lib'
|
102
103
|
require_relative 'takeltau/ship/ports/list'
|
103
104
|
require_relative 'takeltau/ship/ports/cli'
|
105
|
+
require_relative 'takeltau/ship/project/create'
|
104
106
|
require_relative 'takeltau/ship/project/list'
|
105
|
-
require_relative 'takeltau/ship/project/logs'
|
106
107
|
require_relative 'takeltau/ship/project/start'
|
107
108
|
require_relative 'takeltau/ship/project/cli'
|
108
109
|
require_relative 'takeltau/ship/cli'
|
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.44.
|
4
|
+
version: 0.44.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takelwerk
|
@@ -294,6 +294,7 @@ files:
|
|
294
294
|
- lib/takeltau/ship/container/lib.rb
|
295
295
|
- lib/takeltau/ship/container/list.rb
|
296
296
|
- lib/takeltau/ship/container/login.rb
|
297
|
+
- lib/takeltau/ship/container/logs.rb
|
297
298
|
- lib/takeltau/ship/container/podman.rb
|
298
299
|
- lib/takeltau/ship/container/stop.rb
|
299
300
|
- lib/takeltau/ship/container/sudo.rb
|
@@ -304,8 +305,8 @@ files:
|
|
304
305
|
- lib/takeltau/ship/ports/lib.rb
|
305
306
|
- lib/takeltau/ship/ports/list.rb
|
306
307
|
- lib/takeltau/ship/project/cli.rb
|
308
|
+
- lib/takeltau/ship/project/create.rb
|
307
309
|
- lib/takeltau/ship/project/list.rb
|
308
|
-
- lib/takeltau/ship/project/logs.rb
|
309
310
|
- lib/takeltau/ship/project/start.rb
|
310
311
|
- lib/takeltau/version
|
311
312
|
homepage: https://github.com/takelwerk/takelage-cli
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# tau ship project logs
|
4
|
-
module ShipProjectLogs
|
5
|
-
# Start a takelship
|
6
|
-
def ship_project_logs(project)
|
7
|
-
return unless ship_container_check_existing
|
8
|
-
|
9
|
-
takelship = _ship_info_lib_get_takelshipinfo
|
10
|
-
project = _ship_info_lib_get_project(project, takelship)
|
11
|
-
|
12
|
-
return false unless _ship_info_lib_valid_project? takelship, project
|
13
|
-
|
14
|
-
log.debug "Following logs of takelship project \"#{project}\""
|
15
|
-
_ship_project_logs_follow_logs project
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def _ship_project_logs_follow_logs(project)
|
21
|
-
cmd_follow_logs = format(
|
22
|
-
config.active['cmd_ship_project_follow_logs'],
|
23
|
-
project: project
|
24
|
-
)
|
25
|
-
_ship_container_lib_docker_exec cmd_follow_logs
|
26
|
-
end
|
27
|
-
end
|