lux 1.1.3 → 1.1.4
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/CHANGELOG +8 -0
- data/lib/lux.rb +2 -2
- data/lib/lux/app.rb +5 -1
- data/lib/lux/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 639838cccfb8448235e88cd2340793420e8f74fd
|
4
|
+
data.tar.gz: 6acb8621150b1aa51282c77f574eed528d39b857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 116791a3eaab4695654f4a7a755614a38fc8610b715b1750d49eaaa8e96af31ed1d8c92742400f8ca1b1981fb750e63dc75d466e70681c900cc1b5cfb27827d8
|
7
|
+
data.tar.gz: dc88cdcbaa23d2d3c02f23610709cae44714a2ad518850e548ac182b7a7cc76286b5dea5e0e1baa3921ca08afff4940fcf64e143a7e6a482b12c5dc5278ea378
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
lux (1.1.4)
|
2
|
+
|
3
|
+
* Added --priv option to start and --exec
|
4
|
+
* Use Ruby to detect uid, rather than home directory mount which fails with
|
5
|
+
Docker for MacOS
|
6
|
+
|
7
|
+
-- Nick Townsend <nick.townsend@mac.com> Wed, 10 May 2017 14:11:43 -0800
|
8
|
+
|
1
9
|
lux (1.1.3)
|
2
10
|
|
3
11
|
* Missed another &.
|
data/lib/lux.rb
CHANGED
@@ -72,11 +72,11 @@ module Lux
|
|
72
72
|
# Return two elements:
|
73
73
|
# - user name (defaults to current user), and
|
74
74
|
# - a bash script setup command
|
75
|
+
# Omit the secret password: -p $1$Ih5pLngr$/boiJHqKbQm9AP/QQyq0b1
|
75
76
|
#
|
76
77
|
def user_setup_cmd user = `id -nu`.strip
|
77
78
|
[user, <<-COMMAND.gsub(/^\s*/,'').gsub(/\n/,' ; ')]
|
78
|
-
|
79
|
-
useradd -M -d #{ENV['HOME']} -u $uid -s #{ENV['SHELL']} #{user}
|
79
|
+
useradd -M -d #{ENV['HOME']} -u #{Process.uid} -s #{ENV['SHELL']} #{user}
|
80
80
|
mkdir -p /etc/sudoers.d
|
81
81
|
echo "#{user} ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/#{user}
|
82
82
|
COMMAND
|
data/lib/lux/app.rb
CHANGED
@@ -57,6 +57,7 @@ class Lux::App < Thor
|
|
57
57
|
method_option :env, type: :string, aliases: '-e', desc: 'Path to environment file'
|
58
58
|
method_option :name, type: :string, aliases: '-n', default: '<autogenerated>', desc: 'Docker container name'
|
59
59
|
method_option :port, type: :string, aliases: '-p', default: nil, desc: 'Expose ports (default all)'
|
60
|
+
method_option :priv, type: :boolean, default: false, desc: 'Run in privileged mode (default false)'
|
60
61
|
def start(image)
|
61
62
|
image = Lux.findimage image
|
62
63
|
raise "no image" if image.empty?
|
@@ -64,12 +65,13 @@ class Lux::App < Thor
|
|
64
65
|
me, setup_cmd = Lux.user_setup_cmd()
|
65
66
|
args = ["-v #{ENV['HOME']}:#{ENV['HOME']}"]
|
66
67
|
args << "--env-file=#{options.env}" if options.env
|
68
|
+
args << "--privileged" if options.priv
|
67
69
|
args << "--name=#{options.name}" unless options.name == '<autogenerated>'
|
68
70
|
args << (options.port ? "-p #{options.port}" : "-P")
|
69
71
|
cid = `docker run -dit #{args.join(' ')} #{image} /bin/bash`.strip
|
70
72
|
Lux.die "Container failed to start" unless cid =~ /^[a-z0-9]+$/
|
71
73
|
system "docker exec #{cid} bash -c #{setup_cmd.shellescape}"
|
72
|
-
puts "
|
74
|
+
puts "Your user and home directory are mapped into the container: Hit Enter then use 'su [-] #{me}'"
|
73
75
|
Kernel.exec "docker attach #{cid}"
|
74
76
|
end
|
75
77
|
|
@@ -80,6 +82,7 @@ class Lux::App < Thor
|
|
80
82
|
|
81
83
|
desc "exec IMAGE COMMAND", "Run a command inside a Docker container"
|
82
84
|
method_option :env, type: :string, aliases: '-e', desc: 'Path to environment file'
|
85
|
+
method_option :priv, type: :boolean, default: false, desc: 'Run in privileged mode (default false)'
|
83
86
|
def exec(image, *command)
|
84
87
|
image = Lux.findimage image
|
85
88
|
me, setup_cmd = user_setup_cmd
|
@@ -89,6 +92,7 @@ class Lux::App < Thor
|
|
89
92
|
env += IO.readlines(options.env).grep(/^(?!#)/).map(&:rstrip) if options.env
|
90
93
|
cmd = setup_cmd + "su - #{me} -c 'cd #{relwd}; env -i #{env.join(' ')} #{command.join(' ')}'"
|
91
94
|
args = ["-v #{ENV['HOME']}:#{ENV['HOME']}"]
|
95
|
+
args += "--privileged" if options.priv
|
92
96
|
system "docker run --rm #{args.join(' ')} #{image} /bin/bash -c #{cmd.shellescape}"
|
93
97
|
end
|
94
98
|
|
data/lib/lux/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Townsend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.6.11
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Handy utilities for working with Docker
|