Difference between revisions of "The Calaka system"

From Organic Design
Jump to: navigation, search
(The Calaka MediaWiki extension)
(Change source-code blocks to standard format)
 
Line 3: Line 3:
 
== Calaka wiki ==
 
== Calaka wiki ==
 
The Calaka wiki is a standard MediaWiki codebase with its script root in ''/var/www/domains/rene/calaka''. It uses friendly URLs (''$wgArticlePath = "/$1"'') and has the following Apache configuration section which is designed to fit in with the many other sites running on the server in the same virtual host container. The ''HTTP_HOST'' condition means that the rules will apply to any domain or sub-domain having "calaka" anywhere within it, unless the domain has already been matched by another rule prior to this section (e.g. ''svn.calaka.net'' or ''reinbek.calaka.net'').
 
The Calaka wiki is a standard MediaWiki codebase with its script root in ''/var/www/domains/rene/calaka''. It uses friendly URLs (''$wgArticlePath = "/$1"'') and has the following Apache configuration section which is designed to fit in with the many other sites running on the server in the same virtual host container. The ''HTTP_HOST'' condition means that the rules will apply to any domain or sub-domain having "calaka" anywhere within it, unless the domain has already been matched by another rule prior to this section (e.g. ''svn.calaka.net'' or ''reinbek.calaka.net'').
{{code|<pre>
+
<source>
 
RewriteCond %{HTTP_HOST} calaka
 
RewriteCond %{HTTP_HOST} calaka
 
RewriteCond %{REQUEST_URI} ^/$
 
RewriteCond %{REQUEST_URI} ^/$
Line 23: Line 23:
 
RewriteCond %{HTTP_HOST} calaka
 
RewriteCond %{HTTP_HOST} calaka
 
RewriteRule (.*) /var/www/domains/rene/calaka/$1 [L]
 
RewriteRule (.*) /var/www/domains/rene/calaka/$1 [L]
</pre>}}
+
</source>
  
 
== The Reinbek HTML site ==
 
== The Reinbek HTML site ==
 
Another plain HTML site is served from the ''/var/www/domains/rene/reinbek'' directory. This directory is an automatically updated subversion working copy of the ''reinbek'' repository. This automatic updating is achieved by adding the following one line shell script into ''/var/www/domains/rene/svn/reinbek/hooks/post-commit'' which simply calls ''svn update'' whenever a commit has completed to the ''reinbek'' repository.
 
Another plain HTML site is served from the ''/var/www/domains/rene/reinbek'' directory. This directory is an automatically updated subversion working copy of the ''reinbek'' repository. This automatic updating is achieved by adding the following one line shell script into ''/var/www/domains/rene/svn/reinbek/hooks/post-commit'' which simply calls ''svn update'' whenever a commit has completed to the ''reinbek'' repository.
{{code|<pre>
+
<source>
 
#!/bin/sh
 
#!/bin/sh
 
svn update /var/www/domains/rene/reinbek
 
svn update /var/www/domains/rene/reinbek
</pre>}}
+
</source>
 
This means that the ''reinbek'' site can be modified simply by adjusting the local working copy and committing the changes, there's no need to log into the server and update anything to make the changes take effect, and no need to wait as the update will occur immediately after the commit is complete.
 
This means that the ''reinbek'' site can be modified simply by adjusting the local working copy and committing the changes, there's no need to log into the server and update anything to make the changes take effect, and no need to wait as the update will occur immediately after the commit is complete.
  
 
The Apache configuration for the ''reinbek'' site is done with the following rules. These must appear before the ''calaka'' rules because the ''reinbek'' site's domain is ''reinbek.calaka.net'' which means that the ''calaka'' rules would also match the domain and apply. The rules are such that a dedicated domain such as ''reinbek.info'' could later be pointed at the server's IP and bring up the site without any configuration change being required.
 
The Apache configuration for the ''reinbek'' site is done with the following rules. These must appear before the ''calaka'' rules because the ''reinbek'' site's domain is ''reinbek.calaka.net'' which means that the ''calaka'' rules would also match the domain and apply. The rules are such that a dedicated domain such as ''reinbek.info'' could later be pointed at the server's IP and bring up the site without any configuration change being required.
{{code|<pre>
+
<source>
 
RewriteCond %{HTTP_HOST} reinbek
 
RewriteCond %{HTTP_HOST} reinbek
 
RewriteRule (.*) /var/www/domains/rene/reinbek$1 [L]
 
RewriteRule (.*) /var/www/domains/rene/reinbek$1 [L]
</pre>}}
+
</source>
  
 
== Databases ==
 
== Databases ==
Line 46: Line 46:
  
 
A symlink to the repositories has been added to the root directory (''/rene --> /var/www/domains/rene/svn'') so that the following simplified syntax can be used to checkout a repository:
 
