Setting up trac wiki: Difference between revisions
Dubiousjim (talk | contribs) (Category:Server, added comment) |
(overhaul formatting) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
This document describes how to set up a [ | This document describes how to set up a [https://trac.edgewall.org trac.edgewall.org] trac wiki. | ||
== Values and examples in this tutorial == | == Values and examples in this tutorial == | ||
The values | The values <code>tracadmin</code>, <code>example.com</code>, <code>secret</code> and various paths and project names used in this tutorial are just examples. In most cases you can change them to something that suits you. | ||
= Basic Trac installation and configuration = | == Basic Trac installation and configuration == | ||
== Installing Trac == | === Installing Trac === | ||
Update apk repository and install | Update apk repository and install {{pkg|trac}} | ||
{{Cmd| | {{Cmd|# apk add trac}} | ||
apk add trac}} | |||
== Creating a Project Environment == | === Creating a Project Environment === | ||
We need to initiate a new environment | We need to initiate a new environment | ||
{{Cmd|# trac-admin /var/lib/trac/''myproject'' initenv}} | |||
* Enter some project name when prompted | * Enter some project name when prompted | ||
* Leave default sqlite DB (just press enter) | * Leave default sqlite DB (just press enter) | ||
== Configuring Authentication/Security == | === Configuring Authentication/Security === | ||
=== Create password-file === | ==== Create password-file ==== | ||
Initially you need to manually create a password file containing this information | Initially you need to manually create a password file containing this information | ||
{{Cmd| | {{Cmd|# echo -n "''tracadmin'':''example.com'':" > /var/lib/trac/''myproject''/users.htdigest | ||
echo -n "tracadmin:example.com:secret" | md5sum | cut -d ' ' -f 1 >> /var/lib/trac/myproject/users.htdigest | # echo -n "''tracadmin'':''example.com'':secret" | md5sum | cut -d ' ' -f 1 >> /var/lib/trac/''myproject''/users.htdigest}} | ||
Run the following command in case you are curious how the file looks like | Run the following command in case you are curious how the file looks like | ||
{{cmd|# cat /var/lib/trac/''myproject''/users.htdigest}} | |||
''(You should see something that looks like | ''(You should see something that looks like <code>tracadmin:example.com:72842d9ffe3f4f63306a06756d2953ee</code>)'' | ||
=== Assign admin-rights === | ==== Assign admin-rights ==== | ||
Next is to give admin-rights to your | Next is to give admin-rights to your <code>tracadmin</code> account | ||
{{Cmd|# trac-admin /var/lib/trac/''myproject'' permission add tracadmin TRAC_ADMIN}} | |||
== Testing the Standalone Server == | === Testing the Standalone Server === | ||
Lets test if your password-file and other configurations worked as they are supposed to.<BR> | Lets test if your password-file and other configurations worked as they are supposed to.<BR> | ||
In case something is broken, this test would give you a hint on what's wrong. | In case something is broken, this test would give you a hint on what's wrong. | ||
{{Cmd|<nowiki># tracd --port 80 --auth=*,/var/lib/trac/<i>myproject</i>/users.htdigest,<i>example.com</i> /var/lib/trac/<i>myproject</i></nowiki>}} | |||
Try connect to trac with webbrowser on http://ip.of.the.box | Try connect to trac with webbrowser on <nowiki>http://ip.of.the.box</nowiki> | ||
If it works as expected, you can kill the above command ''(using CTRL+C in the terminal where the command was started)'' and continue reading this tutorial. | If it works as expected, you can kill the above command ''(using CTRL+C in the terminal where the command was started)'' and continue reading this tutorial. | ||
== Configuration/Startup == | === Configuration/Startup === | ||
=== Startup configuration === | ==== Startup configuration ==== | ||
{{path|/etc/conf.d/tracd}} needs to be edited in order for <code>tracd</code> to start. | |||
{{cat|/etc/conf.d/tracd|<nowiki>... | |||
TRACD_PORT="8000" | |||
TRACD_OPTS="--auth=*,/var/lib/trac/<i>myproject</i>/users.htdigest,<i>example.com</i> /var/lib/trac/<i>myproject</i>" | |||
</nowiki>}} | |||
{{Note|If you want to run tracd on port 80 (or some other port below 1024) you would need to modify the above config so that tracd is run as "root".}} | {{Note|If you want to run tracd on port 80 (or some other port below 1024) you would need to modify the above config so that tracd is run as "root".}} | ||
{{tip|The file could be edited by executing this command: | {{tip|The file could be edited by executing this command: <code>vi /etc/conf.d/tracd</code>}} | ||
=== File/folder permissions === | ==== File/folder permissions ==== | ||
Set file/folder permissions for the | Set file/folder permissions for the <code>tracd</code> user. | ||
{{Cmd|# chown -R tracd:tracd /var/lib/trac}} | |||
== Manually start == | === Manually start === | ||
Now it's time to fire up your trac. | Now it's time to fire up your trac. | ||
{{Cmd|# rc-service tracd start}} | |||
''(By this time you should be able to browse your tracd with a webbrowser pointed to http://ip.of.the.box)'' | ''(By this time you should be able to browse your tracd with a webbrowser pointed to <code><nowiki>http://ip.of.the.box</nowiki></code>)'' | ||
== Atomatically start at next boot == | === Atomatically start at next boot === | ||
Make it start during boot. | Make it start during boot. | ||
{{Cmd|# rc-update add tracd}} | |||
== Save your configuration == | === Save your configuration === | ||
Now would be a good time make sure your configuration stays permanent. You wouldn't want to loose everything at next reboot.<BR> | Now would be a good time make sure your configuration stays permanent. You wouldn't want to loose everything at next reboot.<BR> | ||
Depending on how you setup your alpine host, this procedure is done differently. | Depending on how you setup your alpine host, this procedure is done differently. | ||
=== When running from CD === | ==== When running from CD ==== | ||
If you are running alpine from a CD ''(as I did when writing this tutorial)'' you might want to save your configuration to a USB-mem.<BR> | If you are running alpine from a CD ''(as I did when writing this tutorial)'' you might want to save your configuration to a USB-mem.<BR> | ||
But in order to backup the /var/lib/trac projects you would need to tell apk to take a copy of the running project(s). ''(see [[ | But in order to backup the {{path|/var/lib/trac}} projects you would need to tell apk to take a copy of the running project(s). ''(see [[Alpine local backup#Execute a script as part of a backup]] about details on how such scripts are created)'' | ||
In short: We create | In short: We create {{path|/etc/lbu/pre-package.d/tracd}} with the following content | ||
{{cat|/etc/lbu/pre-package.d/tracd|<nowiki>#!/bin/sh | |||
TRACPATH=/var/lib/trac | |||
BACKUPPATH=/etc/trac/backup | |||
mkdir -p ${BACKUPPATH} | |||
for i in $(ls ${TRACPATH}); do | |||
trac-admin ${TRACPATH}/${i} hotcopy ${BACKUPPATH}/${i} | |||
done | |||
</nowiki>}} | |||
And then we make the script executable | And then we make the script executable | ||
{{cmd|chmod +x /etc/lbu/pre-package.d/tracd}} | {{cmd|# chmod +x /etc/lbu/pre-package.d/tracd}} | ||
=== When running from HDD install === | ==== When running from HDD install ==== | ||
When using a HDD installed alpine, everything is written to HDD so you would not need to take any extra steps to save it permanent ''(except you might want to take backups in case your HDD gets broken)''. | When using a HDD installed alpine, everything is written to HDD so you would not need to take any extra steps to save it permanent ''(except you might want to take backups in case your HDD gets broken)''. | ||
== Finished installing a basic trac system == | === Finished installing a basic trac system === | ||
If you only want a basic trac system you have now reached your goal.<BR> | If you only want a basic trac system you have now reached your goal.<BR> | ||
Everything from now on is more or less optional.<BR> | Everything from now on is more or less optional.<BR> | ||
Line 95: | Line 88: | ||
{{tip|Continue reading this tutorial!}} | {{tip|Continue reading this tutorial!}} | ||
= Backup = | == Backup == | ||
To create a backup of a live TracEnvironment, simply run: | To create a backup of a live TracEnvironment, simply run: | ||
{{Cmd|# trac-admin /var/lib/trac/myproject hotcopy /path/to/backupdir}} | |||
= Additional configuration and modifications = | == Additional configuration and modifications == | ||
== Advanced settings == | === Advanced settings === | ||
{{path|/var/lib/trac/myproject/conf/trac.ini}} holds various settings that you might want to go through.<BR> | |||
In order for those changes to take effect you would need to restart | In order for those changes to take effect you would need to restart <code>tracd</code> | ||
{{cmd|# rc-service tracd restart}} | |||
== Running single or multiple projects == | === Running single or multiple projects === | ||
=== Multiple projects === | ==== Multiple projects ==== | ||
Follow the steps mentioned in the above [[#Creating_a_Project_Environment|Creating a Project Environment]] and [[#Configuring_Authentication.2FSecurity|Configuring Authentication/Security]] sections to create a new project.<BR> | Follow the steps mentioned in the above [[#Creating_a_Project_Environment|Creating a Project Environment]] and [[#Configuring_Authentication.2FSecurity|Configuring Authentication/Security]] sections to create a new project.<BR> | ||
You might also need to change permissions for your newly created project - see [[#File.2Ffolder_permissions|File/folder permissions]] section for details. | You might also need to change permissions for your newly created project - see [[#File.2Ffolder_permissions|File/folder permissions]] section for details. | ||
Next you would need to modify | Next you would need to modify {{path|/etc/conf.d/tracd}} in order to have multiple projects running on your trac server.<BR> | ||
Personally I just added a line with the new | Personally I just added a line with the new <code>TRACD_OPTS</code> pointing to my new project: | ||
{{cat|/etc/conf.d/tracd|<nowiki>... | |||
TRACD_OPTS="--auth=*,/var/lib/trac/<i>myproject</i>/users.htdigest,<i>example.com</i> /var/lib/trac/<i>myproject</i>" | |||
TRACD_OPTS="$TRACD_OPTS --auth=*,/var/lib/trac/<i>myproject2</i>/users.htdigest,<i>example.com</i> /var/lib/trac/<i>myproject2</i>" | |||
<nowiki>}} | |||
=== Single project === | ==== Single project ==== | ||
If you know that you only want one project you could add | If you know that you only want one project you could add <code>--single-env</code> to the {{path|/etc/conf.d/tracd}} config-file.<BR> | ||
Modify the TRACD_OPTS parameter adding the | Modify the <code>TRACD_OPTS</code> parameter adding the </code>--single-env</code> value to it (see example below): | ||
{{cat|/etc/conf.d/tracd|<nowiki>... | |||
When running as | TRACD_OPTS="--single-env --auth=*,/var/lib/trac/<i>myproject</i>/users.htdigest,<i>example.com</i> /var/lib/trac/<i>myproject</i>" | ||
...</nowiki>}} | |||
When running as <code>single-env</code> you will automatically be routed to your trac-project instead of being presented a list of the available projects. | |||
== Install useful addons (trac hacks) == | === Install useful addons (trac hacks) === | ||
=== Prerequisites === | ==== Prerequisites ==== | ||
In order to install trac-hacks you would need to install some additional applications. | In order to install trac-hacks you would need to install some additional applications. | ||
{{cmd| | {{cmd|# apk add {{pkg|py-setuptools}} {{pkg|subversion}} {{pkg|python-dev}}}} | ||
apk add py-setuptools | {{tip|When you are done installing various trac-hacks you could try to uninstall the above packages using <code>apk del</code> to free memory.<BR> | ||
{{tip|When you are done installing various trac-hacks you could try to uninstall the above packages using | |||
You will notice in case some other program needs them and you will be prevented from uninstalling the package.}} | You will notice in case some other program needs them and you will be prevented from uninstalling the package.}} | ||
==== During installation ==== | ===== During installation ===== | ||
During installation of a trac hack, you might get prompted about some certificate validity. Accept it to continue installation. | During installation of a trac hack, you might get prompted about some certificate validity. Accept it to continue installation. | ||
==== After applying a trac hack ==== | ==== After applying a trac hack ==== | ||
When a trac hack is installed you will need to restart tracd before you can start configuring and using it. | When a trac hack is installed you will need to restart tracd before you can start configuring and using it. | ||
{{cmd|# rc-service tracd restart}} | |||
==== Configuring a trac hack ==== | ===== Configuring a trac hack ===== | ||
When the trac hack is installed and tracd is rebooted you can browse to tracd and logon with your | When the trac hack is installed and tracd is rebooted you can browse to tracd and logon with your <code>tracadmin</code> account.<BR> | ||
You should see a [Admin] option in the menu.<BR> | You should see a [Admin] option in the menu.<BR> | ||
From the 'Admin' console you will find 'Plugins' from the Administration menu. | From the 'Admin' console you will find 'Plugins' from the Administration menu. | ||
Start managing your plugins ''(you would most likely need to consult | Start managing your plugins ''(you would most likely need to consult https://trac-hacks.org when doing your modifications/configuration of the various trac hacks)''. | ||
=== Account Manager Plugin === | ==== Account Manager Plugin ==== | ||
Account Manager Plugin is used to manage accounts by using tracd interface instead of manually modify the | Account Manager Plugin is used to manage accounts by using tracd interface instead of manually modify the {{path|users.htdigest}} file as we did when installing trac (https://trac-hacks.org/wiki/AccountManagerPlugin) | ||
{{cmd|easy_install-2.7 https://trac-hacks.org/svn/accountmanagerplugin/0.11}} | {{cmd|# easy_install-2.7 https://trac-hacks.org/svn/accountmanagerplugin/0.11}} | ||
=== TracGit === | ==== TracGit ==== | ||
GIT version control plugin for Trac 0.12 ( | GIT version control plugin for Trac 0.12 (https://trac-hacks.org/wiki/GitPlugin) | ||
{{cmd|easy_install-2.7 | {{cmd|# easy_install-2.7 https://github.com/hvr/trac-git-plugin/tarball/master}} | ||
=== TracTags === | ==== TracTags ==== | ||
Useful plugin to tag various pages/tickets/etc. You can use the 'tags' to find and sort your information ( | Useful plugin to tag various pages/tickets/etc. You can use the 'tags' to find and sort your information (https://trac-hacks.org/wiki/TagsPlugin) | ||
{{cmd|easy_install-2.7 https://trac-hacks.org/svn/tagsplugin/tags/0.6}} | {{cmd|# easy_install-2.7 https://trac-hacks.org/svn/tagsplugin/tags/0.6}} | ||
After you installed the plugin, restarted | After you installed the plugin, restarted <code>tracd</code> and activated the plugin-components you will need to upgrade your project by issuing the following command | ||
{{cmd|trac-admin /var/lib/trac/myproject upgrade}} | {{cmd|# trac-admin /var/lib/trac/<i>myproject</i> upgrade}} | ||
=== Other === | ==== Other ==== | ||
There are <ins>lots of</ins> various plugins.<BR> | There are <ins>lots of</ins> various plugins.<BR> | ||
Have a look at | Have a look at https://trac-hacks.org/wiki#Hacks to find something that suits your needs. | ||
== Version control == | === Version control === | ||
Trac can do version control using subversion or git. | Trac can do version control using subversion or git. | ||
=== Subversion repository === | ==== Subversion repository ==== | ||
{{Todo|This 'Subversion repository' section is not complete. It needs some additional testing and documentation.}} | {{Todo|This 'Subversion repository' section is not complete. It needs some additional testing and documentation.}} | ||
We need to install | We need to install {{pkg|subversion}} | ||
{{Cmd|apk add subversion}} | {{Cmd|# apk add subversion}} | ||
Create a svn repository | Create a svn repository | ||
{{Cmd|mkdir /var/lib/subversion | {{Cmd|<nowiki># mkdir /var/lib/subversion | ||
svnadmin create /var/lib/subversion/myproject}} | # svnadmin create /var/lib/subversion/<i>myproject</i> | ||
</nowiki>}} | |||
Next we need to tell trac to view/show this repository. | Next we need to tell trac to view/show this repository. | ||
[[Category:Server]] | [[Category:Server]] | ||
[[Category:Programming]] |
Latest revision as of 11:48, 25 September 2023
This document describes how to set up a trac.edgewall.org trac wiki.
Values and examples in this tutorial
The values tracadmin
, example.com
, secret
and various paths and project names used in this tutorial are just examples. In most cases you can change them to something that suits you.
Basic Trac installation and configuration
Installing Trac
Update apk repository and install trac
# apk add trac
Creating a Project Environment
We need to initiate a new environment
# trac-admin /var/lib/trac/myproject initenv
- Enter some project name when prompted
- Leave default sqlite DB (just press enter)
Configuring Authentication/Security
Create password-file
Initially you need to manually create a password file containing this information
# echo -n "tracadmin:example.com:" > /var/lib/trac/myproject/users.htdigest
- echo -n "tracadmin:example.com:secret"
Run the following command in case you are curious how the file looks like
# cat /var/lib/trac/myproject/users.htdigest
(You should see something that looks like tracadmin:example.com:72842d9ffe3f4f63306a06756d2953ee
)
Assign admin-rights
Next is to give admin-rights to your tracadmin
account
# trac-admin /var/lib/trac/myproject permission add tracadmin TRAC_ADMIN
Testing the Standalone Server
Lets test if your password-file and other configurations worked as they are supposed to.
In case something is broken, this test would give you a hint on what's wrong.
# tracd --port 80 --auth=*,/var/lib/trac/<i>myproject</i>/users.htdigest,<i>example.com</i> /var/lib/trac/<i>myproject</i>
Try connect to trac with webbrowser on http://ip.of.the.box
If it works as expected, you can kill the above command (using CTRL+C in the terminal where the command was started) and continue reading this tutorial.
Configuration/Startup
Startup configuration
/etc/conf.d/tracd needs to be edited in order for tracd
to start.
Contents of /etc/conf.d/tracd
vi /etc/conf.d/tracd
File/folder permissions
Set file/folder permissions for the tracd
user.
# chown -R tracd:tracd /var/lib/trac
Manually start
Now it's time to fire up your trac.
# rc-service tracd start
(By this time you should be able to browse your tracd with a webbrowser pointed to http://ip.of.the.box
)
Atomatically start at next boot
Make it start during boot.
# rc-update add tracd
Save your configuration
Now would be a good time make sure your configuration stays permanent. You wouldn't want to loose everything at next reboot.
Depending on how you setup your alpine host, this procedure is done differently.
When running from CD
If you are running alpine from a CD (as I did when writing this tutorial) you might want to save your configuration to a USB-mem.
But in order to backup the /var/lib/trac projects you would need to tell apk to take a copy of the running project(s). (see Alpine local backup#Execute a script as part of a backup about details on how such scripts are created)
In short: We create /etc/lbu/pre-package.d/tracd with the following content
Contents of /etc/lbu/pre-package.d/tracd
And then we make the script executable
# chmod +x /etc/lbu/pre-package.d/tracd
When running from HDD install
When using a HDD installed alpine, everything is written to HDD so you would not need to take any extra steps to save it permanent (except you might want to take backups in case your HDD gets broken).
Finished installing a basic trac system
If you only want a basic trac system you have now reached your goal.
Everything from now on is more or less optional.
If you are not in too much hurry I would suggest you continue reading below - you might find some things useful!
Backup
To create a backup of a live TracEnvironment, simply run:
# trac-admin /var/lib/trac/myproject hotcopy /path/to/backupdir
Additional configuration and modifications
Advanced settings
/var/lib/trac/myproject/conf/trac.ini holds various settings that you might want to go through.
In order for those changes to take effect you would need to restart tracd
# rc-service tracd restart
Running single or multiple projects
Multiple projects
Follow the steps mentioned in the above Creating a Project Environment and Configuring Authentication/Security sections to create a new project.
You might also need to change permissions for your newly created project - see File/folder permissions section for details.
Next you would need to modify /etc/conf.d/tracd in order to have multiple projects running on your trac server.
Personally I just added a line with the new TRACD_OPTS
pointing to my new project:
Contents of /etc/conf.d/tracd
When running as single-env
you will automatically be routed to your trac-project instead of being presented a list of the available projects.
Install useful addons (trac hacks)
Prerequisites
In order to install trac-hacks you would need to install some additional applications.
# apk add py-setuptools subversion python-dev
apk del
to free memory.You will notice in case some other program needs them and you will be prevented from uninstalling the package.
During installation
During installation of a trac hack, you might get prompted about some certificate validity. Accept it to continue installation.
After applying a trac hack
When a trac hack is installed you will need to restart tracd before you can start configuring and using it.
# rc-service tracd restart
Configuring a trac hack
When the trac hack is installed and tracd is rebooted you can browse to tracd and logon with your tracadmin
account.
You should see a [Admin] option in the menu.
From the 'Admin' console you will find 'Plugins' from the Administration menu.
Start managing your plugins (you would most likely need to consult https://trac-hacks.org when doing your modifications/configuration of the various trac hacks).
Account Manager Plugin
Account Manager Plugin is used to manage accounts by using tracd interface instead of manually modify the users.htdigest file as we did when installing trac (https://trac-hacks.org/wiki/AccountManagerPlugin)
# easy_install-2.7 https://trac-hacks.org/svn/accountmanagerplugin/0.11
TracGit
GIT version control plugin for Trac 0.12 (https://trac-hacks.org/wiki/GitPlugin)
# easy_install-2.7 https://github.com/hvr/trac-git-plugin/tarball/master
TracTags
Useful plugin to tag various pages/tickets/etc. You can use the 'tags' to find and sort your information (https://trac-hacks.org/wiki/TagsPlugin)
# easy_install-2.7 https://trac-hacks.org/svn/tagsplugin/tags/0.6
After you installed the plugin, restarted tracd
and activated the plugin-components you will need to upgrade your project by issuing the following command
# trac-admin /var/lib/trac/myproject upgrade
Other
There are lots of various plugins.
Have a look at https://trac-hacks.org/wiki#Hacks to find something that suits your needs.
Version control
Trac can do version control using subversion or git.
Subversion repository
We need to install subversion
# apk add subversion
Create a svn repository
# mkdir /var/lib/subversion # svnadmin create /var/lib/subversion/<i>myproject</i>
Next we need to tell trac to view/show this repository.