# ref: https://github.com/edgewall/trac/blob/trunk/INSTALL.rst
pip2 install Trac # installs trac-admin and tracd
mkdir -p ~/work/trac-test/
trac-admin --help
trac-admin ~/work/trac-test/ initenv # enter (My Project), enter (sqlite:db/trac.db)
tracd --help
# ref: http://localhost:8000/wiki/TracStandalone#UsingAuthentication
touch ~/work/trac-test/.htpass
htpasswd ~/work/trac-test/.htpass admin # New password: 1
htpasswd ~/work/trac-test/.htpass user0 # New password: 1
cat ~/work/trac-test/.htpass
# example:# admin:$apr1$o5/zHFun$D37IY76DeiSPNFQ61Lb83.# user0:$apr1$ZKPNxUQN$9mSHbW3ENYDsqG8eLaQbf0
tracd --port 8000 -s --basic-auth="trac-test,$HOME/work/trac-test/.htpass,realm" ~/work/trac-test/
# -s: single:# without -s (multi project): http://localhost:8000/trac-test/wiki/WikiStart# with -s (single project): http://localhost:8000/wiki/WikiStart
curl http://localhost:8000/wiki/WikiStart
# http://localhost:8000/wiki/TracInstall#ConfiguringAuthentication
trac-admin ~/work/trac-test/ help
trac-admin ~/work/trac-test/ permission --help
trac-admin ~/work/trac-test/ permission list # user0 not appear
trac-admin ~/work/trac-test/ permission add admin TRAC_ADMIN
trac-admin ~/work/trac-test/ permission add user0 TRAC_ADMIN
trac-admin ~/work/trac-test/ permission list # user0 TRAC_ADMIN
Install XML-RPC Plugin RPC
Official repository is broken
As of 2020-01-24, official repository
is broken on latest Trac (1.4.2).
If we do pip2 install svn+https://trac-hacks.org/svn/xmlrpcplugin/trunk,
http://localhost:8000/login/rpc will shows error:
This is known BUG.
As in this BUG ticket, Gasol Wu fixed this issue in
their repository,
which can be installed by
pip2 install svn+https://github.com/Gasol/trac-xmlrpcplugin/branches/trac-1.5/trunk#egg=TracXMLRPC.
Here we use it.
POST/login/rpcHTTP/1.1Accept:application/json,*/*;q=0.5Accept-Encoding:gzip,deflateAuthorization:Basicd3NoOjE=Connection:keep-aliveContent-Length:51Content-Type:application/jsonHost:localhost:8000User-Agent:HTTPie/2.3.0{"method":"wiki.getPage","params":["WikiStart"]}HTTP/1.1200OKContent-Length:1662Content-Type:application/jsonDate:Wed,27Jan202112:01:53GMTServer:tracd/1.4.2Python/2.7.18{"error":null,"id":null,"result":"= Welcome to Trac\n\nTrac is a '''minimalistic''' approach to '''web-based''' management of\n'''software projects'''. Its goal is to simplify effective tracking and\nhandling of software issues, enhancements and overall progress.\n\nAll aspects of Trac have been designed with the single goal to\n'''help developers write great software''' while '''staying out of the way'''\nand imposing as little as possible on a team's established process and\nculture.\n\nAs all Wiki pages, this page is editable, this means that you can\nmodify the contents of this page simply by using your\nweb-browser. Simply click on the \"Edit this page\" link at the bottom\nof the page. WikiFormatting will give you a detailed description of\navailable Wiki formatting commands.\n\n\"[wiki:TracAdmin trac-admin] ''yourenvdir'' initenv\" created\na new Trac environment, containing a default set of wiki pages and some sample\ndata. This newly created environment also contains\n[wiki:TracGuide documentation] to help you get started with your project.\n\nYou can use [wiki:TracAdmin trac-admin] to configure\n[http://trac.edgewall.org/ Trac] to better fit your project, especially in\nregard to ''components'', ''versions'' and ''milestones''.\n\n\nTracGuide is a good place to start.\n\nEnjoy! [[BR]]\n''The Trac Team''\n\n== Starting Points\n\n * TracGuide -- Built-in Documentation\n * [http://trac.edgewall.org/ The Trac project] -- Trac Open Source Project\n * [http://trac.edgewall.org/wiki/TracFaq Trac FAQ] -- Frequently Asked Questions\n * TracSupport -- Trac Support\n\nFor a complete list of local wiki pages, see TitleIndex.\n"}
JSON-RPC quick tutorial
1
2
3
4
5
6
7
8
9
10
11
12
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.listMethods
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.methodHelp params:='["system.listMethods"]'
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.methodHelp params:='["system.methodHelp"]'
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.methodHelp params:='["system.methodSignature"]'
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.methodSignature params:='["system.listMethods"]'# (ret)array
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.methodSignature params:='["system.methodHelp"]'# (ret)string, (arg)string
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.methodSignature params:='["system.methodSignature"]'# (ret)array, (arg)string
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=system.getAPIVersion # 1.1.9
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=ticket.getActions params:='[1]'# leave resolve reassign accept
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=ticket.get params:='[1]'
http -v --verify=no --auth user0:1 POST http://localhost:8000/login/rpc method=ticket.getTicketFields