Blame Artworks/Webenv/Moin/1.5.7/create-wikifarm-instance.sh

Alain Reguera Delgado 46de3c
#!/bin/bash
Alain Reguera Delgado 46de3c
# moinmoin-postinstall.sh
Alain Reguera Delgado 46de3c
# MoinMoin 1.5 wikifarm instance installation script.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# The CentOS Artwork SIG.
Alain Reguera Delgado 46de3c
# http://wiki.centos.org/ArtWork
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# ---------------------------------------------------------
Alain Reguera Delgado 46de3c
# Begin Configuration Section
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# First Wiki Site Name. This is the name shown in the browser 
Alain Reguera Delgado 46de3c
# title bar.
Alain Reguera Delgado 46de3c
WIKISITENAME="mywiki"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Your Domain Name (without the trailing slash).
Alain Reguera Delgado 46de3c
MYDOMAIN="localdomain"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Name of the Wiki Front Page.
Alain Reguera Delgado 46de3c
WIKIFRONTPAGE="FrontPage"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Directory name where the wiki instance will be copied.
Alain Reguera Delgado 46de3c
WIKILOCATION=/var/www/
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Instance Name.
Alain Reguera Delgado 46de3c
WIKIINSTANCE="wikifarm"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Alias name used to access wiki static files. This value
Alain Reguera Delgado 46de3c
# should be different from $WIKIALIAS above.
Alain Reguera Delgado 46de3c
WIKIURLPREFIX="staticfiles"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Wiki Super User. Add your WikiUserName here.
Alain Reguera Delgado 46de3c
WIKISUPERUSER="YourName"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Do you want to restrict the edit actions ?  (yes|no).
Alain Reguera Delgado 46de3c
# 
Alain Reguera Delgado 46de3c
# a) If `yes' only the wiki superuser, and those listed into
Alain Reguera Delgado 46de3c
# EditGroup and AdminGroup pages will be able to edit pages
Alain Reguera Delgado 46de3c
# on your wiki. After this script is run, we suggest to:
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
#    1. Register the superuser. For example:
Alain Reguera Delgado 46de3c
#	Login > UserPreferences > Create Profile
Alain Reguera Delgado 46de3c
#    2. Create a EditGroup page.
Alain Reguera Delgado 46de3c
#    3. Add registered user names into EditGroup page.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
#       At this point those users listed in EditGroup will
Alain Reguera Delgado 46de3c
#       be able to edit pages on your wiki. If you need to
Alain Reguera Delgado 46de3c
#       grant admin rights to other people then create the
Alain Reguera Delgado 46de3c
#       AdminGroup page and add register users names into
Alain Reguera Delgado 46de3c
#       it. After that they will have admin rights.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
#       More info about acl can be found at
Alain Reguera Delgado 46de3c
#       http://localhost/wiki/HelpOnAccessControlLists once
Alain Reguera Delgado 46de3c
#       you have installed the wiki.
Alain Reguera Delgado 46de3c
# 
Alain Reguera Delgado 46de3c
# b) If `no' all users will be able to edit your wiki. Even
Alain Reguera Delgado 46de3c
# if they haven't a user register on it.
Alain Reguera Delgado 46de3c
WIKIRESTRICTEDIT="no"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Mail
Alain Reguera Delgado 46de3c
WIKIMAILSMARTHOST=""
Alain Reguera Delgado 46de3c
WIKIMAILFROM=""
Alain Reguera Delgado 46de3c
WIKIMAILLOGIN=""
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Language.
Alain Reguera Delgado 46de3c
WIKILANGUAGE="en"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Basic installation Prefix.
Alain Reguera Delgado 46de3c
PREFIX=/usr
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Share directory name.
Alain Reguera Delgado 46de3c
SHARE=$PREFIX/share/moin/
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# User & Group used by your web server.
Alain Reguera Delgado 46de3c
USER=apache
Alain Reguera Delgado 46de3c
GROUP=$USER
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# End of Configuration section
Alain Reguera Delgado 46de3c
# ---------------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Copy files
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# Here we create directories and copy files into the
Alain Reguera Delgado 46de3c
# instance.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
cd $WIKILOCATION
Alain Reguera Delgado 46de3c
mkdir -p ${WIKIINSTANCE}/cgi-bin/
Alain Reguera Delgado 46de3c
mkdir -p ${WIKIINSTANCE}/${WIKISITENAME}.${MYDOMAIN}/
Alain Reguera Delgado 46de3c
cp -r ${SHARE}data/* ${WIKIINSTANCE}/${WIKISITENAME}.${MYDOMAIN}/
Alain Reguera Delgado 46de3c
cp -r ${SHARE}data ${WIKIINSTANCE}/
Alain Reguera Delgado 46de3c
cp -r ${SHARE}htdocs $WIKIINSTANCE
Alain Reguera Delgado 46de3c
cp -r ${SHARE}underlay $WIKIINSTANCE
Alain Reguera Delgado 46de3c
cp ${SHARE}server/moin.cgi ${WIKIINSTANCE}/cgi-bin/
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Fix PATH in moin.cgi file
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
sed -i -e "
Alain Reguera Delgado 46de3c
        s/\/path\/to\/wikiconfig/\/var\/www\/${WIKIINSTANCE}\/cgi-bin/
Alain Reguera Delgado 46de3c
        s/\/path\/to\/farmconfig/\/var\/www\/${WIKIINSTANCE}\/cgi-bin\/farmconfig/
Alain Reguera Delgado 46de3c
        " ${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Apache Configuration
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# Here we create the apache configuration file. By default
Alain Reguera Delgado 46de3c
# the wiki will be accessed through the `wiki' apache alias.
Alain Reguera Delgado 46de3c
# Virtual domains are also included but commented by
Alain Reguera Delgado 46de3c
# default.
Alain Reguera Delgado 46de3c
cat <<APACHECONF > /etc/httpd/conf.d/${WIKIINSTANCE}.conf
Alain Reguera Delgado 46de3c
# Apache web server configuration for MoinMoin wiki.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# Created by moinmoin-postinstall-wikifarm.sh.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
<VirtualHost *:80>
Alain Reguera Delgado 46de3c
   ServerName ${WIKISITENAME}.${MYDOMAIN}/
Alain Reguera Delgado 46de3c
   ServerAdmin webmaster@${MYDOMAIN}
Alain Reguera Delgado 46de3c
   ErrorLog logs/wiki-${WIKISITENAME}.error_log
Alain Reguera Delgado 46de3c
   CustomLog logs/wiki-${WIKISITENAME}.access_log common   
Alain Reguera Delgado 46de3c
   Alias /${WIKIURLPREFIX} "${WIKILOCATION}${WIKIINSTANCE}/htdocs/"
Alain Reguera Delgado 46de3c
   Alias /favicon.ico "${WIKILOCATION}${WIKIINSTANCE}/favicon.ico"
Alain Reguera Delgado 46de3c
   ScriptAlias / "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi/"
Alain Reguera Delgado 46de3c
</VirtualHost>
Alain Reguera Delgado 46de3c
APACHECONF
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# MoinMoin Configuration - farmconfig.py
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# Here is a copy and paste from original farmconfig.py file
Alain Reguera Delgado 46de3c
# in the moin-1.5.7-1.el5.rf package. Some additions were
Alain Reguera Delgado 46de3c
# included in the secutiry section to make it configurablen
Alain Reguera Delgado 46de3c
# between 1) an everyone editable wiki 2) a just Superuser,
Alain Reguera Delgado 46de3c
# EditGroup, and AdminGroup editable wiki.
Alain Reguera Delgado 46de3c
cat <<WIKICONFIG > ${WIKIINSTANCE}/cgi-bin/farmconfig.py 
Alain Reguera Delgado 46de3c
# -*- coding: iso-8859-1 -*-
Alain Reguera Delgado 46de3c
# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a
Alain Reguera Delgado 46de3c
# western country and you don't know that you use utf-8, you probably want to
Alain Reguera Delgado 46de3c
# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode
Alain Reguera Delgado 46de3c
# encoding) you MUST use: coding: utf-8
Alain Reguera Delgado 46de3c
# That setting must match the encoding your editor uses when you modify the
Alain Reguera Delgado 46de3c
# settings below. If it does not, special non-ASCII chars will be wrong.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
"""
Alain Reguera Delgado 46de3c
    MoinMoin - Configuration for a wiki farm
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    If you run a single wiki only, you can keep the "wikis" list "as is"
Alain Reguera Delgado 46de3c
    (it has a single rule mapping all requests to mywiki.py).
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    Note that there are more config options than you'll find in
Alain Reguera Delgado 46de3c
    the version of this file that is installed by default; see
Alain Reguera Delgado 46de3c
    the module MoinMoin.multiconfig for a full list of names and their
Alain Reguera Delgado 46de3c
    default values.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    Also, the URL http://moinmoin.wikiwikiweb.de/HelpOnConfiguration has
Alain Reguera Delgado 46de3c
    a list of config options.
Alain Reguera Delgado 46de3c
"""
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Wikis in your farm --------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# If you run multiple wikis, you need this list of pairs (wikiname, url
Alain Reguera Delgado 46de3c
# regular expression). moin processes that list and tries to match the
Alain Reguera Delgado 46de3c
# regular expression against the URL of this request - until it matches.
Alain Reguera Delgado 46de3c
# Then it loads the <wikiname>.py config for handling that request.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Important:
Alain Reguera Delgado 46de3c
#  * the left part is the wikiname enclosed in double quotes
Alain Reguera Delgado 46de3c
#  * the left part must be a valid python module name, so better use only
Alain Reguera Delgado 46de3c
#    lower letters "a-z" and "_". Do not use blanks or "-" there!!!
Alain Reguera Delgado 46de3c
#  * the right part is the url re, use r"..." for it
Alain Reguera Delgado 46de3c
#  * the right part does NOT include "http://" nor "https://" at the beginning
Alain Reguera Delgado 46de3c
#  * in the right part ".*" means "everything". Just "*" does not work like
Alain Reguera Delgado 46de3c
#    for filenames on the shell / commandline, you must use ".*" as it is a RE.
Alain Reguera Delgado 46de3c
#  * in the right part, "^" means "beginning" and "$" means "end"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
wikis = [
Alain Reguera Delgado 46de3c
    # Standalone server needs the port e.g. localhost:8000
Alain Reguera Delgado 46de3c
    # Twisted server can now use the port, too.
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    # wikiname,     url regular expression (no protocol)
Alain Reguera Delgado 46de3c
    # ---------------------------------------------------------------
Alain Reguera Delgado 46de3c
    #("mywiki",  r".*"),   # this is ok for a single wiki
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # for multiple wikis, do something like this:
Alain Reguera Delgado 46de3c
    #("moinmoin",    r"^moinmoin.wikiwikiweb.de/.*$"),
Alain Reguera Delgado 46de3c
    #("moinmaster",  r"^moinmaster.wikiwikiweb.de/.*$"),
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    ("${WIKISITENAME}",		r"^${WIKISITENAME}.${MYDOMAIN}/.*$"),
Alain Reguera Delgado 46de3c
]
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Common configuration for all wikis ----------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Everything that should be configured the same way should go here,
Alain Reguera Delgado 46de3c
# anything else that should be different should go to the single wiki's
Alain Reguera Delgado 46de3c
# config.
Alain Reguera Delgado 46de3c
# In that single wiki's config, we will use the class FarmConfig we define
Alain Reguera Delgado 46de3c
# below as the base config settings and only override what's different.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# In exactly the same way, we first include MoinMoin's Config Defaults here -
Alain Reguera Delgado 46de3c
# this is to get everything to sane defaults, so we need to change only what
Alain Reguera Delgado 46de3c
# we like to have different:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
from MoinMoin.multiconfig import DefaultConfig
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Now we subclass this DefaultConfig. This means that we inherit every setting
Alain Reguera Delgado 46de3c
# from the DefaultConfig, except those we explicitely define different.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
class FarmConfig(DefaultConfig):
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Critical setup  ---------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Misconfiguration here will render your wiki unusable. Check that
Alain Reguera Delgado 46de3c
    # all directories are accessible by the web server or moin server.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # If you encounter problems, try to set data_dir and data_underlay_dir
Alain Reguera Delgado 46de3c
    # to absolute paths.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Where your mutable wiki pages are. You want to make regular
Alain Reguera Delgado 46de3c
    # backups of this directory.
Alain Reguera Delgado 46de3c
    #data_dir = '${WIKILOCATION}${WIKIINSTANCE}/data/'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Where read-only system and help page are. You might want to share
Alain Reguera Delgado 46de3c
    # this directory between several wikis. When you update MoinMoin,
Alain Reguera Delgado 46de3c
    # you can safely replace the underlay directory with a new one. This
Alain Reguera Delgado 46de3c
    # directory is part of MoinMoin distribution, you don't have to
Alain Reguera Delgado 46de3c
    # backup it.
Alain Reguera Delgado 46de3c
    data_underlay_dir = '${WIKILOCATION}${WIKIINSTANCE}/underlay/'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Location of your STATIC files (css/png/js/...) - you must NOT use the
Alain Reguera Delgado 46de3c
    # same for invoking moin.cgi (or, in general, the moin code).
Alain Reguera Delgado 46de3c
    # url_prefix must be '/wiki' for Twisted and standalone servers.
Alain Reguera Delgado 46de3c
    # For CGI, it should match your Apache Alias setting.
Alain Reguera Delgado 46de3c
    url_prefix = '/${WIKIURLPREFIX}'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Security ----------------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # This is checked by some rather critical and potentially harmful actions,
Alain Reguera Delgado 46de3c
    # like despam or PackageInstaller action:
Alain Reguera Delgado 46de3c
    #superuser = [u"${WIKISUPERUSER}", ]
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # IMPORTANT: grant yourself admin rights! replace YourName with
Alain Reguera Delgado 46de3c
    # your user name. See HelpOnAccessControlLists for more help.
Alain Reguera Delgado 46de3c
    # All acl_rights_xxx options must use unicode [Unicode]
Alain Reguera Delgado 46de3c
    #acl_rights_default = u"All:read"
Alain Reguera Delgado 46de3c
    #acl_rights_before  = u"${WIKISUPERUSER}:read,write,delete,revert,admin" \\
Alain Reguera Delgado 46de3c
    #			 u"AdminGroup:read,write,delete,revert,admin" \\
Alain Reguera Delgado 46de3c
    #			 u"EditGroup:read,write,delete,revert"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Link spam protection for public wikis (uncomment to enable).
Alain Reguera Delgado 46de3c
    # Needs a reliable internet connection.
Alain Reguera Delgado 46de3c
    #from MoinMoin.util.antispam import SecurityPolicy
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Mail --------------------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Configure to enable subscribing to pages (disabled by default)
Alain Reguera Delgado 46de3c
    # or sending forgotten passwords.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # SMTP server, e.g. "mail.provider.com" (None to disable mail)
Alain Reguera Delgado 46de3c
    #mail_smarthost = "${WIKIMAILSMARTHOST}"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # The return address, e.g u"Jürgen Wiki <noreply@mywiki.org>" [Unicode]
Alain Reguera Delgado 46de3c
    #mail_from = u"${WIKIMAILFROM}"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # "user pwd" if you need to use SMTP AUTH
Alain Reguera Delgado 46de3c
    #mail_login = "${WIKIMAILLOGIN}"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # User interface ----------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Add your wikis important pages at the end. It is not recommended to
Alain Reguera Delgado 46de3c
    # remove the default links.  Leave room for user links - don't use
Alain Reguera Delgado 46de3c
    # more than 6 short items.
Alain Reguera Delgado 46de3c
    # You MUST use Unicode strings here, but you need not use localized
Alain Reguera Delgado 46de3c
    # page names for system and help pages, those will be used automatically
Alain Reguera Delgado 46de3c
    # according to the user selected language. [Unicode]
Alain Reguera Delgado 46de3c
    navi_bar = [
Alain Reguera Delgado 46de3c
        # If you want to show your page_front_page here:
Alain Reguera Delgado 46de3c
        #u'%(page_front_page)s',
Alain Reguera Delgado 46de3c
        u'RecentChanges',
Alain Reguera Delgado 46de3c
        u'FindPage',
Alain Reguera Delgado 46de3c
        u'HelpContents',
Alain Reguera Delgado 46de3c
    ]
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # You must use Unicode strings here [Unicode]
Alain Reguera Delgado 46de3c
    page_category_regex = u'^Category[A-Z]'
Alain Reguera Delgado 46de3c
    page_dict_regex = u'[a-z]Dict$'
Alain Reguera Delgado 46de3c
    page_group_regex = u'[a-z]Group$'
Alain Reguera Delgado 46de3c
    page_template_regex = u'[a-z]Template$'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Content options ---------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Show users hostnames in RecentChanges
Alain Reguera Delgado 46de3c
    show_hosts = 1
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Show the interwiki name (and link it to page_front_page) in the Theme,
Alain Reguera Delgado 46de3c
    # nice for farm setups or when your logo does not show the wiki's name.
Alain Reguera Delgado 46de3c
    show_interwiki = 1
Alain Reguera Delgado 46de3c
    #logo_string = u''
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Enable graphical charts, requires gdchart.
Alain Reguera Delgado 46de3c
    #chart_options = {'width': 600, 'height': 300}
Alain Reguera Delgado 46de3c
WIKICONFIG
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Copy First Wiki Configuration file.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
cat <<WIKICONFIG > ${WIKIINSTANCE}/cgi-bin/${WIKISITENAME}.py
Alain Reguera Delgado 46de3c
# -*- coding: iso-8859-1 -*-
Alain Reguera Delgado 46de3c
# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a
Alain Reguera Delgado 46de3c
# western country and you don't know that you use utf-8, you probably want to
Alain Reguera Delgado 46de3c
# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode
Alain Reguera Delgado 46de3c
# encoding) you MUST use: coding: utf-8
Alain Reguera Delgado 46de3c
# That setting must match the encoding your editor uses when you modify the
Alain Reguera Delgado 46de3c
# settings below. If it does not, special non-ASCII chars will be wrong.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
"""
Alain Reguera Delgado 46de3c
This is a sample config for a wiki that is part of a wiki farm and uses
Alain Reguera Delgado 46de3c
farmconfig for common stuff. Here we define what has to be different from
Alain Reguera Delgado 46de3c
the farm's common settings.
Alain Reguera Delgado 46de3c
"""
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# we import the FarmConfig class for common defaults of our wikis:
Alain Reguera Delgado 46de3c
from farmconfig import FarmConfig
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# now we subclass that config (inherit from it) and change what's different:
Alain Reguera Delgado 46de3c
class Config(FarmConfig):
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # basic options (you normally need to change these)
Alain Reguera Delgado 46de3c
    sitename = u'${WIKISITENAME}' # [Unicode]
Alain Reguera Delgado 46de3c
    interwikiname = '${WIKISITENAME}'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # name of entry page / front page [Unicode], choose one of those:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # a) if most wiki content is in a single language
Alain Reguera Delgado 46de3c
    #page_front_page = u"MyStartingPage"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # b) if wiki content is maintained in many languages
Alain Reguera Delgado 46de3c
    page_front_page = u"${WIKIFRONTPAGE}"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    logo_string = u'MoinMoin Logo'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # The default theme anonymous or new users get
Alain Reguera Delgado 46de3c
    theme_default = 'modern'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    # Language options --------------------------------------------------
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    # See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in 
Alain Reguera Delgado 46de3c
    # YOUR language that other people contributed.
Alain Reguera Delgado 46de3c
    
Alain Reguera Delgado 46de3c
    # The main wiki language, set the direction of the wiki pages
Alain Reguera Delgado 46de3c
    language_default = '${WIKILANGUAGE}'
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    data_dir = '${WIKILOCATION}${WIKIINSTANCE}/${WIKISITENAME}.${MYDOMAIN}/'
Alain Reguera Delgado 46de3c
WIKICONFIG
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Uncomment some options in the farmconfig.py file if ...
Alain Reguera Delgado 46de3c
if [ "$WIKISUPERUSER" != "" ]; then
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	sed -i -e '
Alain Reguera Delgado 46de3c
		/#superuser/s/#//
Alain Reguera Delgado 46de3c
		s/YourName/'$WIKISUPERUSER'/' ${WIKIINSTANCE}/cgi-bin/farmconfig.py
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
fi
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
if [ "$WIKIRESTRICTEDIT" = "yes" ]; then
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	sed -i -r -e '
Alain Reguera Delgado 46de3c
		/#acl_rights_before/s/#//
Alain Reguera Delgado 46de3c
		/#acl_rights_default/s/#//
Alain Reguera Delgado 46de3c
		/#[\t ]*u"EditGroup/s/#//
Alain Reguera Delgado 46de3c
		/#[\t ]*u"AdminGroup/s/#//' ${WIKIINSTANCE}/cgi-bin/farmconfig.py
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
fi
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
if [ "$WIKIMAILSMARTHOST" != "" ]; then
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	sed -i -e '
Alain Reguera Delgado 46de3c
		/#mail_smarthost/s/#//' ${WIKIINSTANCE}/cgi-bin/farmconfig.py
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
fi
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
if [ "$WIKIMAILFROM" != "" ];then
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	sed -i -e '
Alain Reguera Delgado 46de3c
		/#mail_from/s/#//' ${WIKIINSTANCE}/cgi-bin/farmconfig.py
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
fi
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
if [ "$WIKIMAILLOGIN" != "" ];then
Alain Reguera Delgado 46de3c
 
Alain Reguera Delgado 46de3c
	sed -i -e '
Alain Reguera Delgado 46de3c
		/#mail_login/s/#//' ${WIKIINSTANCE}/cgi-bin/farmconfig.py
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
fi
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# File Permissions
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
# Here we set the file permissons to the created and copied
Alain Reguera Delgado 46de3c
# files.
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
chown -R $USER.$GROUP $WIKIINSTANCE
Alain Reguera Delgado 46de3c
chmod -R ug=rwx $WIKIINSTANCE
Alain Reguera Delgado 46de3c
chmod -R o-rwx $WIKIINSTANCE
Alain Reguera Delgado 46de3c
cd $WIKIINSTANCE
Alain Reguera Delgado 46de3c
chown -R $USER.$GOUP cgi-bin 
Alain Reguera Delgado 46de3c
chmod -R ug=rx cgi-bin
Alain Reguera Delgado 46de3c
chmod -R o-rwx cgi-bin
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
# Last Message
Alain Reguera Delgado 46de3c
#
Alain Reguera Delgado 46de3c
less <
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
------------------------------------------------------------
Alain Reguera Delgado 46de3c
	     *** WIKIFARM INSTANCE CREATED *** 
Alain Reguera Delgado 46de3c
------------------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
   To finish the installation do the following:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	1. Restart the Web Server (service httpd restart)
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	2. Open your browser and try the address:
Alain Reguera Delgado 46de3c
	http://${WIKISITENAME}.${MYDOMAIN}/"
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
------------------------------------------------------------
Alain Reguera Delgado 46de3c
	      *** HOWTO CREATE NEW WIKIS  *** 
Alain Reguera Delgado 46de3c
------------------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  To create new wikis into the farm check the following
Alain Reguera Delgado 46de3c
  steps:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
  	1. Update your farmconfig.py file adding the new
Alain Reguera Delgado 46de3c
	wiki definition. Ex.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	("mywiki2",    r"^mywiki2.${MYDOMAIN}/.*$"),
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	2. Create a directory to store your new wiki data.
Alain Reguera Delgado 46de3c
	Ex.
Alain Reguera Delgado 46de3c
	
Alain Reguera Delgado 46de3c
	mkdir ${WIKILOCATION}${WIKIINSTANCE}/mywiki2.${MYDOMAIN}/
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	3. Copy the content of data directory into the
Alain Reguera Delgado 46de3c
	recently created directory. Ex.: 
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	cp -rv ${WIKILOCATION}${WIKIINSTANCE}/data/* \\
Alain Reguera Delgado 46de3c
	${WIKILOCATION}${WIKIINSTANCE}/mywiki2.${MYDOMAIN}/
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	4. Create a copy of your cgi-bin/mywiki.py into
Alain Reguera Delgado 46de3c
	cgi-bin/mywiki2.py. Then modify mywiki2 with the new
Alain Reguera Delgado 46de3c
	and specific configuration, related to the second
Alain Reguera Delgado 46de3c
	wiki. Ex.:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	sitename = u'mywiki2' # [Unicode]
Alain Reguera Delgado 46de3c
	interwikiname = 'mywiki2'
Alain Reguera Delgado 46de3c
	data_dir = '/var/www/wikifarm/mywiki2.${MYDOMAIN}/'
Alain Reguera Delgado 46de3c
		
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
------------------------------------------------------------
Alain Reguera Delgado 46de3c
		   *** GET TROUBLES ? ***
Alain Reguera Delgado 46de3c
------------------------------------------------------------
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
   If you get some error when try to reach your wiki through
Alain Reguera Delgado 46de3c
   the web browser, check the following:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	1. Add in your DNS or HOSTS file a record to your
Alain Reguera Delgado 46de3c
	wiki address. For example, if your domain is
Alain Reguera Delgado 46de3c
	${MYDOMAIN} and your wiki is in a host with the ip
Alain Reguera Delgado 46de3c
	192.168.0.1, and you want a wiki address like
Alain Reguera Delgado 46de3c
	http://${WIKISITENAME}.${MYDOMAIN}/ it is possible
Alain Reguera Delgado 46de3c
	that you should add a related CNAME record into your
Alain Reguera Delgado 46de3c
	DNS to your new wiki address, something like the
Alain Reguera Delgado 46de3c
	following:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
   	${WIKISITENAME}.${MYDOMAIN}.	IN CNAME	${MYDOMAINl}.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	Remeber to do a 'service named restart' after
Alain Reguera Delgado 46de3c
	changes.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	2. Check Virtual Domain configuration in your Apache
Alain Reguera Delgado 46de3c
	server. It is possible that it is disabled so enable
Alain Reguera Delgado 46de3c
	it by uncomenting a line like the following:
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	NameVirtualHost *:80
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	3. It is possible that you want something in
Alain Reguera Delgado 46de3c
	http://${MYDOMAIN}/ other than the error that
Alain Reguera Delgado 46de3c
	sometimes appears there after you get your wiki
Alain Reguera Delgado 46de3c
	working into virtual domains. So you should create a
Alain Reguera Delgado 46de3c
	virtual domain for that address too and change the
Alain Reguera Delgado 46de3c
	DocumentoRoot param to wherever you want to load at
Alain Reguera Delgado 46de3c
	that moment.
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
	If you are still in troubles, you can write to:
Alain Reguera Delgado 46de3c
	<alain.reguera@gmail.com>. 
Alain Reguera Delgado 46de3c
	
Alain Reguera Delgado 46de3c
	Other way ...
Alain Reguera Delgado 46de3c
	
Alain Reguera Delgado 46de3c
   Enjoy your installed wikifarm :).
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
LASTMESSAGE