@@ -7,16 +7,38 @@ Local install
7
7
Getting a local Trac install running is a bit tricky. Here are a few tricks
8
8
that can help:
9
9
10
- * Install the requirements in the same virtualenv as djangoproject.com.
11
10
* Follow the installation instructions in djangoproject/README.rst (especially
12
11
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 ``
14
13
to give all permissions to the anonymous user.
15
14
* Use the command ``tracd --port 9000 -s trac-env `` to serve Trac locally.
16
15
* If you've modified the ``trackhack.scss `` file, use
17
16
``sassc scss/trachacks.scss trac-env/htdocs/css/trachacks.css -s compressed ``
18
17
to compile it to CSS.
19
18
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
+
20
42
How to port the CSS from djangoproject.com
21
43
------------------------------------------
22
44
@@ -31,3 +53,29 @@ same directory (adjust paths if needed).
31
53
``cp -rT ../djangoproject.com/static/js trac-env/htdocs/js ``
32
54
4. Compile trackhacks.scss:
33
55
``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