Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3e9bf52
feat-searchfs > staging: added options for safety limits
raj-open Nov 1, 2025
a2dd8e6
feat-searchfs > staging: established script to create mock data
raj-open Nov 1, 2025
4f97f63
feat-searchfs > staging: made fields compulsory
raj-open Nov 1, 2025
a48234e
feat-searchfs > staging: cleaned up volume binding
raj-open Nov 1, 2025
649fe18
feat-searchfs > staging: added stub for main step in feature
raj-open Nov 1, 2025
4d475f3
feat-searchfs > staging: updated template
raj-open Nov 1, 2025
28b5ad8
feat-searchfs > staging: added recursive search **algorithm**
raj-open Nov 1, 2025
9d66ee3
feat-searchfs > staging: cleaned up trait - some methods should be me…
raj-open Nov 1, 2025
0bbae8c
feat-searchfs > staging: applied algorithm with safeguards
raj-open Nov 1, 2025
df6c6a4
feat-searchfs > staging: added `ignore` field to filter tasks
raj-open Nov 2, 2025
6fe45fd
feat-searchfs > staging: updated templates
raj-open Nov 2, 2025
14cfa01
feat-searchfs > staging: added method to setup hub
raj-open Nov 2, 2025
a926f0a
feat-searchfs > staging: integrated logging to `rabbit mq` + refacto…
raj-open Nov 2, 2025
0742e52
feat-searchfs > staging: corrected port bindings + hostname, assigned…
raj-open Nov 2, 2025
c30a5cb
feat-searchfs > staging: updated README instructions
raj-open Nov 2, 2025
f9faf15
Merge pull request #3 from raj-open/feat-searchfs
raj-open Nov 2, 2025
a579a74
staging > main: VERSION bump (minor)
raj-open Nov 2, 2025
11a6154
staging > main: `bugfix` - corrected ip-handling and port bindings to…
raj-open Nov 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 76 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ which assumes that the .env file has been correctly set up.
One can then either call

```bash
just run-server
just start-server
```

to start the server
(which can be interacted with via Postman and/or cURL commands)
or else use the CLI:

```bash
just run-cli --help # displays usage
just run-cli version # displays version
just run-cli SEARCH-FS # runs the main feature
just run --help # displays usage
just run version # displays version
just run SEARCH-FS # runs the main feature
```

