Skip to content

Commit 24b4608

Browse files
committed
first fuse attempt
1 parent a011bd0 commit 24b4608

File tree

18 files changed

+785
-2
lines changed

18 files changed

+785
-2
lines changed

compose/file-system/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ghcr.io/sandialabs/sync-journal/journal-sdk:1.0.1
2+
3+
ARG REPOSITORY=https://raw.githubusercontent.com/sandialabs/sync-records/965c839ac6bed6db24541ba642089e8fa8063633/lisp/
4+
5+
RUN wget $REPOSITORY/record.scm
6+
RUN wget $REPOSITORY/control.scm
7+
RUN wget $REPOSITORY/ledger.scm
8+
9+
COPY run.sh file-system.scm .
10+
11+
COPY run.sh .
12+
13+
CMD ./run.sh

compose/file-system/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# File System Service
2+
3+
This service provides a file system backend for cross-platform file exploration of the synchronic web using [FUSE](https://en.wikipedia.org/wiki/Filesystem_in_Userspace) and [SAMBA](https://en.wikipedia.org/wiki/Samba_(software)).
4+
In the most basic use case, users can interact with it as if it were any mounted Linux drive.
5+
The distinguishing feature is the integration is the invocation and integration with a synchronic journal to provide secure versioning and temporal references to historic file system artifacts.
6+
7+
## Extra Record Functionality
8+
9+
- Transparent hash thing
10+
- Permissions??
11+
- Directories (default files)
12+
13+
## Minimal Functionality (near-term)
14+
15+
- [ ] Invocation of journal (ledger interface) on every read/write
16+
- [ ] Hash-based storage of historical document states
17+
- [ ] Mapping between synchronic web records and stored documents
18+
- [ ] Interface for browsing historical documents
19+
- [ ] Interface for browsing remote documents
20+
21+
## Desired Features (long-term)
22+
23+
- [ ] Space-efficient compression of versioned files
24+
- [ ] Integration with enterprise-grade authentciation and authorization

compose/file-system/data-back/New Text Document.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blahdf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hey
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
networks:
2+
docker:
3+
name: docker
4+
5+
services:
6+
fuse:
7+
container_name: fuse
8+
build:
9+
context: ../../services/fuse
10+
devices:
11+
- /dev/fuse
12+
cap_add:
13+
- SYS_ADMIN
14+
security_opt:
15+
- apparmor:unconfined
16+
ports:
17+
- 445:445
18+
networks:
19+
- docker
20+
environment:
21+
SECRET: ${SECRET}
22+
SAMBA_USERNAME: ${SAMBA_USERNAME:-samba}
23+
SAMBA_SECRET: ${SAMBA_SECRET:-secret}
24+
SAMBA_SHARE: ${SAMBA_SHARE:-data}
25+
volumes:
26+
- ./data-back:/data-back
27+
28+
cryptography:
29+
image: ghcr.io/sandialabs/sync-services/cryptography:1.0.0
30+
container_name: cryptography
31+
networks:
32+
- docker
33+
34+
journal:
35+
image: ghcr.io/sandialabs/sync-services/ledger:1.0.0
36+
container_name: journal
37+
networks:
38+
- docker
39+
depends_on:
40+
- cryptography
41+
environment:
42+
SECRET: ${SECRET}
43+
PERIODICITY: ${PERIODICITY:-2}
44+
CRYPTOGRAPHY: http://cryptography.docker
45+
46+
interface:
47+
image: nginx:stable-alpine
48+
container_name: interface
49+
volumes:
50+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
51+
depends_on:
52+
- journal
53+
networks:
54+
- docker
55+
ports:
56+
- "${PORT:-8192}:80"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
(lambda (record seret)
2+
(define file-system-attributes
3+
'(lambda (ledger path)
4+
'()))
5+
6+
(define file-system-dir-read
7+
'(lambda (ledger path)
8+
'()))
9+
10+
(define file-system-dir-make!
11+
'(lambda (ledger path)
12+
'()))
13+
14+
(define file-system-dir-delete!
15+
'(lambda (ledger path)
16+
'()))
17+
18+
(define file-system-file-make!
19+
'(lambda (ledger path)
20+
'()))
21+
22+
(define file-system-file-read
23+
'(lambda (ledger path)
24+
'()))
25+
26+
(define file-system-file-write!
27+
'(lambda (ledger path value)
28+
'()))
29+
30+
(define file-system-file-delete!
31+
'(lambda (ledger path)
32+
'()))
33+
34+
(let loop ((functions '(file-system-attributes
35+
file-system-dir-read
36+
file-system-dir-make!
37+
file-system-dir-delete!
38+
file-system-file-make!
39+
file-system-file-read
40+
file-system-file-write!
41+
file-system-file-delet!)))
42+
(if (null? functions) #t
43+
;; todo: wrap the function to access ledger
44+
;; - pass in ledger instead of record
45+
;; - format path into a valid path
46+
;; - format output into "JSON" format
47+
((record 'set!) `(control local ,(car functions)) (eval (car functions)))))
48+
49+
"Installed file system extension")

compose/file-system/nginx.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
server {
2+
location /.interface {
3+
proxy_pass http://journal.docker/interface;
4+
}
5+
}

compose/file-system/notes.org

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
* conclusion
2+
- the file-system thing is just a separate use case, not general-purpose explorer
3+
* idea:
4+
- need function to check expression (maybe at control level?)
5+
* paths
6+
** reading
7+
- if symbol, then as-is
8+
- if bytes, then interpret has hex
9+
** writing
10+
- only allow writing strings
11+
- if try to write hex, then escape somehow
12+
- always create a new dummy file
13+
* values
14+
** reading
15+
- if expression, then expression
16+
- if string, then strip quotes
17+
- if bytes, then parse and print
18+
** writing
19+
- if parses as expression, then do expression
20+
- if ascii, then string
21+
- if not ascii, then bytes

compose/file-system/run.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
if [ -z "$SECRET" ]; then
4+
echo Must set the SECRET variable""
5+
exit 1
6+
fi
7+
8+
record=$( cat record.scm )
9+
control=$( cat control.scm )
10+
ledger=$( cat ledger.scm )
11+
12+
check_status() {
13+
while true; do
14+
echo "Polling for cryptography service"
15+
response=$( wget -qO - "$1" 2>/dev/null)
16+
if [ -n "$response" ]; then
17+
return 0
18+
else
19+
sleep 1
20+
fi
21+
done
22+
}
23+
24+
check_status "${CRYPTOGRAPHY}/signature/key/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
25+
26+
./journal-sdk -b "($record \"$SECRET\" $control ($ledger \"$CRYPTOGRAPHY\" #t #f) $preload)" -s "(*step* \"$SECRET\")" -p 80 -c $PERIODICITY

0 commit comments

Comments
 (0)