A symlink to the repositories has been added to the root directory (''/rene --> /var/www/domains/rene/svn'') so that the following simplified syntax can be used to checkout a repository:
{{code|<bash>
+
<source lang="bash">
 
svn co svn+ssh://svn.calaka.net/rene/calaka
 
svn co svn+ssh://svn.calaka.net/rene/calaka
</bash>}}
+
</source>
  
 
The repositories are accessible by ''websvn'' using the same Apache rules (since they apply to any domain that uses ''svn'' as a sub-domain, and the existing codebase, but a condition needed to be added to the ''websvn/includes/config.php'' to change to the the ''/var/www/domains/rene/svn'' repository base directory if the ''HTTP_HOST'' is set to ''svn.calaka.net'' (I also changed the default language to "de" in this condition too).
 
The repositories are accessible by ''websvn'' using the same Apache rules (since they apply to any domain that uses ''svn'' as a sub-domain, and the existing codebase, but a condition needed to be added to the ''websvn/includes/config.php'' to change to the the ''/var/www/domains/rene/svn'' repository base directory if the ''HTTP_HOST'' is set to ''svn.calaka.net'' (I also changed the default language to "de" in this condition too).

Latest revision as of 18:11, 22 May 2015

The Calaka system is running within the Organic Design server environment which has been installed with this procedure. To fit in with this structure, all the Calaka-specific installation has been put into the directory /var/www/domains/rene. Within this directory is the Calaka MediaWiki, the reinbek HTML site, and the Subversion repositories. These are all described in more detail below.

Calaka wiki

The Calaka wiki is a standard MediaWiki codebase with its script root in /var/www/domains/rene/calaka. It uses friendly URLs ($wgArticlePath = "/$1") and has the following Apache configuration section which is designed to fit in with the many other sites running on the server in the same virtual host container. The HTTP_HOST condition means that the rules will apply to any domain or sub-domain having "calaka" anywhere within it, unless the domain has already been matched by another rule prior to this section (e.g. svn.calaka.net or reinbek.calaka.net).

RewriteCond %{HTTP_HOST} calaka
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* /var/www/domains/rene/calaka/index.php?title=Hauptseite&redirect=no [L]

RewriteCond %{HTTP_HOST} calaka
RewriteCond %{REQUEST_URI} ^/rene/calaka/thumb/./../.*\&
RewriteRule ^(.*?)\&(.*)$ $1\%26$2

RewriteCond %{HTTP_HOST} calaka
RewriteCond %{REQUEST_URI} ^/files/thumb/./../.+?/[0-9]+px-
RewriteRule ^.+/(.+?)/([0-9]+)px- /var/www/domains/rene/calaka/thumb.php?w=$2&f=$1 [L]

RewriteCond %{HTTP_HOST} calaka
RewriteCond /var/www/domains/rene/calaka%{REQUEST_FILENAME} !-f
RewriteCond /var/www/domains/rene/calaka%{REQUEST_FILENAME} !-d
RewriteRule (.*) /var/www/domains/rene/calaka/index.php$1 [L]

RewriteCond %{HTTP_HOST} calaka
RewriteRule (.*) /var/www/domains/rene/calaka/$1 [L]

The Reinbek HTML site

Another plain HTML site is served from the /var/www/domains/rene/reinbek directory. This directory is an automatically updated subversion working copy of the reinbek repository. This automatic updating is achieved by adding the following one line shell script into /var/www/domains/rene/svn/reinbek/hooks/post-commit which simply calls svn update whenever a commit has completed to the reinbek repository.

#!/bin/sh
svn update /var/www/domains/rene/reinbek

This means that the reinbek site can be modified simply by adjusting the local working copy and committing the changes, there's no need to log into the server and update anything to make the changes take effect, and no need to wait as the update will occur immediately after the commit is complete.

The Apache configuration for the reinbek site is done with the following rules. These must appear before the calaka rules because the reinbek site's domain is reinbek.calaka.net which means that the calaka rules would also match the domain and apply. The rules are such that a dedicated domain such as reinbek.info could later be pointed at the server's IP and bring up the site without any configuration change being required.

RewriteCond %{HTTP_HOST} reinbek
RewriteRule (.*) /var/www/domains/rene/reinbek$1 [L]

Databases

Calaka has two databases, "calaka" and "reinbek" which are both accessible by the "calaka" user. The calaka database has 506 table which include many different currently unused applications such as wordpresses etc.

Subversion repositories

There are two subversion repositories, calaka and reinbek. The former is for the development of the Calaka extension which will be documented in this article also. The latter is for updating the reinbek HTML site. The subversion installation is in accord with the Organic Design Configure SVN procedure except that the repositories are stored in /var/www/domains/rene/svn instead of /var/www' and we're not using the generic svn user.

A symlink to the repositories has been added to the root directory (/rene --> /var/www/domains/rene/svn) so that the following simplified syntax can be used to checkout a repository:

svn co svn+ssh://svn.calaka.net/rene/calaka

The repositories are accessible by websvn using the same Apache rules (since they apply to any domain that uses svn as a sub-domain, and the existing codebase, but a condition needed to be added to the websvn/includes/config.php to change to the the /var/www/domains/rene/svn repository base directory if the HTTP_HOST is set to svn.calaka.net (I also changed the default language to "de" in this condition too).

Note that all users who require access to the subversion repositories must be added to the www-data group.

The Calaka MediaWiki extension

notes will be added soon