Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###< nelmio/cors-bundle ###

DEFAULT_LOCALE=en
MOCK_API_GENERATOR_SEED=19750523
API_BASE_URL=http://faker:3030
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* [PR-7](https://github.com/itk-dev/rpa-process-overview/pull/7)
Cleaned up
* [PR-6](https://github.com/itk-dev/rpa-process-overview/pull/6)
Setup tailwind
* [PR-4](https://github.com/itk-dev/rpa-process-overview/pull/4)
Expand Down
51 changes: 32 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,55 @@ task help

## Production

First, add a little config to make our tasks use the right docker compose setup:

``` shell
# .env.local
TASK_DOCKER_COMPOSE='itkdev-docker-compose'
TASK_COMPOSER_INSTALL_ARGS='--no-dev'
```

## API Mock
Update the site by running:

``` shell
task site:update
```

## Development

Run

``` shell
docker compose up --build --detach --wait
task site:update
```

to get things started.

Load fixtures with

``` shell
task fixtures:load
```

## API Mock

We use a [FastAPI](https://fastapi.tiangolo.com) app to mock the RPA process overview API.

``` shell
curl "http://$(docker compose port api 8000)/openapi.json"
curl "http://$(docker compose port api 8000)/api/v1/process/"
curl "http://$(docker compose port api 8000)/api/v1/process/" --header 'x-api-key: a-not-so-secret-key'
curl "http://$(docker compose port api 8000)/api/v1/process"
curl "http://$(docker compose port api 8000)/api/v1/process" --header 'x-api-key: a-not-so-secret-key'
```

Create some data:
Create some fixture data for the API:

``` shell
docker compose exec api uv run python -m src.api.fixtures
task api:fixtures:load
curl "http://$(docker compose port api 8000)/api/v1/process/" --header 'x-api-key: a-not-so-secret-key'
```

See [api/README.md](api/README.md) for some more details.
See [api/README.md](api/README.md) for some more details (and [`docker-compose.api.yml`](docker-compose.api.yml) for the
docker compose setup).

## CORS

Expand All @@ -45,15 +70,3 @@ curl -H "Origin: http://127.0.0.1:3000/ProcessOverview?page=3" \
-X OPTIONS --verbose \
"http://$(task --silent compose -- port nginx 8080)/group/1/overview/1/data"
```

## Mock API

We use [faker](https://github.com/dotronglong/faker) to mock the RPA process API.

After changing mocks in `mocks/`, you must run `task compose -- restart faker` to reload the new data.

``` shell
curl "http://$(task --silent compose -- port faker 3030)/api/v1/process"
```

See [docs/API.md](docs/API.md) for some crude details on our API proxy.
10 changes: 0 additions & 10 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,3 @@ tasks:
vars:
BUILD_DIR: widgets/static/dist/
PUBLIC_DIR: public/widgets

mocks:generate:
desc: Generate mocks for Faker
cmds:
- task: console
vars:
TASK_ARGS: app:generate:mock-api-data
- task: compose
vars:
TASK_ARGS: restart faker
33 changes: 16 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,33 @@
"doctrine/doctrine-migrations-bundle": "^3.4.2",
"doctrine/orm": "^3.5.2",
"easycorp/easyadmin-bundle": "^4.25.1",
"league/uri-components": "^7.5",
"league/uri-components": "^7.5.1",
"runtime/frankenphp-symfony": "^0.2.0",
"symfony/asset": "~7.3.0",
"symfony/asset-mapper": "~7.3.0",
"symfony/console": "~7.3.0",
"symfony/dotenv": "~7.3.0",
"symfony/asset-mapper": "~7.3.4",
"symfony/console": "~7.3.4",
"symfony/dotenv": "~7.3.2",
"symfony/flex": "^2.8.2",
"symfony/framework-bundle": "~7.3.0",
"symfony/framework-bundle": "~7.3.4",
"symfony/mercure-bundle": "^0.3.9",
"symfony/runtime": "~7.3.0",
"symfony/translation": "~7.3.0",
"symfony/twig-bundle": "~7.3.0",
"symfony/yaml": "~7.3.0",
"symfony/runtime": "~7.3.4",
"symfony/translation": "~7.3.4",
"symfony/twig-bundle": "~7.3.4",
"symfony/yaml": "~7.3.3",
"symfonycasts/tailwind-bundle": "^0.11.1",
"twig/extra-bundle": "^2.12 || ^3.0",
"twig/twig": "^2.12 || ^3.0"
"twig/extra-bundle": "^2.12 || ^3.21",
"twig/twig": "^2.12 || ^3.21.1"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.48",
"fakerphp/faker": "^1.24",
"friendsofphp/php-cs-fixer": "^3.87",
"ergebnis/composer-normalize": "^2.48.2",
"friendsofphp/php-cs-fixer": "^3.88.2",
"hautelook/alice-bundle": "^2.15.1",
"nelmio/cors-bundle": "^2.5",
"symfony/debug-bundle": "~7.3.0",
"symfony/debug-bundle": "~7.3.4",
"symfony/maker-bundle": "^1.64",
"symfony/stopwatch": "~7.3.0",
"symfony/web-profiler-bundle": "~7.3.0",
"vincentlanglet/twig-cs-fixer": "^3.9"
"symfony/web-profiler-bundle": "~7.3.4",
"vincentlanglet/twig-cs-fixer": "^3.10"
},
"replace": {
"symfony/polyfill-ctype": "*",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,3 @@ services:

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

App\Controller\ProxyApiController:
arguments:
$options:
api_base_url: '%env(API_BASE_URL)%'

App\Command\GenerateMockApiDataCommand:
arguments:
$options:
seed: '%env(int:MOCK_API_GENERATOR_SEED)%'
18 changes: 0 additions & 18 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@ services:
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"

# https://github.com/dotronglong/faker/wiki/Getting-Started-%5BDocker%5D
faker:
image: dotronglong/faker:stable
networks:
- app
volumes:
- ./mocks:/app/mocks
ports:
- "8030:3030"

node:
image: node:24
profiles:
- dev
working_dir: /app
volumes:
- .:/app

prettier:
# Prettier does not (yet, fcf.
# https://github.com/prettier/prettier/issues/15206) have an official
Expand Down
7 changes: 1 addition & 6 deletions fixtures/process_overview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ App\Entity\DataSource:
header:
x-api-key: a-not-so-secret-key

data_source_faker:
label: Faker
url: http://faker:3030
options: |-

App\Entity\ProcessOverviewGroup:
process_overview_group_1:
label: Tandpleje - Udskrivningsprocesser
Expand Down Expand Up @@ -56,7 +51,7 @@ App\Entity\ProcessOverview:
process_overview_3:
label: En anden proces
group: "@process_overview_group_2"
dataSource: "@data_source_faker"
dataSource: "@data_source_api"
processId: 3
options: |-
metadata_columns:
Expand Down
Loading