Skip to content

Commit 1a9cc97

Browse files
committed
added extra information on how to deploy charms and append to AGENTS.md in dockerfile, fixed formatting
1 parent 184c547 commit 1a9cc97

File tree

3 files changed

+128
-18
lines changed

3 files changed

+128
-18
lines changed

packages/ralph/DEPLOY.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Deploying and Testing a Charm
2+
3+
This guide provides step-by-step instructions for deploying a charm locally and
4+
testing it with Playwright.
5+
6+
## Step 1: Create an Identity Key
7+
8+
First, create an identity key if one doesn't exist:
9+
10+
```bash
11+
NO_COLOR=1 deno task ct id new > my.key
12+
```
13+
14+
This creates a new identity key file named `my.key` in the current directory.
15+
16+
## Step 2: Deploy the Charm
17+
18+
Deploy a charm to localhost using the `ct charm new` command:
19+
20+
```bash
21+
deno task ct charm new --identity ./my.key --api-url http://127.0.0.1:8000 --space <SPACE_NAME> <PATH_TO_CHARM_FILE>
22+
```
23+
24+
Example:
25+
26+
```bash
27+
deno task ct charm new --identity ./my.key --api-url http://127.0.0.1:8000 --space ellyse ./packages/patterns/counter.tsx
28+
```
29+
30+
The command will output a charm ID (e.g.,
31+
`baedreidon464mghox4uar46bbym5t6bnmlvn6wwzby5vvdmsw24oxaalp4`).
32+
33+
## Step 3: Construct the URL
34+
35+
The URL format for localhost is:
36+
37+
```
38+
http://localhost:5173/<SPACE_NAME>/<CHARM_ID>
39+
```
40+
41+
Example:
42+
43+
```
44+
http://localhost:5173/ellyse/baedreidon464mghox4uar46bbym5t6bnmlvn6wwzby5vvdmsw24oxaalp4
45+
```
46+
47+
## Step 4: Test with Playwright
48+
49+
### 4.1 Navigate to the Charm URL
50+
51+
```javascript
52+
await page.goto("http://localhost:5173/<SPACE_NAME>/<CHARM_ID>");
53+
```
54+
55+
### 4.2 Register/Login (First Time Only)
56+
57+
When you first visit, you'll see a login page. Register with a passphrase:
58+
59+
1. Click the "➕ Register" button
60+
2. Click the "🔑 Generate Passphrase" button
61+
3. Click the "🔒 I've Saved It - Continue" button
62+
63+
This will log you in and load the charm.
64+
65+
### 4.3 Test the Charm
66+
67+
Once logged in, you can interact with the charm using Playwright commands.
68+
69+
## Complete Example
70+
71+
```bash
72+
# 1. Create identity key (if needed)
73+
deno task ct id new > my.key
74+
75+
# 2. Deploy charm
76+
deno task ct charm new --identity ./my.key --api-url http://127.0.0.1:8000 --space ellyse ./packages/patterns/counter.tsx
77+
78+
# Output: baedreidon464mghox4uar46bbym5t6bnmlvn6wwzby5vvdmsw24oxaalp4
79+
80+
# 3. URL will be:
81+
# http://localhost:5173/ellyse/baedreidon464mghox4uar46bbym5t6bnmlvn6wwzby5vvdmsw24oxaalp4
82+
```
83+
84+
Then use Playwright to:
85+
86+
1. Navigate to the URL
87+
2. Complete registration (first time)
88+
3. Test the charm functionality

packages/ralph/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ WORKDIR /app
7171
RUN git clone https://github.com/commontoolsinc/labs.git /app/labs && \
7272
chown -R ralph:ralph /app/labs
7373

74+
# Copy and append DEPLOY.md to AGENTS.md
75+
COPY --chown=ralph:ralph DEPLOY.md /tmp/DEPLOY.md
76+
RUN cat /tmp/DEPLOY.md >> /app/labs/AGENTS.md && \
77+
rm /tmp/DEPLOY.md
78+
7479
# Copy the startup script from local directory
7580
COPY --chown=ralph:ralph start-servers.sh /app/start-servers.sh
7681
RUN chmod +x /app/start-servers.sh

packages/ralph/README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# README
2+
23
Docker container to run the Common Tools servers
34

45
Ability to run [Ralph](https://ghuntley.com/ralph/)
@@ -8,44 +9,60 @@ Claude CLI and Codex are installed
89
## How to run Ralph
910

1011
Running Docker locally (not pushing changes to repositories):
12+
1113
```bash
1214
$ cd ./packages/ralph
1315
$ docker build -t ralph .
1416
$ docker run -d --name ralph ralph
15-
1617
```
18+
1719
Note for `docker build`:
18-
* -t is for the tag, we use *ralph* here
20+
21+
- -t is for the tag, we use _ralph_ here
1922

2023
Note for `docker run`:
21-
* -d is for detached mode
22-
* --name gives it an easier name to use for connecting to it later
23-
* the last *ralph* referes to the build tag we used earlier
24+
25+
- -d is for detached mode
26+
- --name gives it an easier name to use for connecting to it later
27+
- the last _ralph_ referes to the build tag we used earlier
2428

2529
Connecting to the running container:
30+
2631
```bash
2732
$ docker exec -it ralph bash
2833
```
34+
2935
We are using the `--name ralph` we specified earlier to connect.
3036

37+
Running Claude Code with all permissions:
38+
39+
```bash
40+
$ claude --dangerously-skip-permissions
41+
```
42+
3143
## Removing ralph
44+
3245
You must remove the existing version if you want to run a newer build:
46+
3347
```bash
3448
$ docker stop ralph
3549
$ docker rm ralph
3650
```
3751

3852
## TODO
39-
* add playwright to codex
40-
* configure tailscale to start up
41-
* push a working image to a docker hub
42-
* update README to use image from dockerhub
43-
* figure out how LLM tokens should be set for toolshed
44-
* DONE - Add codex and claude packages
45-
* DONE - write section how to run ralph in this file
46-
* DONE - git clone the common tools repositories
47-
* DONE - start up toolshed server
48-
* DONE - start up shell server
49-
* DONE - add playwright mcp to claude
50-
* created ralph user since chrome doesnt like to run as root, probably better this way anyway
51-
* made ralph sudoer
53+
54+
- add playwright to codex
55+
- configure tailscale to start up
56+
- push a working image to a docker hub
57+
- update README to use image from dockerhub
58+
- figure out how LLM tokens should be set for toolshed
59+
- sandbox the container (network config)
60+
- DONE - Add codex and claude packages
61+
- DONE - write section how to run ralph in this file
62+
- DONE - git clone the common tools repositories
63+
- DONE - start up toolshed server
64+
- DONE - start up shell server
65+
- DONE - add playwright mcp to claude
66+
- created ralph user since chrome doesnt like to run as root, probably better
67+
this way anyway
68+
- made ralph sudoer

0 commit comments

Comments
 (0)