Skip to content

Commit 1afdfa8

Browse files
authored
Merge pull request #447 from os2display/feature/docs-revisions
chore: align documentation with current state of project
2 parents f1d4bd7 + 536cfa6 commit 1afdfa8

3 files changed

Lines changed: 110 additions & 48 deletions

File tree

README.md

Lines changed: 109 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,38 @@
33
## Table of Contents
44

55
1. [Description](#description)
6-
2. [ADR - Architectural Decision Records](#adr---architectural-decision-records)
7-
3. [Technologies](#technologies)
6+
2. [Content Structure](#content-structure)
7+
3. [ADR - Architectural Decision Records](#adr---architectural-decision-records)
88
4. [Versioning](#versioning)
9-
5. [Taskfile](#taskfile)
10-
6. [Development setup](#development-setup)
11-
7. [Production setup](#production-setup)
12-
8. [Container images](#container-images)
13-
9. [Coding standards](#coding-standards)
14-
10. [Stateless](#stateless)
15-
11. [OIDC providers](#oidc-providers)
16-
12. [JWT Auth](#jwt-auth)
17-
13. [Test](#test)
18-
14. [API specification and generated code](#api-specification-and-generated-code)
19-
15. [Configuration](#configuration)
20-
16. [Rest API & Relationships](#rest-api--relationships)
21-
17. [Error codes in the Client](#error-codes-in-the-client)
22-
18. [Preview mode in the Client](#preview-mode-in-the-client)
23-
19. [Feeds](#feeds)
24-
20. [Custom Templates](#custom-templates)
25-
21. [Static Analysis](#static-analysis)
26-
22. [Upgrade Guide](#upgrade-guide)
27-
23. [Tenants](#tenants)
28-
24. [Screen layouts](#screen-layouts)
29-
25. [Templates](#templates)
9+
5. [Technologies](#technologies)
10+
6. [Taskfile](#taskfile)
11+
7. [Prerequisites](#prerequisites)
12+
8. [Development setup](#development-setup)
13+
9. [Production setup](#production-setup)
14+
10. [Container images](#container-images)
15+
11. [Coding standards](#coding-standards)
16+
12. [Stateless](#stateless)
17+
13. [Authentication](#authentication)
18+
14. [Tenants](#tenants)
19+
15. [OIDC providers](#oidc-providers)
20+
16. [JWT Auth](#jwt-auth)
21+
17. [Test](#test)
22+
18. [API specification and generated code](#api-specification-and-generated-code)
23+
19. [Configuration](#configuration)
24+
20. [Rest API & Relationships](#rest-api--relationships)
25+
21. [Online check for Client](#online-check-for-client)
26+
22. [Error codes in the Client](#error-codes-in-the-client)
27+
23. [Preview mode in the Client](#preview-mode-in-the-client)
28+
24. [Screen status](#screen-status)
29+
25. [Feeds](#feeds)
30+
26. [Themes](#themes)
31+
27. [Templates](#templates)
32+
28. [Custom Templates](#custom-templates)
33+
29. [Screen Layouts](#screen-layouts)
34+
30. [Static analysis](#static-analysis)
35+
31. [Upgrade Guide](#upgrade-guide)
36+
32. [License](#license)
37+
33. [Contributing](#contributing)
3038

3139
## Description
3240

@@ -58,10 +66,12 @@ Further documentation can be found in the
5866
| Theme | A theme has css, that can override the slide css. | Admin |
5967
| Template | The template is how the slide looks, and which content is on the slide. Templates are accessible to choose on Slides. | Admin, editor |
6068
| Playlist | A playlist arranges the order of the slides, and the playlist is scheduled. | Admin, editor |
69+
| Schedule | A rrule-based schedule attached to a playlist, controlling when the playlist's slides are shown. | Admin, editor |
6170
| Campaign | A campaign is a playlist, that takes precedence over all other playlists on the screen. If there a multiple campaigns, they are queued. A campaign is either directly attached to a screen, or attached to a group affecting the screens that are members of that group. If a campaign applies to a screen it fills the whole screen, not just a region of the screen. | Admin |
6271
| Group | A group is a collection of screens. | Admin |
6372
| Layout | A layout consists of different regions, and each region can have a number of playlists connected. A layout is connected to a screen. | Admin |
6473
| Screen | A screen is connected to an actual screen, and has a layout with different playlists in. | Admin |
74+
| Tenant | A content silo. Users, content and resources belong to a tenant; users may be members of several tenants. | Admin |
6575

6676
```mermaid
6777
flowchart LR
@@ -97,10 +107,12 @@ For the versions available, see the
97107

98108
## Technologies
99109

100-
The API is written in PHP project, built with [Symfony](https://symfony.com/) and
110+
The API is a PHP project, built with [Symfony](https://symfony.com/) and
101111
[API Platform](https://api-platform.com/).
102112

103113
The Admin and Client are written in javascript and [React](https://react.dev/) and built with [Vite](https://vite.dev/).
114+
There are three Vite entry points (defined in `vite.config.js`): `admin`, `client` and `template`. Shared code lives
115+
in `assets/shared/`.
104116

105117
## Taskfile
106118

@@ -116,6 +128,19 @@ For a list of commands, run:
116128
task --list-all
117129
```
118130

131+
## Prerequisites
132+
133+
Local development relies on:
134+
135+
- [Docker](https://www.docker.com/) and Docker Compose
136+
- [Task](https://taskfile.dev/) for running project commands
137+
- A reverse proxy mapping the local domain to the stack. The default domain is
138+
`display.local.itkdev.dk` (configurable via `COMPOSE_DOMAIN` in `.env`); itk-dev's
139+
setup is documented at [itk-dev/devops_itkdev-docker](https://github.com/itk-dev/devops_itkdev-docker).
140+
141+
PHP 8.3+ and Node are only required if you build or run scripts directly on the host;
142+
otherwise the containers provide them.
143+
119144
## Development setup
120145

121146
Before first installation a JWT Auth keypair should be generated. See [JWT Auth](#jwt-auth).
@@ -145,6 +170,21 @@ The fixtures have an editor user: <editor@example.com> with the password: "apass
145170

146171
The fixtures have the image-text template, and two screen layouts: "full screen" and "two boxes".
147172

173+
### Frontend dev server
174+
175+
The Vite dev server runs automatically inside the `node` container — it is started by `docker compose up` (and
176+
therefore by `task compose-up` and `task site-install`) via the `command: npm run dev` entry in
177+
`docker-compose.override.yml`. There is no separate command to run.
178+
179+
HMR is served from `node-display.local.itkdev.dk` over WSS on port 443 (host configurable via `COMPOSE_DOMAIN` in
180+
`.env`; see `vite.config.js`).
181+
182+
When entities or API Platform configuration change, regenerate and apply the database schema:
183+
184+
```shell
185+
task db:migrate
186+
```
187+
148188
### Database (MariaDB)
149189

150190
Local dev defaults to `mariadb:11.4` (LTS until May 2029). CI also exercises `mariadb:10.11` (LTS until
@@ -163,16 +203,22 @@ MARIADB_IMAGE=mariadb:10.11 MARIADB_VERSION=10.11.13-MariaDB docker compose up -
163203

164204
## Production setup
165205

166-
A JWT Auth keypair should be generated. See [JWT Auth](#jwt-auth).
167-
168-
In `.env.local` set the following values:
206+
Required runtime configuration (set on the running container — see
207+
[Changing environment variables for the running images](#changing-environment-variables-for-the-running-images)):
169208

170209
```text
171210
APP_ENV=prod
172211
APP_SECRET=<GENERATE A NEW SECRET>
212+
DATABASE_URL=mysql://<user>:<pass>@<host>:3306/<db>?serverVersion=<version>
213+
JWT_PASSPHRASE=<passphrase used when generating the keypair>
173214
```
174215

175-
Use the `app:update` command to migrate and update templates to latest version:
216+
Generate a JWT Auth keypair (see [JWT Auth](#jwt-auth)) and persist `config/jwt/`
217+
across container rebuilds with a volume mount; the same `JWT_PASSPHRASE` must be
218+
set in the environment.
219+
220+
On first boot — and after every deploy — run `app:update` to apply Doctrine
221+
migrations and install/refresh the bundled templates and screen layouts:
176222

177223
```shell
178224
docker compose exec phpfpm bin/console app:update --no-interaction
@@ -193,7 +239,7 @@ for the build pipeline (stages, tag scheme, local + CI flows).
193239

194240
Set runtime configuration via your container runtime, not by editing the `.env` files baked into the image:
195241

196-
- Docker Compose: `env_file:` or `environment:` on the `os2display` service.
242+
- Docker Compose: `env_file:` or `environment:` on the `phpfpm` service.
197243
- Other orchestrators: equivalent native mechanism (`-e`, env injection, etc.).
198244

199245
Real environment variables take precedence over the image's compiled `.env.local.php`, so values set this way
@@ -226,6 +272,9 @@ The API is stateless except for the `/v2/authentication` routes.
226272
Authentication is achieved through `/v2/authentication/token` for the `/admin`
227273
and through `/v2/authentication/screen` for the `/client`.
228274

275+
See [JWT Auth](#jwt-auth) for token generation and usage, and [OIDC providers](#oidc-providers)
276+
for SSO-based admin authentication.
277+
229278
## Tenants
230279

231280
Content is connected to a Tenant. A user is in x tenants.
@@ -243,8 +292,8 @@ A tenant can be configured with
243292
docker compose exec phpfpm bin/console app:tenant:configure
244293
```
245294

246-
At the monment, it is possible to configure the fallback image to be shown in the tenant when a screen shows no content.
247-
It is also possible to configure if a tenants should support interactive slides.
295+
At the moment, it is possible to configure the fallback image to be shown in the tenant when a screen shows no content.
296+
It is also possible to configure if a tenant should support interactive slides.
248297

249298
## OIDC providers
250299

@@ -259,7 +308,7 @@ The external provider only handles authentication. A user logging in through the
259308
external provider will not be granted access automatically, but will be challenged
260309
to enter an activation (invite) code to verify access.
261310

262-
See `docs/feed/openid-connect.md` for environment variables for OpenID Connect configuration.
311+
See `docs/configuration/openid-connect.md` for environment variables for OpenID Connect configuration.
263312

264313
### Internal
265314

@@ -393,11 +442,13 @@ TEST-PATH is omitted, all tests will run.
393442

394443
To run test from the local machine, there are a few options.
395444

445+
Run Playwright headlessly on the host against the running stack:
446+
396447
```shell
397448
task test:frontend-local
398449
```
399450

400-
In interactive mode:
451+
Open the Playwright UI for interactive debugging:
401452

402453
```shell
403454
task test:frontend-local-ui
@@ -798,14 +849,14 @@ Furthermore, the section "Tilkobling" will show the following data:
798849
* Kodeudgivelsestidspunkt: 17/6 2024 17:26
799850
```
800851

801-
This shows when the latest communication has occured, what client version the machine is running,
852+
This shows when the latest communication has occurred, what client version the machine is running,
802853
and the time of client code release.
803854

804855
## Feeds
805856

806-
"Feeds" in OS2display are external data sources that can provide up-to-data to slides. The idea is that if you can set
807-
up a slide based on a feed and publish it. The Screen Client will then fetch new data from the feed whenever the Slide
808-
is shown on screen.
857+
"Feeds" in OS2display are external data sources that can provide up-to-date data to slides. The idea is that you can
858+
set up a slide based on a feed and publish it; the Screen Client will then fetch new data from the feed whenever the
859+
slide is shown on screen.
809860

810861
The simplest example is a classic RSS news feed. You can set up a slide based on the RSS slide template, configure the
811862
RSS source URL, and whenever the slide is on screen it will show the latest entries from the RSS feed.
@@ -829,17 +880,17 @@ For example:
829880
booking system you can implement a "FeedSource" that fetches booking data from your source and normalizes it to match
830881
the calendar output model.
831882

832-
## Create a new FeedType
883+
### Create a new FeedType
833884

834885
To implement a new FeedType, create a class that implements `src/Feed/FeedTypeInterface`.
835886

836-
## List installed Feed Sources
887+
### List installed Feed Sources
837888

838889
```shell
839890
docker compose exec phpfpm bin/console app:feed:list-feed-source
840891
```
841892

842-
## Create a Feed Source
893+
### Create a Feed Source
843894

844895
To create a feed source use the following command:
845896

@@ -855,7 +906,7 @@ To override an existing feed source, use the ulid in the command above, eg.:
855906
docker compose exec phpfpm bin/console app:feed:create-feed-source 01FYRMSGGHG4VXS3Z0WACG6BX8
856907
```
857908

858-
## Remove a Feed Source
909+
### Remove a Feed Source
859910

860911
```shell
861912
docker compose exec phpfpm bin/console app:feed:remove-feed-source 01FYRMSGGHG4VXS3Z0WACG6BX8
@@ -1042,23 +1093,34 @@ To make a layout region into a touch button region, add the following to the reg
10421093

10431094
## Static analysis
10441095

1045-
[Psalm](https://psalm.dev/) is used for static analysis:
1096+
[PHPStan](https://phpstan.org/) is used for static analysis:
10461097

10471098
```shell
10481099
task code-analysis
10491100
```
10501101

1051-
We use [a baseline file](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file) for Psalm
1052-
([`psalm-baseline.xml`](psalm-baseline.xml)).
1102+
Configuration lives in [`phpstan.dist.neon`](phpstan.dist.neon). We use a
1103+
[baseline file](https://phpstan.org/user-guide/baseline)
1104+
([`phpstan-baseline.neon`](phpstan-baseline.neon)) to ignore pre-existing issues.
10531105

1054-
Run this command to update the baseline file:
1106+
Run this command to regenerate the baseline file:
10551107

10561108
```shell
1057-
task psalm:update-baseline
1109+
task phpstan:generate-baseline
10581110
```
10591111

1060-
Psalm [error level](https://psalm.dev/docs/running_psalm/error_levels/) is set to level 2.
1112+
PHPStan [rule level](https://phpstan.org/user-guide/rule-levels) is set to level 6.
10611113

10621114
## Upgrade Guide
10631115

10641116
See [UPGRADE.md](UPGRADE.md) for upgrade guides.
1117+
1118+
## License
1119+
1120+
OS2Display is released under the [Mozilla Public License 2.0](LICENSE).
1121+
1122+
## Contributing
1123+
1124+
Bug reports and pull requests are tracked on
1125+
[GitHub](https://github.com/os2display/display-api-service/issues). See
1126+
[Coding standards](#coding-standards) for the checks a PR must pass.

docs/test-guide/test-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ Feed sources are connected to a tenant. New feed sources can be connected to a t
498498
The following guide describes how to add a "calendar api" feed source to a tenant.
499499

500500
NB! The calendar api feed source has some installation requirements that are assumed to have been set up.
501-
See the [documentation](../../docs/configuration/calender-api-feed.md) for further information.
501+
See the [documentation](../../docs/configuration/calendar-api-feed.md) for further information.
502502

503503
With the calendar api feed source the administrator should select which locations are connected with the given tenant.
504504
When creating a slide with the given feed source, the resources that belong to the given locations are available

0 commit comments

Comments
 (0)