Skip to content

Commit 18f478b

Browse files
committed
chore(docker): add one-command local test compose
Add compose-local-test.yml to run onlogs, docker-socket-proxy, and logprinter together. Document local docker testing commands in README.
1 parent c3d7bcf commit 18f478b

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,30 @@ Once done, just go to <your host> and login as "admin" with <any password>.
9494
### Docket socket URL
9595
By default the app will connect using the raw unix socket. But this can be overriden via the ENV variable `DOCKER_HOST`. That way you can specify fully qualified URL to the socket or URL of an docker socket proxy.
9696

97-
In `compose-socket-proxy.yml` you can see a sample compose file for starting the socket proxy. To use it in the app set `DOCKER_HOST=http://localhost:2375` in the ENV.
97+
In `compose-socket-proxy.yml` you can see a sample compose file for starting the socket proxy. To use it in the app set `DOCKER_HOST=http://localhost:2375` in the ENV.
98+
99+
## Local Docker testing
100+
101+
Use the local test compose to run `onlogs + socket-proxy + logprinter` together:
102+
103+
```sh
104+
cd application
105+
docker compose -f compose-local-test.yml up --build
106+
```
107+
108+
Open `http://localhost:2874` and login with:
109+
110+
- Username: `admin`
111+
- Password: `admin`
112+
113+
Stop containers:
114+
115+
```sh
116+
docker compose -f compose-local-test.yml down
117+
```
118+
119+
Stop and remove volumes too (clean state):
120+
121+
```sh
122+
docker compose -f compose-local-test.yml down -v
123+
```

application/compose-local-test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: onlogs-local-test
2+
3+
services:
4+
docker-socket-proxy:
5+
image: tecnativa/docker-socket-proxy:0.3.0
6+
container_name: docker-proxy
7+
restart: unless-stopped
8+
volumes:
9+
- /var/run/docker.sock:/var/run/docker.sock:ro
10+
environment:
11+
- POST=0
12+
- DELETE=0
13+
- PUT=0
14+
- GET=1
15+
- CONTAINERS=1
16+
17+
onlogs:
18+
build:
19+
context: .
20+
dockerfile: Dockerfile
21+
image: onlogs:local
22+
container_name: onlogs-local
23+
restart: unless-stopped
24+
depends_on:
25+
- docker-socket-proxy
26+
ports:
27+
- "2874:2874"
28+
environment:
29+
- ADMIN_USERNAME=admin
30+
- ADMIN_PASSWORD=admin
31+
- ENV_NAME=local
32+
- PORT=2874
33+
- DOCKER_HOST=http://docker-socket-proxy:2375
34+
- DOCKER_API_VERSION=1.46
35+
- MAX_LOGS_SIZE=10GB
36+
volumes:
37+
- onlogs-leveldb:/leveldb
38+
- /etc/hostname:/etc/hostname:ro
39+
40+
logprinter:
41+
build:
42+
context: ./logs_generator
43+
dockerfile: Dockerfile
44+
image: logprinter:local
45+
container_name: logprinter
46+
restart: unless-stopped
47+
48+
volumes:
49+
onlogs-leveldb:

0 commit comments

Comments
 (0)