icfs 0.1.2 → 0.1.3
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/data/icfs.js +349 -316
- data/devel/devel-webrick.yml +49 -0
- data/devel/docker-compose.yml +63 -0
- data/devel/icfs +1 -0
- data/devel/run/copy-s3.rb +43 -0
- data/devel/{test/init.rb → run/init-icfs.rb} +5 -20
- data/devel/{test/run.rb → run/webrick.rb} +14 -11
- data/lib/icfs/api.rb +23 -9
- data/lib/icfs/users.rb +9 -0
- data/lib/icfs/users_fs.rb +6 -0
- data/lib/icfs/users_redis.rb +26 -4
- data/lib/icfs/users_s3.rb +8 -2
- data/lib/icfs/web/auth_ssl.rb +5 -1
- data/lib/icfs/web/client.rb +1 -0
- metadata +8 -26
- data/bin/icfs_demo_check.rb +0 -29
- data/bin/icfs_demo_create.rb +0 -89
- data/bin/icfs_demo_web.rb +0 -50
- data/data/demo_config.yml +0 -94
- data/data/docker/build-web.sh +0 -27
- data/data/docker/compose-demo.yml +0 -41
- data/data/docker/compose-init.yml +0 -32
- data/data/docker/icfs-app.rb +0 -50
- data/data/docker/icfs-cfg.yml +0 -88
- data/data/docker/icfs-init.rb +0 -75
- data/data/docker/icfs-ruby/Dockerfile +0 -22
- data/data/docker/icfs-ruby/build.sh +0 -14
- data/data/docker/nginx.conf +0 -68
- data/devel/create.sh +0 -15
- data/devel/elastic.sh +0 -20
- data/devel/minio.sh +0 -22
- data/devel/redis.sh +0 -18
- data/devel/server.sh +0 -18
- data/devel/test/es-s3-fs-init.rb +0 -93
- data/devel/test/es-s3-fs-webrick.rb +0 -79
- data/devel/test/es-s3-restore.rb +0 -56
- data/lib/icfs/demo/timezone.rb +0 -38
data/devel/minio.sh
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
#
|
3
|
-
# Investigative Case File System
|
4
|
-
#
|
5
|
-
# Copyright 2019 by Graham A. Field
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License version 3.
|
9
|
-
#
|
10
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
-
|
13
|
-
# run minio
|
14
|
-
# to debug add -e "MINIO_HTTP_TRACE=/dev/stdout" \
|
15
|
-
docker run -d --rm \
|
16
|
-
-v icfs-obj:/data \
|
17
|
-
-p "127.0.0.1:9000:9000" \
|
18
|
-
-e "MINIO_ACCESS_KEY=minio_key" \
|
19
|
-
-e "MINIO_SECRET_KEY=minio_secret" \
|
20
|
-
--network icfs \
|
21
|
-
--name icfs-minio \
|
22
|
-
minio/minio server /data
|
data/devel/redis.sh
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
#
|
3
|
-
# Investigative Case File System
|
4
|
-
#
|
5
|
-
# Copyright 2019 by Graham A. Field
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License version 3.
|
9
|
-
#
|
10
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
-
|
13
|
-
# run redis
|
14
|
-
docker run -d --rm \
|
15
|
-
--network icfs \
|
16
|
-
--name icfs-redis \
|
17
|
-
redis:alpine
|
18
|
-
# to run the CLI: docker exec -it icfs-redis redis-cli
|
data/devel/server.sh
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
#
|
3
|
-
# Investigative Case File System
|
4
|
-
#
|
5
|
-
# Copyright 2019 by Graham A. Field
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License version 3.
|
9
|
-
#
|
10
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
-
|
13
|
-
# run the server
|
14
|
-
docker run \
|
15
|
-
-v $1:/icfs \
|
16
|
-
-p "127.0.0.1:80:8080" \
|
17
|
-
--network icfs \
|
18
|
-
-it --rm icfs-wrk
|
data/devel/test/es-s3-fs-init.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Investigative Case File System
|
4
|
-
#
|
5
|
-
# Copyright 2019 by Graham A. Field
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License version 3.
|
9
|
-
#
|
10
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
-
|
13
|
-
require 'json'
|
14
|
-
require 'faraday'
|
15
|
-
require 'fileutils'
|
16
|
-
require 'aws-sdk-s3'
|
17
|
-
|
18
|
-
require_relative '../../lib/icfs'
|
19
|
-
require_relative '../../lib/icfs/cache_elastic'
|
20
|
-
require_relative '../../lib/icfs/store_s3'
|
21
|
-
require_relative '../../lib/icfs/users_fs'
|
22
|
-
|
23
|
-
# Minio config
|
24
|
-
Aws.config.update(
|
25
|
-
endpoint: 'http://icfs-minio:9000',
|
26
|
-
access_key_id: 'minio_key',
|
27
|
-
secret_access_key: 'minio_secret',
|
28
|
-
force_path_style: true,
|
29
|
-
region: 'use-east-1'
|
30
|
-
)
|
31
|
-
|
32
|
-
# default mapping
|
33
|
-
map = {
|
34
|
-
entry: 'entry',
|
35
|
-
case: 'case',
|
36
|
-
action: 'action',
|
37
|
-
index: 'index',
|
38
|
-
log: 'log',
|
39
|
-
lock: 'lock',
|
40
|
-
current: 'current',
|
41
|
-
}.freeze
|
42
|
-
|
43
|
-
# base items
|
44
|
-
s3 = Aws::S3::Client.new
|
45
|
-
es = Faraday.new('http://icfs-elastic:9200')
|
46
|
-
cache = ICFS::CacheElastic.new(map, es)
|
47
|
-
store = ICFS::StoreS3.new(s3, 'icfs-cache')
|
48
|
-
users = ICFS::UsersFs.new('/var/lib/icfs/users')
|
49
|
-
|
50
|
-
# create users dir
|
51
|
-
FileUtils.mkdir_p('/var/lib/icfs/users')
|
52
|
-
puts "Created users directory"
|
53
|
-
|
54
|
-
# put a testuser
|
55
|
-
tusr = {
|
56
|
-
'name' => 'testuser',
|
57
|
-
'type' => 'user',
|
58
|
-
}
|
59
|
-
users.write(tusr)
|
60
|
-
puts "Added testuser"
|
61
|
-
|
62
|
-
# create the indexes
|
63
|
-
cache.create(ICFS::CacheElastic::Maps)
|
64
|
-
puts "Indexes created"
|
65
|
-
|
66
|
-
# create a bucket
|
67
|
-
s3.create_bucket(bucket: 'icfs-cache')
|
68
|
-
puts "Bucket created"
|
69
|
-
|
70
|
-
api = ICFS::Api.new([], users, cache, store)
|
71
|
-
api.user = 'testuser'
|
72
|
-
|
73
|
-
# add a template
|
74
|
-
tmpl = {
|
75
|
-
'template' => true,
|
76
|
-
'status' => true,
|
77
|
-
'title' => 'Test template',
|
78
|
-
'access' => [
|
79
|
-
{
|
80
|
-
'perm' => '[manage]',
|
81
|
-
'grant' => [
|
82
|
-
'testuser'
|
83
|
-
]
|
84
|
-
}
|
85
|
-
]
|
86
|
-
}
|
87
|
-
ent = {
|
88
|
-
'caseid' => 'test_tmpl',
|
89
|
-
'title' => 'Create template',
|
90
|
-
'content' => 'To test'
|
91
|
-
}
|
92
|
-
api.case_create(ent, tmpl)
|
93
|
-
puts "Create template"
|
@@ -1,79 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Investigative Case File System
|
4
|
-
#
|
5
|
-
# Copyright 2019 by Graham A. Field
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License version 3.
|
9
|
-
#
|
10
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
-
|
13
|
-
require 'json'
|
14
|
-
require 'faraday'
|
15
|
-
require 'fileutils'
|
16
|
-
require 'aws-sdk-s3'
|
17
|
-
|
18
|
-
require_relative '../../lib/icfs'
|
19
|
-
require_relative '../../lib/icfs/cache_elastic'
|
20
|
-
require_relative '../../lib/icfs/store_s3'
|
21
|
-
require_relative '../../lib/icfs/users_fs'
|
22
|
-
require_relative '../../lib/icfs/web/client'
|
23
|
-
require_relative '../../lib/icfs/demo/auth'
|
24
|
-
require_relative '../../lib/icfs/demo/static'
|
25
|
-
require_relative '../../lib/icfs/demo/timezone'
|
26
|
-
|
27
|
-
# Minio config
|
28
|
-
Aws.config.update(
|
29
|
-
endpoint: 'http://icfs-minio:9000',
|
30
|
-
access_key_id: 'minio_key',
|
31
|
-
secret_access_key: 'minio_secret',
|
32
|
-
force_path_style: true,
|
33
|
-
region: 'use-east-1'
|
34
|
-
)
|
35
|
-
|
36
|
-
# default mapping
|
37
|
-
map = {
|
38
|
-
entry: 'entry',
|
39
|
-
case: 'case',
|
40
|
-
action: 'action',
|
41
|
-
index: 'index',
|
42
|
-
log: 'log',
|
43
|
-
lock: 'lock',
|
44
|
-
current: 'current',
|
45
|
-
}.freeze
|
46
|
-
|
47
|
-
# base items
|
48
|
-
s3 = Aws::S3::Client.new
|
49
|
-
es = Faraday.new('http://icfs-elastic:9200')
|
50
|
-
cache = ICFS::CacheElastic.new(map, es)
|
51
|
-
store = ICFS::StoreS3.new(s3, 'icfs-cache')
|
52
|
-
users = ICFS::UsersFs.new('/var/lib/icfs/users')
|
53
|
-
api = ICFS::Api.new([], users, cache, store)
|
54
|
-
web = ICFS::Web::Client.new('/static/icfs.css', '/static/icfs.js')
|
55
|
-
|
56
|
-
# static files
|
57
|
-
static = {
|
58
|
-
'/static/icfs.css' => {
|
59
|
-
'path' => 'data/icfs.css',
|
60
|
-
'mime' => 'text/css; charset=utf-8'
|
61
|
-
},
|
62
|
-
'/static/icfs.js' => {
|
63
|
-
'path' => 'data/icfs.js',
|
64
|
-
'mime' => 'application/javascript; charset=utf-8'
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
app = Rack::Builder.new do
|
69
|
-
use(ICFS::Demo::Auth, api)
|
70
|
-
use(ICFS::Demo::Static, static)
|
71
|
-
use(ICFS::Demo::Timezone, '-04:00')
|
72
|
-
run web
|
73
|
-
end
|
74
|
-
|
75
|
-
opts = {}
|
76
|
-
opts[:Host] = "0.0.0.0"
|
77
|
-
opts[:Port] = 8080
|
78
|
-
|
79
|
-
Rack::Handler::WEBrick.run(app, opts)
|
data/devel/test/es-s3-restore.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Investigative Case File System
|
4
|
-
#
|
5
|
-
# Copyright 2019 by Graham A. Field
|
6
|
-
#
|
7
|
-
# This program is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License version 3.
|
9
|
-
#
|
10
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
11
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
12
|
-
|
13
|
-
|
14
|
-
# usage <caseid> <store_fs>
|
15
|
-
|
16
|
-
require 'json'
|
17
|
-
require 'faraday'
|
18
|
-
require 'aws-sdk-s3'
|
19
|
-
|
20
|
-
require_relative '../../lib/icfs'
|
21
|
-
require_relative '../../lib/icfs/cache_elastic'
|
22
|
-
require_relative '../../lib/icfs/store_s3'
|
23
|
-
require_relative '../../lib/icfs/store_fs'
|
24
|
-
require_relative '../../lib/icfs/utils/backup'
|
25
|
-
|
26
|
-
# Minio config
|
27
|
-
Aws.config.update(
|
28
|
-
endpoint: 'http://icfs-minio:9000',
|
29
|
-
access_key_id: 'minio_key',
|
30
|
-
secret_access_key: 'minio_secret',
|
31
|
-
force_path_style: true,
|
32
|
-
region: 'use-east-1'
|
33
|
-
)
|
34
|
-
|
35
|
-
# default mapping
|
36
|
-
map = {
|
37
|
-
entry: 'entry',
|
38
|
-
case: 'case',
|
39
|
-
action: 'action',
|
40
|
-
index: 'index',
|
41
|
-
log: 'log',
|
42
|
-
lock: 'lock',
|
43
|
-
current: 'current',
|
44
|
-
}.freeze
|
45
|
-
|
46
|
-
# base items
|
47
|
-
s3 = Aws::S3::Client.new
|
48
|
-
es = Faraday.new('http://icfs-elastic:9200')
|
49
|
-
cache = ICFS::CacheElastic.new(map, es)
|
50
|
-
store = ICFS::StoreS3.new(s3, 'icfs-cache')
|
51
|
-
log = Logger.new(STDOUT, level: Logger::DEBUG)
|
52
|
-
|
53
|
-
src = ICFS::StoreFs.new(ARGV[1])
|
54
|
-
backup = ICFS::Utils::Backup.new(cache, store, log)
|
55
|
-
backup.restore(ARGV[0], src)
|
56
|
-
|
data/lib/icfs/demo/timezone.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Investigative Case File System
|
3
|
-
#
|
4
|
-
# Copyright 2019 by Graham A. Field
|
5
|
-
#
|
6
|
-
# See LICENSE.txt for licensing information.
|
7
|
-
#
|
8
|
-
# This program is distributed WITHOUT ANY WARRANTY; without even the
|
9
|
-
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
10
|
-
|
11
|
-
#
|
12
|
-
module ICFS
|
13
|
-
module Demo
|
14
|
-
|
15
|
-
##########################################################################
|
16
|
-
# Set timezone - Rack middleware
|
17
|
-
#
|
18
|
-
# @deprecated This does nothing but set a static timezone. Do not use for
|
19
|
-
# anything other than testing.
|
20
|
-
#
|
21
|
-
class Timezone
|
22
|
-
|
23
|
-
# New instance
|
24
|
-
def initialize(app, tz)
|
25
|
-
@app = app
|
26
|
-
@tz = tz.freeze
|
27
|
-
end
|
28
|
-
|
29
|
-
# process requests
|
30
|
-
def call(env)
|
31
|
-
env['icfs.tz'] = @tz
|
32
|
-
@app.call(env)
|
33
|
-
end
|
34
|
-
|
35
|
-
end # class ICFS::Demo::Timezone
|
36
|
-
|
37
|
-
end # module ICFS::Demo
|
38
|
-
end # module ICFS
|