File tree Expand file tree Collapse file tree 8 files changed +60
-14
lines changed
docker-entrypoint-initdb.d Expand file tree Collapse file tree 8 files changed +60
-14
lines changed Original file line number Diff line number Diff line change 1+ # Copied from .gitignore
2+ __pycache__
3+ data
4+ * .pyc
5+ * .db
6+ locale /* /LC_MESSAGES /django.mo
7+ * /locale /* /LC_MESSAGES /django.mo
8+ .sass-cache /
9+ .coverage
10+ .direnv
11+ .envrc
12+ djangoproject /cache
13+ djangoproject /static /css /* .map
14+ djangoproject /static /css /* .css
15+ # Additional ignores for Docker
16+ .git /
Original file line number Diff line number Diff line change @@ -25,10 +25,21 @@ jobs:
2525 - name : Checkout repository
2626 uses : actions/checkout@v4
2727
28+ - name : Set up Docker Compose
29+ uses : docker/setup-compose-action@v1
30+
2831 - name : Test docker image build (local development)
2932 uses : docker/build-push-action@v6
3033 with :
3134 context : .
3235 push : false
3336 build-args : |
3437 REQ_FILE=requirements/${{ matrix.req_file }}
38+
39+ - if : matrix.req_file == 'tests.txt'
40+ name : Run the tests via Docker
41+ run : |
42+ docker compose up -d db
43+ # Wait for Postgres to be ready
44+ docker compose exec db sh -c 'until pg_isready ; do sleep 1; done'
45+ docker compose run --rm web make ci
Original file line number Diff line number Diff line change 3030
3131watch-scss :
3232 watchmedo shell-command --patterns=* .scss --recursive --command=" make compile-scss-debug" $(SCSS )
33+
34+ reset-local-db :
35+ python -m manage flush --no-input
36+ python -m manage loaddata dev_sites
37+ python -m manage loaddata doc_releases
38+ python -m manage loaddata dashboard_production_metrics
39+ python -m manage update_metrics
Original file line number Diff line number Diff line change @@ -354,12 +354,26 @@ Running Locally with Docker
354354
355355 docker compose up
356356
357- 3. View the site at http://localhost:8000/
358-
359- 4. Run the tests::
357+ 3. Run the tests::
360358
361359 docker compose run --rm web python -m manage test
362360
361+ 4. Load the sample / local dev data::
362+
363+ docker compose run --rm web make reset-local-db
364+
365+ If preferred, refer to the "Install and run locally from a virtual environment"
366+ for more granular management commands to load specific data sets.
367+
368+ 5. View the site at http://www.djangoproject.localhost:8000/
369+ or http://dashboard.djangoproject.localhost:8000/.
370+
371+ 6. For docs, download the documentation (takes awhile)::
372+
373+ docker compose exec -it web python -m manage update_docs
374+
375+ 7. View the docs at http://docs.djangoproject.localhost:8000/.
376+
363377Pre-commit checks
364378-----------------
365379
Original file line number Diff line number Diff line change @@ -42,4 +42,9 @@ services:
4242 timeout : 10s
4343 retries : 10
4444 volumes :
45- - ./initdb/tracdb.sql:/docker-entrypoint-initdb.d/tracdb.sql
45+ # Mount the Postgres initialization scripts
46+ - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
47+ # This file contains the initial Trac database schema, but needs
48+ # to be loaded into the database manually (via 02_trac_schema.sh)
49+ # since it applies to the trac database, not the main Django database.
50+ - ./tracdb/trac.sql:/trac.sql
File renamed without changes.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ PGPASSWORD=secret psql --username=code.djangoproject --dbname=code.djangoproject < /trac.sql
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- python -m manage flush --no-input
4- PGPASSWORD=secret psql --host db --port 5432 --username=code.djangoproject --dbname=code.djangoproject < tracdb/trac.sql
53python -m manage migrate
64make compile-scss # must come before collectstatic
75python -m manage collectstatic --no-input --clear
8- python -m manage loaddata dev_sites
9- python -m manage loaddata doc_releases
10- # git config --global url."https://".insteadOf git://
11- # python -m manage update_docs
12- python -m manage loaddata dashboard_production_metrics
13- # python -m manage loaddata dashboard_example_data
14- python -m manage update_metrics
15- # python -m manage update_index
166
177exec " $@ "
You can’t perform that action at this time.
0 commit comments