File tree Expand file tree Collapse file tree 13 files changed +47
-782
lines changed
Expand file tree Collapse file tree 13 files changed +47
-782
lines changed Original file line number Diff line number Diff line change 3232 - name : Retag and push latest Docker image
3333 if : github.ref == 'refs/heads/main'
3434 run : |
35+ cd ./services/cryptography
3536 docker tag ghcr.io/${{ github.repository }}/cryptography:$( cargo pkgid | cut -d '@' -f 2 ) \
3637 ghcr.io/${{ github.repository }}/cryptography:latest
3738 docker push ghcr.io/${{ github.repository }}/cryptography:latest
Original file line number Diff line number Diff line change 1+ FROM ghcr.io/sandialabs/sync-journal/journal-sdk:1.0.1
2+
3+ RUN wget https://raw.githubusercontent.com/sandialabs/sync-records/refs/heads/main/lisp/record.scm
4+ RUN wget https://raw.githubusercontent.com/sandialabs/sync-records/refs/heads/main/lisp/control.scm
5+ RUN wget https://raw.githubusercontent.com/sandialabs/sync-records/refs/heads/main/lisp/ledger.scm
6+
7+ COPY run.sh .
8+
9+ CMD ./run.sh
Original file line number Diff line number Diff line change @@ -11,14 +11,13 @@ This repository contains materials to deploy a single ledger journal using Docke
1111
1212Please set the following environmental variables to configure the notary journal.
1313
14+ - ` SECRET ` (required): a string used to generate authentication credentials
1415- ` PORT ` : port number to forward on the host machine (default:8192)
15- - ` SEED ` (required): a 32-byte hex string used to identify and authenticate journal requests
1616- ` PERIODICITY ` : a nonnegative integer that determines the period of each synchronization step where period = 2 ^ PERIODICITY
17- - ` NOTARY ` : a URL pointing to an instance of a synchronic web notary
1817
1918## Start
2019
21- ` $ docker compose up `
20+ ` $ SECRET=password PORT=80 docker compose up --build `
2221
2322## End
2423
Original file line number Diff line number Diff line change @@ -4,28 +4,36 @@ networks:
44
55services :
66 cryptography :
7- image : synchronic-web/cryptography-service:latest
7+ image : ghcr.io/sandialabs/sync-services/cryptography:1.0.0
8+ container_name : cryptography
89 networks :
910 - docker
1011
1112 journal :
12- image : synchronic-web/synchronic-web/journal-sdk:latest
13- volumes :
14- - ./source.scm:/srv/source.scm
15- - ./run.sh:/srv/run.sh
13+ build :
14+ context : .
15+ container_name : journal
1616 networks :
1717 - docker
1818 depends_on :
1919 - cryptography
2020 environment :
21- SEED : ${SEED }
21+ SECRET : ${SECRET }
2222 PERIODICITY : ${PERIODICITY:-2}
2323 CRYPTOGRAPHY : http://cryptography.docker
24- REST : ' "$NOTARY"'
25- command : ./run.sh
24+
25+ explorer :
26+ image : ghcr.io/sandialabs/sync-services/explorer:1.0.0
27+ container_name : explorer
28+ networks :
29+ - docker
30+ depends_on :
31+ - journal
32+ command : python service.py --secret $SECRET --journal http://journal.docker/interface --port 80
2633
2734 interface :
2835 image : nginx:stable-alpine
36+ container_name : interface
2937 volumes :
3038 - ./nginx.conf:/etc/nginx/conf.d/default.conf
3139 depends_on :
Original file line number Diff line number Diff line change 11server {
2- location / {
2+ location /.interface {
33 proxy_pass http ://journal.docker/interface;
44 }
5+ location / {
6+ proxy_pass http ://explorer.docker;
7+ }
58}
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- if [ -z " $SEED " ]; then
4- echo Must set the secret SEED variable" "
3+ if [ -z " $SECRET " ]; then
4+ echo Must set the SECRET variable" "
55 exit 1
66fi
77
8+ record=$( cat record.scm )
9+ control=$( cat control.scm )
10+ ledger=$( cat ledger.scm )
11+
812check_status () {
913 while true ; do
10- response=$( wget -qO - " $1 " 2> /dev/null)
11- if [ -n " $response " ]; then
12- return 0
13- else
14+ echo " Polling for cryptography service"
15+ response=$( wget -qO - " $1 " 2> /dev/null)
16+ if [ -n " $response " ]; then
17+ return 0
18+ else
1419 sleep 1
15- fi
16- done
17- }
18-
19- check_status " ${CRYPTOGRAPHY} /signature/key/${SEED} "
20-
21- routine () {
22- check_status " localhost/"
23-
24- while true ; do
25- start_time=$( date +%s)
26- response=$( wget -qO - localhost/interface --post-data " (step \" $SEED \" )" )
27- echo $response >> steps.log
28- next_time=$(( start_time + $(( 2 ** $PERIODICITY )) ))
29- current_time=$( date +%s)
30- sleep_duration=$(( next_time - current_time))
31- if [ $sleep_duration -gt 0 ]; then
32- sleep $sleep_duration
33- fi
20+ fi
3421 done
3522}
3623
37- routine &
24+ check_status " ${CRYPTOGRAPHY} /signature/key/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef "
3825
39- ./journal-sdk -p 80 --database db --boot " ($( cat source.scm ) \" $SEED \" $PERIODICITY \" $CRYPTOGRAPHY \" $REST ) "
26+ ./journal-sdk -b " ($record \" $SECRET \" $control ( $ledger \" $CRYPTOGRAPHY \" #t #f)) " -s " (*step* \" $SECRET \" ) " -p 80 -c $PERIODICITY
You can’t perform that action at this time.
0 commit comments