Skip to content

Commit 00b24ab

Browse files
committed
Fixing docker docs
1 parent 74958ce commit 00b24ab

File tree

2 files changed

+90
-57
lines changed

2 files changed

+90
-57
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ See: [cryptic-tui](https://github.com/etnt/cryptic-tui)
4444

4545
## Demo
4646

47-
- [Demo](https://youtu.be/R2lM5GLypc0?si=2Ux8TrRuQXZTkZFN)
48-
- [Setup the Cryptic Server](https://youtu.be/24vEPienlwE?si=O-htRZRZVKu9wySO)
49-
- [Onboard a new User](https://youtu.be/vcqmaE-D8ZA?si=CRIEiaveoTe4XMzL)
50-
- [Onboard a new User in Docker container](https://youtu.be/acNHqzHia3o?si=_4mQuE4KQooxb1UM)
47+
- [Client Setup](https://youtu.be/Wq_1-shCmso?si=3cDmipt-EKDGqacV)
48+
- [Server Setup](https://youtu.be/prfl27pbZds?si=2By0Rt2VFpaWarWR)
49+
50+
## Quick deployment
51+
52+
Follow the [containerized deployment](docs/DOCKER.md) instructions for
53+
a quick way to try out Cryptic.
5154

5255
## Documentation
5356

@@ -268,7 +271,7 @@ script can for example call `notify-send` and on Mac it can call
268271

269272
Example (Mac):
270273
```bash
271-
> ./bin/cryptic -u alice --notifier /home/alice/.cryptic/notify.sh
274+
> ./bin/cryptic -u alice --notifier $HOME/.cryptic/notify.sh
272275

273276
> cat /home/alice/.cryptic/notify.sh
274277
#!/bin/bash
@@ -292,7 +295,7 @@ external file watchers.
292295

293296
# In another terminal, watch the file
294297
> brew install fswatch
295-
> fswatch -0 ~/.cryptic/alice/cryptic-server_8443/sender.msg | xargs -0 -n1 -I{} /full/path/to/your-script.sh {}
298+
> fswatch -0 ~/.cryptic/alice/cryptic-server_8443/sender.msg | xargs -0 -n1 -I{} $HOME/.cryptic/notify.sh {}
296299
```
297300

298301
**Linux (using inotify-tools):**
@@ -302,7 +305,7 @@ external file watchers.
302305

303306
# In another terminal, watch the file
304307
> sudo apt install inotify-tools
305-
> while inotifywait -e modify ~/.cryptic/alice/cryptic-server_8443/sender.msg; do /full/path/to/your-script.sh; done
308+
> while inotifywait -e modify ~/.cryptic/alice/cryptic-server_8443/sender.msg; do $HOME/.cryptic/notify.sh; done
306309
```
307310

308311
**Docker Example:**

docs/DOCKER.md

Lines changed: 80 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,39 @@ This guide explains how to deploy the Cryptic client and or the
66

77
## Quick Deployment
88

9-
**Run the latest client image:**
9+
Video demos:
10+
- [Client Setup](https://youtu.be/Wq_1-shCmso?si=3cDmipt-EKDGqacV)
11+
- [Server Setup](https://youtu.be/prfl27pbZds?si=2By0Rt2VFpaWarWR)
1012

11-
[Video Demo](https://youtu.be/acNHqzHia3o?si=_4mQuE4KQooxb1UM)
13+
### Fetch the Docker images
1214

15+
**Start by fetching the Docker images:**
1316
```bash
14-
# Get the latest Client docker image
17+
# Get the latest Client Docker image
1518
docker pull ghcr.io/etnt/cryptic-tui:latest
1619

17-
# Create a separate GPG directory for Docker (avoids conflicts with host's keyboxd)
20+
# Get the latest Server Docker image
21+
# (only necessary of you want to run the Cryptic server)
22+
docker pull ghcr.io/etnt/cryptic:latest
23+
```
24+
25+
### Run the Client container
26+
27+
**Run the latest client image:**
28+
```bash
29+
# STEP 1: Create a separate GPG directory for Docker
1830
mkdir -p ~/.cryptic-gpg
1931

20-
# Run the Cryptic Onboarding script
21-
# 1. Generate a GPG key pair (stored in ~/.cryptic-gpg on host)
32+
# STEP 2: Run the Cryptic Onboarding script
33+
# 1. Generate a GPG key pair (stored in ~/.cryptic-gpg on Host)
2234
# 2. Export the generated key
23-
# 3. Send the key and fingerprint to the admin
24-
# 4. WAIT! - Do not exit the onboard script until certificate is received
25-
# 5. When admin has registered your key: Request a TLS certificate from server
26-
# If your server is running on localhost on your Host machine, specify:
27-
# cryptic-server as your server address (see the: `--add-host` below)
28-
# 6. Exit the onboard script
35+
# 3. Send the key (and fingerprint) to the admin
36+
# 4. When admin has registered your key:
37+
# - Request a TLS certificate from server
38+
# - If your server is running on localhost on your Host machine, specify:
39+
# cryptic-server as your server address (see the: `--add-host` below)
40+
# 5. Exit the onboard script
41+
#
2942
# You should now see your certificates at ~/.cryptic/<user>/cryptic-server_<port>
3043
#
3144
# NOTE: We use ~/.cryptic-gpg instead of ~/.gnupg because modern macOS/Linux
@@ -38,58 +51,61 @@ docker run -it --rm --name cryptic-client \
3851
ghcr.io/etnt/cryptic-tui:latest sh -c 'cryptic --onboard'
3952

4053
# Start the Cryptic client with your username (e.g `bob`)
41-
# You'll be prompted for a Passphrase which is used to encrypt your local DB
42-
43-
# Method 1: Using environment variables
44-
docker run -it --rm --name cryptic-client \
45-
-v ~/.cryptic:/home/cryptic/.cryptic \
46-
-v ~/.cryptic-gpg:/home/cryptic/.gnupg \
47-
--add-host=cryptic-server:host-gateway \
48-
-e CRYPTIC_USERNAME=bob \
49-
-e CRYPTIC_ENABLE_DB=true \
50-
ghcr.io/etnt/cryptic-tui:latest
51-
52-
# Method 2: Using command-line flags
53-
# (but here also increase log output details)
54+
# - You'll be prompted for a Passphrase which is used to encrypt your local DB
55+
# - Here we also increase the log output details
56+
# - The incoming sender's username will be written to the file: sender.msg
5457
docker run -it --rm --name cryptic-client \
5558
-v ~/.cryptic:/home/cryptic/.cryptic \
5659
-v ~/.cryptic-gpg:/home/cryptic/.gnupg \
5760
--add-host=cryptic-server:host-gateway \
5861
-e CRYPTIC_DEBUG=true \
59-
ghcr.io/etnt/cryptic-tui:latest sh -c 'cryptic -u bob --enable-db --tui'
62+
ghcr.io/etnt/cryptic-tui:latest \
63+
sh -c 'cryptic -u bob --enable-db --file-notify sender.msg --tui'
64+
65+
# To get notified of incoming messages, run (on MAC):
66+
# - brew install fswatch terminal-notifier
67+
fswatch -0 ~/.cryptic/bob/cryptic-server_8443/sender.msg | xargs -0 -n1 -I{} $HOME/.cryptic/notify_script.sh {}
68+
69+
# Content of notification script
70+
> cat $HOME/.cryptic/notify_script.sh
71+
#!/bin/bash
72+
terminal-notifier -title "Cryptic" -message "Cryptic message from: $1" -sound Pong
6073
```
6174

62-
**Run the latest server image:**
6375

64-
```bash
65-
# Get the latest Server docker image
66-
docker pull ghcr.io/etnt/cryptic:latest
76+
### Run the Server container
6777

68-
# Create a directory for storing all Cryptic server data
78+
**Run the latest server image:**
79+
```bash
80+
# STEP 1: Create a directory for storing all Cryptic server data
6981
mkdir -p ~/.cryptic_server
7082
cd ~/.cryptic_server
7183

72-
# Step 1: Generate CA and server certificates (one-time setup)
84+
# STEP 2: Generate CA and server certificates (one-time setup)
7385
# This will prompt for optional DNS Subject Alternative Names (SANs)
7486
docker run -it --rm \
75-
--entrypoint '' \
76-
-v $(pwd):/opt/cryptic/server_data \
77-
-e CRYPTIC_SERVER_DIR=/opt/cryptic/server_data \
78-
ghcr.io/etnt/cryptic:latest \
79-
sh -c 'DIR="${CRYPTIC_SERVER_DIR}/priv/ssl" generate-mtls-certs.sh'
87+
--entrypoint '' \
88+
-v $(pwd):/opt/cryptic/server_data \
89+
-e CRYPTIC_SERVER_DIR=/opt/cryptic/server_data \
90+
ghcr.io/etnt/cryptic:latest \
91+
sh -c 'DIR="${CRYPTIC_SERVER_DIR}/priv/ssl" generate-mtls-certs.sh'
92+
8093

81-
# Step 2: Bootstrap the first admin user
82-
# Generate a GPG key on your host (if you don't have one)
83-
# No passphrase needed - it's only used for signing CSRs
84-
gpg --quick-generate-key 'alice <alice@cryptic.local>' rsa4096
94+
# STEP 3: Bootstrap the first admin user (one-time setup)
95+
# Generate and Export a GPG key for the admin user
96+
# Take note of the name of the exported filename
97+
mkdir -p ~/.cryptic ~/.cryptic-gpg
98+
docker run -it --rm --name cryptic-client \
99+
-v ~/.cryptic:/home/cryptic/.cryptic \
100+
-v ~/.cryptic-gpg:/home/cryptic/.gnupg \
101+
--add-host=cryptic-server:host-gateway \
102+
ghcr.io/etnt/cryptic-tui:latest sh -c 'cryptic --onboard'
85103

86-
# Export your GPG public key to the bootstrap directory
87-
mkdir -p priv/ca/bootstrap
88-
gpg --armor --export alice@cryptic.local > priv/ca/bootstrap/alice.gpg
104+
# STEP 4: Copy the exported GPG key where Cryptic will find it
105+
mkdir -p ~/.cryptic_server/priv/ca/bootstrap
106+
cp ~/.cryptic/gpg-export/<filename> ~/.cryptic_server/priv/ca/bootstrap/admin.gpg
89107

90-
# Step 3: Run the server
91-
# All server data (priv/, logs/, data/) will be in ~/.cryptic_server/
92-
# Note: Mount to /opt/cryptic/server_data (not /opt/cryptic which contains the Erlang release)
108+
# STEP 5: Run the server
93109
# For debug log output, add: -e CRYPTIC_DEBUG=true
94110
docker run -d \
95111
--name cryptic-server \
@@ -99,11 +115,25 @@ docker run -d \
99115
-e CRYPTIC_SERVER_DIR=/opt/cryptic/server_data \
100116
ghcr.io/etnt/cryptic:latest
101117

102-
# Check server logs (you'll see certificate information on first start)
103-
docker logs -f cryptic-server
118+
# STEP 6: Connect (login) the admin user
119+
# See `Run the Client container` above
120+
121+
# Check the server logs
122+
docker logs cryptic-server
123+
tail -f ./logs/server.log
104124

105125
# Stop the server and remove the container
106-
docker stop cryptic-server && docker rm cryptic-server
126+
docker stop cryptic-server
127+
docker rm cryptic-server
128+
129+
# Remove all server data
130+
rm -rf ~/.cryptic_server
131+
132+
# Remove all GPG keys
133+
rm -rf ~/.cryptic-gpg
134+
135+
# Remove all user data
136+
rm -rf ~/.cryptic
107137
```
108138

109139
### Manual Certificate Generation (Optional)

0 commit comments

Comments
 (0)