You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+68-18Lines changed: 68 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,37 +29,38 @@ A complete list of existing parameters is provided in the file `optimap/.env.exa
29
29
30
30
## Run with Docker
31
31
32
-
The project is containerized using Docker, with services defined in `docker-compose.yml`. To start all services, run:
32
+
The project is containerized using Docker, with services defined in `docker-compose.(deploy.)yml`. To start all services, run:
33
33
34
34
```bash
35
35
docker compose up
36
-
```
37
36
38
-
### Initial Setup
37
+
docker compose run --entrypoint python app manage.py loaddata fixtures/test_data.json
38
+
```
39
39
40
-
After starting the containers, apply database migrations:
40
+
The database migrations are applied as part of the startup script, see file `etc/manage-and-run.sh`.
41
+
You can still run the commands below manually if need be, e.g., during development.
41
42
42
43
```bash
43
-
# run migrations, in the directory where docker-compose is to resolve the name "web"
44
-
docker compose run app python manage.py makemigrations # should not detect and changes, otherwise your local config might be outdated
45
-
docker compose run app python manage.py migrate
46
-
docker compose run app python manage.py collectstatic --noinput
47
-
docker compose run app python manage.py loaddata fixtures/test_data.json
44
+
docker compose run --entrypoint python app manage.py makemigrations # should not detect and changes, otherwise your local config might be outdated
45
+
docker compose run --entrypoint python app manage.py migrate
46
+
docker compose run --entrypoint python app manage.py collectstatic --noinput
48
47
```
49
48
50
49
Now open a browser at <http://localhost:80/>.
51
50
52
-
####Services Overview
51
+
### Services Overview
53
52
54
53
- db: Runs a PostgreSQL database with PostGIS extensions. Data is persisted in a Docker volume named db_data.
55
54
- app: Our primary Django web application.
56
55
- webserver: An Nginx server for serving static files and test files.
57
56
58
-
####Ports
57
+
### Ports
59
58
60
-
- 5434: Database (PostgreSQL/PostGIS)
61
-
- 8000: App (Django server)
62
-
- 8080: Webserver (Nginx)
59
+
Not all of these ports are exposed by default, but they are available for local development - just uncomment the matching lines in the `docker-compose.yml` file.
# If you need to run tasks (harvesting, data export) then start a cluster in a separate shell
142
+
python manage.py qcluster
143
+
140
144
# Start the Django development server
141
145
python manage.py runserver
142
146
@@ -256,14 +260,33 @@ python manage.py test tests
256
260
python -Wa manage.py test
257
261
258
262
# configure logging level for cleaner test progress output
259
-
OPTIMAP_LOGGING_CONSOLE_LEVEL=WARNING python manage.py test tests
263
+
OPTIMAP_LOGGING_LEVEL=WARNING python manage.py test tests
264
+
```
265
+
266
+
### Run UI tests
260
267
261
-
# running UI tests needs either compose configuration or a manage.py runserver in a seperate shell
268
+
Running UI tests needs either compose configuration or a manage.py runserver in a seperate shell.
269
+
270
+
```bash
262
271
docker-compose up --build
263
272
264
273
python -Wa manage.py test tests-ui
265
274
```
266
275
276
+
### Check test coverage
277
+
278
+
```bash
279
+
# run the tests and capture coverage
280
+
coverage run --source='publications' --omit='*/migrations/**' manage.py test tests
281
+
282
+
# show coverage report
283
+
coverage report --show-missing --fail-under=70
284
+
285
+
# save the reports
286
+
coverage html
287
+
coverage xml
288
+
```
289
+
267
290
### Develop tests
268
291
269
292
For developing the UI tests, you can remove the `headless=True` in the statements for starting the browsers so you can "watch along" and inspect the HTML when a breakpoint is hit as the tests are executed.
@@ -309,7 +332,7 @@ The changelog follows the [Keep a Changelog](https://keepachangelog.com/en/1.1.0
309
332
310
333
The version is managed in `optimap/__init__.py`.
311
334
312
-
###Design colours and logos
335
+
## Design colours and logos
313
336
314
337
Optimeta colour = _primary colour_: #158F9B
315
338
@@ -323,7 +346,8 @@ The **logos** and favicon are in the repository in the folder [`publications/sta
323
346
324
347
## Deploy
325
348
326
-
Deploy using `docker-compose` or see [`fly.io.md`](fly.io.md) for notes on deploying to Fly.io.
349
+
The app is deployed in the TUD Enterprise Cloud.
350
+
HTTPS certificate is retrieved via `certbot`, see `docker-compose.deploy.yml` for the configuration and documentation links.
327
351
328
352
## Operation
329
353
@@ -344,6 +368,32 @@ Deploy using `docker-compose` or see [`fly.io.md`](fly.io.md) for notes on deplo
344
368
- Go to `/admin/auth/user/`
345
369
- Select users → Choose **"Delete user and block email/domain"** → Click **Go**.
346
370
371
+
### Tasks
372
+
373
+
We use [Django Q2](https://django-q2.readthedocs.io/) for scheduling (repeated) tasks.
# make the next process the main process, cf. https://www.baeldung.com/ops/docker-exec-process-replacement
19
+
exec python manage.py runserver 0.0.0.0:8000
20
+
21
+
# TODO: revisit entrypoint approach if there are any issues, e.g., by using an extra migration container, cf. https://stackoverflow.com/questions/33992867/how-do-you-perform-django-database-migrations-when-using-docker-compose, or by manually running selected commands after installation, cf. https://www.baeldung.com/ops/django-database-migrations-docker-compose
0 commit comments