Skip to content

Commit fae7176

Browse files
committed
document compose setup
1 parent 1993b08 commit fae7176

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

README.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,53 @@ library code.
4646
graph of required docker images that represent the production environment.
4747

4848
`docker-compose-dev.yml` is a similar file which sets up a dev environment,
49-
with Redis and a MariaDB server for the `enwp10` database. Use it like so
49+
with Redis and a MariaDB server for the `enwp10` database. Through profiles like `zimfarm` and `zimfarm-worker`, you can start the Zimfarm containers required to execute a task.
5050

51-
```bash
52-
docker compose -f docker-compose-dev.yml up -d
53-
```
51+
### Setting up the development services
52+
53+
The dev stack has various containers which can be activated via various profiles. The `zimfarm` profile sets up a local zimfarm DB, API and UI.
54+
The `zimfarm-worker` profile sets up a local zimfarm worker manager and receiver that stores the results/files of tasks.
55+
56+
If it is your first execution of the dev stack, you need to create offliners and a "virtual" worker in Zimfarm DB. Thus, you need to start the services without the worker
57+
profile till you register a worker.
58+
59+
#### Registering a worker
60+
61+
- Start the dev stack (with only the Zimfarm API):
62+
63+
```sh
64+
docker compose -f docker-compose-dev.yml --profile zimfarm up --build
65+
```
66+
67+
This starts the API, creates an admin user with username: `admin` and password `admin`
68+
69+
- Register offliners in the database
70+
71+
```sh
72+
docker/zimfarm/create_offliners.sh
73+
```
74+
75+
This pulls the latest offliner definitions from the respective offliner repositories
76+
and registers them with the Zimfarm API. The versions of the offliner definitions
77+
are hardcoded to "dev".
78+
79+
- To register a worker
80+
81+
```sh
82+
docker/zimfarm/create_worker.sh
83+
```
84+
85+
This registers a worker with username `test_worker` and generates SSH keys for it to authenticat with the Zimfarm API
86+
87+
- If you are running with worker profile, you will need to create warehouse paths to upload the logs and files for each task.
88+
```sh
89+
docker exec -it zimfarm-receiver bash
90+
/contrib/create-warehouse-paths.sh
91+
```
92+
- To start the dev stack (with worker)
93+
```sh
94+
docker compose -f docker-compose-dev.yml --profile zimfarm --profile zimfarm-worker up --build
95+
```
5496

5597
`docker-compose-test.yml` is a another docker file which sets up the test db
5698
for python "nosetests" (unit tests). Run it similarly:
@@ -244,7 +286,7 @@ developing the frontend.
244286

245287
## Running a ZIM Farm
246288

247-
If you wish to run a ZIM Farm instance for testing purposes, the easiest way is to
289+
If you wish to run a ZIM Farm instance for testing purposes, the easiest way is to
248290
clone the zimfarm repository and then setup a development instance of it:
249291

250292
```bash

0 commit comments

Comments
 (0)