Skip to content

Commit 53321e9

Browse files
committed
Document frontend development
1 parent 7e37413 commit 53321e9

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

Makefile

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ qa: fix check test
399399
env ?=
400400
environment ?= ${env}
401401
test_args ?= ${testargs}
402+
services ?= ${service}
402403
ifeq (${environment},dev)
403404
environment = develop
404405
endif
@@ -440,13 +441,16 @@ docker-compose:
440441
${DOCKER_COMPOSE_CMD} ${args}
441442

442443
up docker-compose-up:
443-
${DOCKER_COMPOSE_UP_PULL_CMD} up --wait --no-build --remove-orphans ${services}
444+
${DOCKER_COMPOSE_UP_PULL_CMD} up --wait --no-build --remove-orphans --timeout=0 ${services}
444445
@if [ "${environment}" = "test" ]; then echo -e "\n🚀 Running on http://localhost:8081"; fi
445446
@if [ "${environment}" = "develop" ]; then echo -e "\n🚀 Running on http://localhost:8080"; fi
446447
@if [ "${environment}" = "batch-test" ]; then echo -e "\n🚀 Running on http://localhost:8081"; fi
447448

449+
up-no-wait:
450+
${DOCKER_COMPOSE_UP_PULL_CMD} up --detach --no-build --remove-orphans --timeout=0 ${services}
451+
448452
run docker-compose-run:
449-
${DOCKER_COMPOSE_UP_PULL_CMD} up --no-build ${services}
453+
${DOCKER_COMPOSE_UP_PULL_CMD} up --watch --remove-orphans --timeout=0 ${services}
450454

451455
restart docker-compose-restart:
452456
${DOCKER_COMPOSE_CMD} restart --no-deps ${services}
@@ -512,7 +516,7 @@ stop docker-compose-stop:
512516

513517
# stop and remove all containers, but keep volumes (eg: routinator cache, databases)
514518
down docker-compose-down:
515-
${DOCKER_COMPOSE_CMD} down
519+
${DOCKER_COMPOSE_CMD} down --timeout=0
516520

517521
down-remove-volumes docker-compose-down-remove-volumes:
518522
${DOCKER_COMPOSE_CMD} down --volumes
@@ -718,3 +722,21 @@ ${TMPDIR}/tranco_list_%k.txt: ${TMPDIR}/tranco_list.txt
718722
${TMPDIR}/tranco_list.txt:
719723
# download tranco list, unzip, convert from csv to plain list of domains
720724
curl -Ls https://tranco-list.eu/download_daily/4Q39X | bsdtar -xOf - | cut -d, -f2 > $@
725+
726+
# convenience target, will build and run all services for development and output logs for the relevant ones
727+
develop:
728+
# (re)build all services
729+
${MAKE} build env=develop
730+
# bring entire environment up
731+
${MAKE} up-no-wait env=develop
732+
# wait and log on relevant services
733+
${MAKE} run env=develop services='app webserver worker worker-slow worker-nassl'
734+
# shut everything down
735+
${MAKE} down env=develop
736+
737+
# same as develop, but focus on frontend only
738+
develop_frontend:
739+
# only bring up what is needed for frontend development
740+
${MAKE} build run env=develop services='app webserver port-expose'
741+
# shut everything down
742+
${MAKE} down env=develop

documentation/Docker-development-environment.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,28 @@ Multiple services can be specified like so:
6464

6565
Using a Docker runtime with more memory and CPU cores improves rebuild/restart speed.
6666

67+
### Auto reload
68+
69+
Once the development environment is up and running it will autotically rebuild/restart/reload when certain parts of the source code change. Currently changes to the following files will be detected and acted upon:
70+
71+
- Python sources in `checks/`, `internetnl/`, `interface/`: will reload `app` and `worker*` using Django autoreload, when needed open browser sessions will reload.
72+
- CSS files in `frontend/css/`: will rebuild CSS files and open browser sessions will reload.
73+
- Django template files (`.html`) in `interface/templates/`: open browser sessions will reload.
74+
75+
### Foreground development
76+
77+
Instead of running in the background the application stack can also be started in foreground mode using the command:
78+
79+
make develop
80+
81+
This convenience command will build all relevant services, start the entire stack and show log output for the most relevant services. The Docker Compose application will keep running in the foreground. Terminating it (with `ctrl-c`) will shutdown all running services and bring down the entire application stack.
82+
83+
#### Frontend development
84+
85+
When only developing on frontend parts of the application (eg: `html`, `css`, `javascript`, Django templates/views), a smaller subset of the application can be started using:
86+
87+
make develop_frontend
88+
6789
### Running/debugging individual probes
6890

6991
It is possible to run individual probes with debug logging using a manage command. This provides a quick way to iterate over changes regarding test/probe code without having to go through the web interface. For this run the following command:

0 commit comments

Comments
 (0)