trusted-sandbox 0.0.8.pre → 0.0.9.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7b64a3255a3beeac10c6a8866473acff1efae09
4
- data.tar.gz: e8f26b14b22e0b850e3b46988ba7075d9b5a6270
3
+ metadata.gz: e96be24e19e847b10942e3e8c72493f8b5cb0ce9
4
+ data.tar.gz: df3f3cccad8434b8752ee146db68fa33dd78882c
5
5
  SHA512:
6
- metadata.gz: 373a6cb32b03fcc0a111b21948bb6dde39db93454c07fcc969bd70d9d6b9c784ad8d415d4cd17cb36258b0eb9df6f9a202140f45442c3eac130e54c216fe43b0
7
- data.tar.gz: 251425a9574927a6e691cf78bfbb26f325e118f1a05fc0641bf4e55f9f14b00c7db748e8327f1527091874eaae8492fcc694fb0f4c16db174e28962dd08edaa1
6
+ metadata.gz: a5165ce3e2d8ad14bf2bdb8609cc2dd87c203d7d5231c6a09aa8811b8f41748b70c7378a5c88fd3cf52bbad2d8866ee0152d99c38bcd9bd14ded6e45d4cc523f
7
+ data.tar.gz: e9f975e0d6c180566ccdf66596b593176980cdb34f5ad57457ba9c685e3c37d1070af0a659d8408be53a1b5918d75f55a4c84a1b1c55d6d83d0ee715350aa567
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusted-sandbox (0.0.7.pre)
4
+ trusted-sandbox (0.0.9.pre)
5
5
  docker-api (~> 1.13)
6
6
  thor (~> 0.19)
7
7
 
data/README.md CHANGED
@@ -54,7 +54,10 @@ $ gem install trusted-sandbox
54
54
  ```
55
55
 
56
56
  ### Step 2
57
- Install Docker. Refer to the Docker documentation to see how to install Docker on your environment.
57
+ Install the latest version of Docker. **Do not** install from your distro pacakge management system, as the docker
58
+ version is old and does not support what Trusted Sandbox needs. Refer to the Docker documentation to see how to install
59
+ Docker on your environment.
60
+
58
61
  Note that on a Linux server the docker daemon runs as root and owns the socket used to connect to it.
59
62
  To give your app user access to that socket you will need to add the user to the docker group.
60
63
  ```
@@ -400,7 +403,7 @@ keep_code_folders: true
400
403
  This will keep your code folders from getting deleted when containers stop running. This allows you to do the
401
404
  following from your command line (adjust to your environment):
402
405
  ```
403
- $ docker run -it -v /home/MyUser/my_app/tmp/code_dirs/20000:/home/sandbox/src --entrypoint="/bin/bash" my_user/my_image:my_tag
406
+ $ docker run -it -v /home/MyUser/my_app/tmp/code_dirs/20000:/home/sandbox/src --entrypoint="/bin/bash" my_user/my_image:my_tag -s
404
407
  ```
405
408
 
406
409
  ## Contributing
@@ -23,6 +23,13 @@ module TrustedSandbox
23
23
  puts 'Trusted Sandbox seems to be configured correctly!'
24
24
  end
25
25
 
26
+ desc 'ssh UID', 'Launch a container with shell and mount the code folder. Works only if keep_code_folders is true. UID is the suffix of the code folder'
27
+ def ssh(uid)
28
+ raise 'keep_code_folders must be set to true' unless TrustedSandbox.config.keep_code_folders
29
+ local_code_dir = File.join TrustedSandbox.config.host_code_root_path, uid
30
+ `docker run -it -v #{local_code_dir}:/home/sandbox/src --entrypoint="/bin/bash" #{TrustedSandbox.config.docker_image_name} -s`
31
+ end
32
+
26
33
  desc 'generate_image VERSION', 'Creates the Docker image files and places them into the `trusted_sandbox_images` directory. Default version is 2.1.2'
27
34
  def generate_image(image_version = '2.1.2')
28
35
  target_dir = 'trusted_sandbox_images'
@@ -21,7 +21,7 @@ module TrustedSandbox
21
21
  start_container
22
22
  ensure
23
23
  release_uid
24
- remove_code_dir unless config.keep_code_folders
24
+ remove_code_dir
25
25
  remove_container
26
26
  end
27
27
 
@@ -48,10 +48,20 @@ module TrustedSandbox
48
48
  end
49
49
 
50
50
  def remove_code_dir
51
- FileUtils.rm_rf code_dir_path
51
+ FileUtils.rm_rf code_dir_path unless config.keep_code_folders
52
52
  end
53
53
 
54
54
  def create_code_dir
55
+ if config.keep_code_folders
56
+
57
+ puts "Creating #{code_dir_path}"
58
+ puts nil
59
+ puts 'To launch and ssh into a new docker container with this directory mounted, run:'
60
+ puts '-' * 80
61
+ puts %{docker run -it -v #{code_dir_path}:/home/sandbox/src --entrypoint="/bin/bash" #{config.docker_image_name} -s}
62
+ puts nil
63
+ end
64
+
55
65
  FileUtils.mkdir_p code_dir_path
56
66
  end
57
67
 
@@ -1,3 +1,3 @@
1
1
  module TrustedSandbox
2
- VERSION = '0.0.8.pre'
2
+ VERSION = '0.0.9.pre'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusted-sandbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.pre
4
+ version: 0.0.9.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amit Aharoni