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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -2
- data/lib/trusted_sandbox/cli.rb +7 -0
- data/lib/trusted_sandbox/runner.rb +12 -2
- data/lib/trusted_sandbox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e96be24e19e847b10942e3e8c72493f8b5cb0ce9
|
4
|
+
data.tar.gz: df3f3cccad8434b8752ee146db68fa33dd78882c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5165ce3e2d8ad14bf2bdb8609cc2dd87c203d7d5231c6a09aa8811b8f41748b70c7378a5c88fd3cf52bbad2d8866ee0152d99c38bcd9bd14ded6e45d4cc523f
|
7
|
+
data.tar.gz: e9f975e0d6c180566ccdf66596b593176980cdb34f5ad57457ba9c685e3c37d1070af0a659d8408be53a1b5918d75f55a4c84a1b1c55d6d83d0ee715350aa567
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -54,7 +54,10 @@ $ gem install trusted-sandbox
|
|
54
54
|
```
|
55
55
|
|
56
56
|
### Step 2
|
57
|
-
Install
|
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
|
data/lib/trusted_sandbox/cli.rb
CHANGED
@@ -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
|
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
|
|