@@ -7,16 +7,38 @@ Local install
77Getting a local Trac install running is a bit tricky. Here are a few tricks
88that can help:
99
10- * Install the requirements in the same virtualenv as djangoproject.com.
1110* Follow the installation instructions in djangoproject/README.rst (especially
1211 the database creation).
13- * Use ``psql -U code.djangoproject -d code.djangoproject -c "INSERT INTO permission (username, action) VALUES (' anonymous', ' TRAC_ADMIN')" ``
12+ * Use ``trac-admin ./trac-env/ permission add anonymous TRAC_ADMIN ``
1413 to give all permissions to the anonymous user.
1514* Use the command ``tracd --port 9000 -s trac-env `` to serve Trac locally.
1615* If you've modified the ``trackhack.scss `` file, use
1716 ``sassc scss/trachacks.scss trac-env/htdocs/css/trachacks.css -s compressed ``
1817 to compile it to CSS.
1918
19+ Using Docker
20+ ------------
21+
22+ * Install Docker
23+ * ``pip install docker-compose ``
24+ * ``docker-compose up --build ``
25+ * Follow instructions above to create/load the DB, grant permissions, create the
26+ config, etc. For example::
27+
28+ docker-compose up --build
29+ export DATABASE_URL=postgres://code.djangoproject:secret@db/code.djangoproject
30+ docker-compose exec -T db psql $DATABASE_URL < ../djangoproject.com/tracdb/trac.sql
31+ docker-compose exec trac /venv/bin/trac-admin /code/trac-env/ permission add anonymous TRAC_ADMIN
32+
33+ Using Podman
34+ ------------
35+
36+ It may be possible to use Podman for local development to more closely simulate
37+ production. The above Docker instructions should work for Podman as well,
38+ however, be aware that ``podman-compose `` is not as well battle-tested as
39+ ``docker-compose `` (e.g., it may require pruning or forcefully stopping a
40+ container before it will rebuild properly).
41+
2042How to port the CSS from djangoproject.com
2143------------------------------------------
2244
@@ -31,3 +53,29 @@ same directory (adjust paths if needed).
3153 ``cp -rT ../djangoproject.com/static/js trac-env/htdocs/js ``
32544. Compile trackhacks.scss:
3355 ``make compile-scss ``
56+
57+ How to recreate `trac.sql ` after upgrading Trac
58+ -----------------------------------------------
59+
60+
61+ Start with a clean slate::
62+
63+ docker-compose down
64+ sh -c 'cd ../djangoproject.com && git checkout tracdb/trac.sql'
65+
66+ Bring up database and Trac via docker-compose::
67+
68+ docker-compose up --build -d
69+ export DATABASE_URL=postgres://code.djangoproject:secret@db/code.djangoproject
70+ docker-compose exec -T db psql $DATABASE_URL < ../djangoproject.com/tracdb/trac.sql
71+ docker-compose exec trac /venv/bin/trac-admin /code/trac-env/ upgrade
72+ docker-compose exec db pg_dump --column-inserts -d $DATABASE_URL > ../djangoproject.com/tracdb/trac.sql
73+
74+
75+ Note:
76+
77+ * There's no need to run the ``trac-admin ... wiki upgrade `` command
78+ * Be careful with changes that ``trac-admin ... upgrade `` makes to
79+ ``trac.ini ``. We usually don't want them.
80+ * Review the diff carefully to make sure no unexpected database changes
81+ are inadvertently included.
0 commit comments