### Usage with docker ###
Expand Down Expand Up @@ -162,3 +162,75 @@ Password: ${HTTP_GUEST_PASSWORD_RABBIT}
1. Start the queue (see [above](#activationdeactivation-of-queue)).

2. Use the CLI commands or the API with/without docker (see [above](#usage-of-main-application)).

## Testing ##

### Mock data ###

To generate mock data one may call for examples

```bash
rm -rf "data/example"
just create-mocks \
--path "data/example" \
--max-depth 10 \
--max-folders 100 \
--max-files 1000
```

which creates a fresh relative directory `data/examples`,
consisting of at most roughly 1000 files and 100 folders,
and not exceeding a depth of 10.

### Request ###

Fill in `setup/requests.yaml` as follows:

```yaml
label: 'Mock example'

# apply some generous limits
options:
max-depth: 100
max-count: 10_000_000
max-time: 00:05:00

data:
# the locaiton of the mock directory
inputs:
location: OS
path: 'data/example'
```

### Execution ###

1. Start the queue (see [above](#activationdeactivation-of-queue)).

2. Ensure that the queue-users are registered (see [above](#set-up-users)).

3. Use the CLI commands or the API with/without docker (see [above](#usage-of-main-application)).

4. Run the feature:

- For the CLI option, call

```bash
just run SEARCH-FS
```

- For the FastApi options (with or without docker),
make a POST-call (e.g. in [Postman](https://www.postman.com))
against the endpoint `/feature/search-fs`
using the JSON-body

```json
{
"ref": {
"location": "OS",
"path": "setup/requests.yaml"
}
}
```

The file reference in this body can of course be a json
and located anywhere on your system.
2 changes: 1 addition & 1 deletion dist/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
50 changes: 23 additions & 27 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ services:
# - ./pyproject.toml://home/basicuser/app/pyproject.toml:ro
# - ./justfile://home/basicuser/app/justfile:ro

networks: [default]
ports:
# HOST-IP:HOST-PORT:CONTAINER (note: uses values in .env)
- ${DOCKER_HOST_IP}:${DOCKER_HOST_PORT}:${DOCKER_CONTAINER_PORT}

tty: true
stdin_open: true

healthcheck:
# time before first healthcheck
start_period: 30s
Expand All @@ -149,14 +147,16 @@ services:
curl -f "${HTTP_IP}:${HTTP_PORT}/ping" || exit 1
'

tty: false
stdin_open: true
user: basicuser
# restart: unless-stopped
restart: no
# entrypoint: "//home/basicuser/app/scripts/entrypoint.sh"
command: |-
bash --login -c '
source /run/secrets/credentials
just run-server
just start-server
'

# --------------------------------
Expand Down Expand Up @@ -186,7 +186,7 @@ services:
echo "success"
'

queue-server:
queue-server: &ref_queue-server
image: local/examplerabbitmq:queue # <- i.e. use this image
hostname: ${HTTP_HOST_NAME_RABBIT}

Expand All @@ -198,49 +198,45 @@ services:
- credentials

volumes:
- ${PATH_LOGS_QUEUE}://var/log/rabbitmq:rw
- ${PATH_LOGS_QUEUE_STATE}://var/lib/rabbitmq:rw
- type: bind
source: ${PATH_LOGS_QUEUE}
target: //var/log/rabbitmq
- type: bind
source: ${PATH_LOGS_QUEUE_STATE}
target: //var/lib/rabbitmq

networks: [default]
ports:
# HOST-IP:HOST-PORT:CONTAINER (note: uses values in .env)
# communication
# queue communication
- ${DOCKER_HOST_IP}:${DOCKER_HOST_PORT_RABBIT_QUEUE}:${DOCKER_CONTAINER_PORT_RABBIT_QUEUE}
# admin web
# queue admin
- ${DOCKER_HOST_IP}:${DOCKER_HOST_PORT_RABBIT_WEB}:${DOCKER_CONTAINER_PORT_RABBIT_WEB}

# restart: always
command: |-
rabbitmq-server

queue-admin:
image: local/examplerabbitmq:queue # <- i.e. use this image

env_file:
- .env
- .env.docker-vars

secrets:
- credentials

volumes:
- ${PATH_LOGS_QUEUE}://var/log/rabbitmq:rw
- ${PATH_LOGS_QUEUE_STATE}://var/lib/rabbitmq:rw

networks:
- default

tty: true
stdin_open: true
<<: *ref_queue-server
hostname: "admin"
depends_on:
- queue-server
networks: [default]
ports: []
tty: true
stdin_open: true
command: |-
bash --login -c '
source /run/secrets/credentials
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} list_users

# create admin
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} delete_user $${HTTP_ADMIN_USER_RABBIT} 2> /dev/null
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} add_user $${HTTP_ADMIN_USER_RABBIT} $${HTTP_ADMIN_PASSWORD_RABBIT}
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} set_permissions -p / $${HTTP_ADMIN_USER_RABBIT} ".*" ".*" ".*"
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} set_user_tags $${HTTP_ADMIN_USER_RABBIT} administrator

# create guest
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} delete_user $${HTTP_GUEST_USER_RABBIT} 2> /dev/null
rabbitmqctl --node rabbit@${HTTP_HOST_NAME_RABBIT} add_user $${HTTP_GUEST_USER_RABBIT} $${HTTP_GUEST_PASSWORD_RABBIT}
Expand Down
3 changes: 2 additions & 1 deletion docs/models/application/Models/RequestTask.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
| **label** | **String** | Label of task | [default to null] |
| **options** | [**Map**](AnyType.md) | Structure of requests payload &gt; options NOTE: not yet implemented | [default to null] |
| **ignore** | **Boolean** | | [optional] [default to false] |
| **options** | [**RequestTaskOptions**](RequestTaskOptions.md) | | [default to null] |
| **data** | [**RequestTaskData**](RequestTaskData.md) | | [default to null] |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
11 changes: 11 additions & 0 deletions docs/models/application/Models/RequestTaskOptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RequestTaskOptions
## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
| **max-depth** | **Integer** | Limits the search depth | [optional] [default to 50] |
| **max-items** | **Integer** | Limits the amount of items that can be found | [optional] [default to 1000000] |
| **max-duration** | **String** | Limits the amount of time spent for a search | [default to null] |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

3 changes: 2 additions & 1 deletion docs/models/application/Models/RequestsPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
| **label** | **String** | Label of task | [default to null] |
| **options** | [**Map**](AnyType.md) | Structure of requests payload &gt; options NOTE: not yet implemented | [default to null] |
| **ignore** | **Boolean** | | [optional] [default to false] |
| **options** | [**RequestTaskOptions**](RequestTaskOptions.md) | | [default to null] |
| **data** | [**RequestTaskData**](RequestTaskData.md) | | [default to null] |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
1 change: 1 addition & 0 deletions docs/models/application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ All URIs are relative to *https://acme.org*
- [RepoInfo_urls](./Models/RepoInfo_urls.md)
- [RequestTask](./Models/RequestTask.md)
- [RequestTaskData](./Models/RequestTaskData.md)
- [RequestTaskOptions](./Models/RequestTaskOptions.md)
- [RequestsPayload](./Models/RequestsPayload.md)


Expand Down
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ build-docs:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# run in cli mode
run-cli *args:
run *args:
@{{PYVENV_ON}} && {{PYVENV}} -m src.cli {{args}}

# run via fast api
run-server env_path=".env" log_path="${PATH_LOGS}":
start-server env_path=".env" log_path="${PATH_LOGS}":
@{{PYVENV_ON}} && {{PYVENV}} -m src.api \
--env "{{env_path}}" \
--log "{{log_path}}"
Expand Down Expand Up @@ -294,8 +294,8 @@ check-time-matches-cron cron_expr time="*":
@{{PYVENV_ON}} && {{PYVENV}} -m scripts.cron "{{cron_expr}}" --time "{{time}}"

# Recipe only works if local file scripts/mocks.py exists
mocks *args:
@{{PYVENV_ON}} && {{PYVENV}} -m scripts.mocks
create-mocks *args:
@{{PYVENV_ON}} && {{PYVENV}} -m scripts.mocks {{args}}

# --------------------------------
# TARGETS: terminate execution
Expand Down
23 changes: 22 additions & 1 deletion models/schema-application.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.3
info:
version: "0.1.0"
version: "0.2.0"
title: General models for application
description: |-
Schemata for data models in application - configs, enums, etc.
Expand Down Expand Up @@ -133,6 +133,9 @@ components:
description: |-
Label of task
type: string
ignore:
type: boolean
default: false
options:
$ref: "#/components/schemas/RequestTaskOptions"
data:
Expand All @@ -144,7 +147,25 @@ components:

NOTE: not yet implemented
type: object
required:
- max-duration
additionalProperties: true
properties:
max-depth:
description: |-
Limits the search depth
type: integer
default: 50
max-items:
description: |-
Limits the amount of items that can be found
type: integer
default: 1_000_000
max-duration:
description: |-
Limits the amount of time spent for a search
type: string
format: duration

RequestTaskData:
description: |-
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "example-rabbit-mq"
version = "0.1.0"
version = "0.2.0"
description = 'Example tool to recursively search a file system from a given point and message rabbit mq'
authors = [
{name="raj-open", email="raj-open@users.noreply.github.com"},
Expand Down
Loading