SWiK-Source is the source code of the swik.net core engine. It is licensed for distribution under the GNU General Public License v2.
SWiK-Source is meant for people who are curious about the code that powers SWiK, for people who want to try making their own SWiK for their internal use or for some new web site, as well as for use with SourceLabs’ internal and partnering projects.
SourceLabs has released SWiK-Source as a source code release rather than a packaged release: it’s a complicated system built with a lot of assumptions for custom production servers rather than arbitrary or generic systems.
These documents are collaborative: if you run into trouble or see something wrong, fix the docs!
We’re preparing a new update to the SWiK site and have a lot of further updates planned, and as we go along and change and introduce new things to SWiK and SWiK-Source it seems like it might be a good idea to have a discussion over email of ideas for how SWiK should run and what features we need to add.
I dunno if there is a lot of interest in people helping decide how swik should be run, but if you’d be interested send me an email at
![]()
PS: New update to the site coming in a bit …
SWiK development is fairly loose but we have ideas of features we want to see go into SWiK-Source.
While not all of these will make it into the code, here are 10 ideas of what we are working on currently or want to work on soon. These are not in any particular order.
Because of the way our internal development works, we will only do SWiK-Source releases intermittently, when we have stable releases. Features will likely appear in swik.net before they appear in swik-source, as the website is a lot easier to change on the fly than a packaged release.
roadmap
SWiK-Source
SWiK Source – 1st Developer Release
This initial source code release is intended for a developer audience that is savvy enough to navigate complicated installation procedures and environment incompatibilities.
Due to bugs in Apache on Windows, SWiK is not capable of running perfectly on Windows and thus has not been tested for Windows at all: advised use is on Unix based servers, such as Ubuntu, Redhat/CentOS (the platform used in production) and Mac OS X (the platform used in development).
Future releases will include general maintenance of the code base to keep parity with the running service, and if there is sufficient interest or support in improving the source or the package, we will more forward on that front too.
After you have installed dependencies, setup and configured the server, you are now ready to setup and deploy the backend.
There are various long running services that SWiK Source runs on the backend. These include: RSS aggregation, and various page and tag statistics computations.
The backend is mostly Java based and requires Java version 1.5, so make sure that you have Java 1.5 installed – you can obtain this from Sun, instructions are below, or skip to the 2nd step if you have java already.
Again, in these instructions the root directory of SWiK Source where you expanded the source files will be referred to as SWIK_HOME.
You must have JDK 1.5.x installed on your machine. These instructions detail how to download and install the Java 1.5 JDK. You should install the latest minor release.
Download the x86-64 version of the JDK. Pick the proper Java 1.5 JDK for your machine. These instructions assume you downloaded the AMD64 version, adjust as necessary for your own environment.
Run the self-extracting .bin file:
chmod a+x jdk-1_5_0_05-linux-amd64-rpm.bin*
./jdk-1_5_0_05-linux-amd64-rpm.bin*
As root, install the RPM that emerges:
rpm -iv jdk-1_5_0_<version>-linux-i586.rpm
(notice). These instruction assume that the new Java is on your path. At this point you should add the new version of Java to your path.
java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_05-b05, mixed mode)
Now you need to deploy your backend. The script assumes that Java 1.5 is on your path when you execute the script. If this is not true you’ll need to modify the script to pick up the proper version of Java.
cd SWIK_HOME/setup
bash -x ./backend_setup.sh config
This should start the backend. You can verify this by looking in the /opt/swik/backend/logs directory and verify that there are three sets of logs, feedsucker, strength and zeitgrinder. There should be both a status and error log for each.
installation
backend
SWiK-Source
Thing that often break in SWiK-Source, and why they break. The best way to diagnose problems is to check in the /logs directory. app.errors.log is a good place to look for application errors that occur on page load, app.ajax-errors.log is a good place to look for errors that occur through interactivity with ajax features.
SWiK assumes a dedicated domain, such as swik.net, or no domain, for use in local host, see localhost install notes. The domain must not have a subdomain. Requests to SWiK are sent to apache through the virtual host setup, and then apache passes the request to swik.php, along with the raw query string. SWiK parses the query string and goes through each major page type, using an inverted control scheme to ask if a page wants to service the request.
This can go wrong because:SWiK-Source does not encode the ’:’ entity in urls such as User:alex. On Unix in Apache 2.0, this is allowed, on Windows OR in Apache 1.0 this is not.
To fix this issue:This occurs because SWiK execs a ruby textile script to generate the description cache, and it may have difficulty .
This can be because:check both these things.
RSS feeds are syndicated using a temporary file, and then parsed with MagpieRSS.
If there is an issue with this, it can be because:Icon uploads use a two stage system. First the icon is persisted into the database; on the next request the icon is cached into a web directory. This is to ensure a single store for a multi-web-server environment, and cache icons for fast access.
If there is a problem with icon upload, it can be because:
installation
Problems
troubleshooting
SWiK-Source
Setting up and installing SWiK Source requires you have the necessary components installed first.
After this is complete, you can run the backend deployment.
installation
setup
SWiK-Source
Setting up SWiK Source is a three step process. First, make sure you are running the software that SWiK Source relies upon, such as PHP and Apache. Second, configure your wiki and deploy it to a production directory. Finally, configure and deploy the backend services.
All documentation for SWiK Source lives on SWiK, so please refer to it if you have an issue, or improve it if you notice something lacking.
installation
SWiK-Source
SWiK Source is built on and integrated with the platform combination of PHP, MySQL, and Apache HTTPd. These applications are not packaged as part of the distribution, however SWiK Source requires these and other 3rd party open source components to run properly.
List of components you must either have or obtain and install before setting up SWiK Source:Install these components yourself, or look down for how to compile these from source.
After you have completed installation of these components, continue to Setup and Deployment.
Note: These instructions assume you will make a directory called /usr/local/work and do your downloads and installations from there. If you deviate from this, please be careful to note instructions specific to this install directory.
Note: Many of these steps involve installing and configuring system level software, as such the steps assume that you are running as root. (“su -”, “sudo bash”, etc). If you are concerned about running as root, you can run much of the configuration without the privilege but please note steps that will have system level impact and do sudo accordingly.
Finally, all the steps assume you are setting your wiki up on a clean machine. If you have previous installations of components, you’ll have to adjust these instructions accordingly to make sure that your installations match the dependencies.
If you are using a package management system (such as yum on CentOS or Fedora) you can just make sure you’ve got the right packages installed, skipping all the following steps. For a CentOS 4.3 install, we used the following packages:
php-5.0.4-5.centos4
php-pear-5.0.4-5.centos4
php-ldap-5.0.4-5.centos4
php-mysql-5.0.4-5.centos4
php-mbstring-5.0.4-5.centos4
php-xml-5.0.4-5.centos4
php-imap-5.0.4-5.centos4
php-gd-5.0.4-5.centos4
php-xmlrpc-5.0.4-5.centos4
php-devel-5.0.4-5.centos4
httpd-suexec-2.0.52-22.ent.centos4
httpd-2.0.52-22.ent.centos4
httpd-devel-2.0.52-22.ent.centos4
mysqlclient10-3.23.58-4.RHEL4.1
mysql-4.1.20-1.RHEL4.1
mysql-server-4.1.20-1.RHEL4.1
On RedHat based systems, you can verify these are installed using ‘rpm -qa | grep [php|httpd|mysql]’
For installation on Ubuntu, here are the package matches discovered so far:
php-5.0.4-5.centos4 - php5
php-pear-5.0.4-5.centos4 - php-pear
php-ldap-5.0.4-5.centos4 - php5-ldap
php-mysql-5.0.4-5.centos4 - php5-mysql
php-mbstring-5.0.4-5.centos4 - - libapache2-mod-php5
php-xml-5.0.4-5.centos4 - php-xml-parser (?)
php-imap-5.0.4-5.centos4 - php5-imap
php-gd-5.0.4-5.centos4 - php5-gd
php-xmlrpc-5.0.4-5.centos4 - php5-xmlrpc
php-devel-5.0.4-5.centos4 - php5-dev (?)
httpd-suexec-2.0.52-22.ent.centos4 - - apache2-mpm-perchild (?)
httpd-2.0.52-22.ent.centos4 - - apache2 (?)
httpd-devel-2.0.52-22.ent.centos4 - apache2-utils (?)
mysqlclient10-3.23.58-4.RHEL4.1 - mysql-client
mysql-4.1.20-1.RHEL4.1 - mysql-common (?)
mysql-server-4.1.20-1.RHEL4.1 - mysql-server
libpng - libpng12-0
libjpg - libjpeg62
Java - sun-java5-jdk
Ruby - ruby
These are the primary versions which have been fully tested for SWiK Source. It should be fine to use new minor release, but some higher point releases may break.
Run the installer. The installer puts everything in /usr/local/mysql-blahblah and links to it from /usr/local/mysql. Set a root password!, or not (it’s a lot easier to manipulate data when you don’t … sure is a lot more secure when you do).
cd /usr/local/work
tar xfj httpd-2.0.54.tar.bz2
cd httpd-2.0.54
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite=shared --with-mpm=prefork --enable-expires=shared
make && make install
Note: The httpd.conf will be configured later, when setting up and deploying the wiki.
cd /usr/local/work
tar xfz libxml2-2.6.17.tar.gz
cd libxml2-2.6.17
./configure --prefix=/usr/local
make && make install
The JPEG and PNG libraries for working with images need to be downloaded.
cd /usr/local/work
curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
curl -O http://heanet.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.6rc5.tar.gz
gnutar xzf jpegsrc.v6b.tar.gz
gnutar xzf libpng-1.2.6rc5.tar.gz
cd jpeg-6b
./configure
make install
make install-lib
ranlib /usr/local/lib/libjpeg.a
cd ..
cd libpng-1.2.6rc5 cp scripts/makefile.your_environment ./Makefile
You need to make a few changes to the Makefile to point at your zlib locations before you build the library.
EDITOR_PROGRAM Makefile
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib
# Where the zlib library and include files are located
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
make make install ranlib /usr/local/lib/libpng.a
cd /usr/local/work
tar xfj ~/php-5.0.4.tar.bz2
cd php-5.0.4
./configure --prefix=/usr/local/php5
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql
--enable-mbstring --enable-mbregex --enable-soap --with-libxml2=/usr/local
--with-zlib=/usr --with-iconv --with-gd --with-jpeg-dir=/usr/local/work/jpeg-6b
make && make install
Note: php.ini will be setup later.
If you successfully completed these steps, you’ve now got the platform for SWiK Source to run. Please continue to the next step: SWiK Source Setup and Deployment.
installation
Dependencies
SWiK-Source
Running a SWiK Source wiki on your local machine requires a few modifications to your configuration.
Add the following to your */etc/hosts
127.0.0.1 @SWIK_HOSTNAME 127.0.0.1 zeitgeist.@SWIK_HOSTNAME 127.0.0.1 history.@SWIK_HOSTNAME 127.0.0.1 xml.history.@SWIK_HOSTNAME 127.0.0.1 xml.@SWIK_HOSTNAME 127.0.0.1 icon.@SWIK_HOSTNAME
You need to remove the cookie domain from php.ini.
# cd SWIK_CONFIG # EDITOR_PROGRAM php.ini # Find the ‘session.cookie_domain’ line are remove the value, the line should look like:session.cookie_domain =
You need to add the ServerName to you @SWIK_HOSTNAME.
cd SWIK_CONFIG
EDITOR_PROGRAM php.ini
ServerName @SWIK_HOSTNAME
SWiK-Source