Skip to content

Commit be331fe

Browse files
docs: little admin server on port 5999 (#225)
Signed-off-by: David Dal Busco <[email protected]>
1 parent aa01dc9 commit be331fe

File tree

1 file changed

+61
-21
lines changed

1 file changed

+61
-21
lines changed

docs/guides/local-development.md

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ services:
4545
image: junobuild/satellite:latest
4646
ports:
4747
- 5987:5987
48+
- 5999:5999
4849
volumes:
4950
- my_dapp:/juno/.juno
5051
- ./juno.dev.config.json:/juno/juno.dev.config.json
@@ -94,7 +95,11 @@ Modify the following information of the `docker-compose.yml` file to tweak the c
9495

9596
### Ports
9697

97-
The default port is 5987. If, for example, you would like to use port 8080, modify the value `5987:5987` to `8080:5987`. The latter is the port exposed by the container.
98+
The default port `5987` is used for communication with the locally deployed satellites and other modules in the local environment (replica). This is the primary port for interaction with the application.
99+
100+
The container also exposes a small admin server for internal management on port `5999`.
101+
102+
If you want to use a different port, such as 8080, update for example the mapping from `5987:5987` to `8080:5987`, where the first value (8080) is the port you can call, and the second (5987) is the actual container port.
98103

99104
### Volumes
100105

@@ -114,6 +119,7 @@ services:
114119
image: junobuild/satellite:latest
115120
ports:
116121
- 5987:5987
122+
- 5999:5999
117123
volumes:
118124
- hello_world:/juno/.juno # <-------- hello_world modified here
119125
- ./juno.dev.config.json:/juno/juno.dev.config.json
@@ -148,6 +154,7 @@ export interface Rule {
148154
maxSize?: number;
149155
maxCapacity?: number;
150156
mutablePermissions: boolean;
157+
maxTokens?: number;
151158
}
152159
153160
export type SatelliteDevDbCollection = Omit<
@@ -184,37 +191,39 @@ export interface JunoDevConfig {
184191

185192
If, for example, we want to configure a "metadata" collection in the Datastore, a "content" collection in the Storage, and provide an additional controller, we could use the following configuration:
186193

187-
```json title="juno.dev.config.json"
188-
{
189-
"satellite": {
190-
"collections": {
191-
"db": [
194+
```typescript title="juno.dev.config.ts"
195+
import { defineDevConfig } from "@junobuild/config";
196+
197+
export default defineDevConfig(() => ({
198+
satellite: {
199+
collections: {
200+
db: [
192201
{
193-
"collection": "metadata",
194-
"read": "managed",
195-
"write": "managed",
196-
"memory": "stable",
197-
"mutablePermissions": true
202+
collection: "metadata",
203+
read: "managed",
204+
write: "managed",
205+
memory: "stable",
206+
mutablePermissions: true
198207
}
199208
],
200-
"storage": [
209+
storage: [
201210
{
202-
"collection": "content",
203-
"read": "public",
204-
"write": "public",
205-
"memory": "stable",
206-
"mutablePermissions": true
211+
collection: "content",
212+
read: "public",
213+
write: "public",
214+
memory: "stable",
215+
mutablePermissions: true
207216
}
208217
]
209218
},
210-
"controllers": [
219+
controllers: [
211220
{
212-
"id": "535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe",
213-
"scope": "admin"
221+
id: "535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe",
222+
scope: "admin"
214223
}
215224
]
216225
}
217-
}
226+
}));
218227
```
219228

220229
### Path and name
@@ -227,6 +236,7 @@ services:
227236
image: junobuild/satellite:latest
228237
ports:
229238
- 5987:5987
239+
- 5999:5999
230240
volumes:
231241
- my_dapp:/juno/.juno
232242
- /your/custom/path/your_config_file.json:/juno/juno.dev.config.json # <-------- Modify location and file name of the left hand part
@@ -274,3 +284,33 @@ await initSatellite({
274284
container: true
275285
});
276286
```
287+
288+
---
289+
290+
## Tips and Tricks
291+
292+
The admin server running on port `5999` provides a variety of internal management. Below are some tips and example scripts to make use of this little server.
293+
294+
### Example: Get ICP
295+
296+
You might want to transfer some ICP from the ledger to a specified principal, which can be particularly useful when you're just getting started developing your app and no users currently own ICP. This can be achieved by querying:
297+
298+
```
299+
http://localhost:5999/ledger/transfer/?to=$PRINCIPAL
300+
```
301+
302+
For example, you can use the following script:
303+
304+
```bash
305+
#!/usr/bin/env bash
306+
307+
# Check if a principal is passed as an argument; otherwise, prompt for it
308+
if [ -z "$1" ]; then
309+
read -r -p "Enter the Wallet ID (owner account, principal): " PRINCIPAL
310+
else
311+
PRINCIPAL=$1
312+
fi
313+
314+
# Make a transfer request to the admin server
315+
curl "http://localhost:5999/ledger/transfer/?to=$PRINCIPAL"
316+
```

0 commit comments

Comments
 (0)