Easy Web based install

It is not easy to install Moin on a typical web hosting service and this is a problem for Moin wide trial and adoption. We should provide a web based form that runs on those hosts, that installs Moin and creates the first wiki instance.

Even if it is not what the same type of Wikiengine, MediaWiki was running in 2 minutes in a very standard host with a typical web based panel. In contrast, a Moin installation needs more skill and access (basically shell access) that most of our possible users have.

In this context a typical web host service means that it:

We should provide an easier installation script that runs on these web hosting services. Installing Moin should be something like:

  1. Download the compressed file.
  2. Decompress it locally.
  3. Upload to the public html directory.
  4. Point the browser to http://mydomain.tld/moinmoin/install.cgi

  5. Follow the instructions.

The script functions, or steps, could be:

  1. Check if a python with the required version is present2.

  2. Ask for the basic information3:

    • Apache user/group.
    • Wiki name.
    • A logo to upload (optional).
    • First user name, mail and password.
    • Select language (so it installs the right lang in /underlay)
    • Ask if there are more wikis planned in the near future (in order to make an initial farm configuration).
    • Optional smtp and return address for mail support.
  3. Create the first wiki instance.
  4. Create a basic wikiconfig.py and set:
    • sitename and logo_string.

    • acl_rights_before for that first user.

    • page_front_page to wiki_name_wiki or similar.

    • default_lang the specified one.

    • mail_smarthost if it was specified and mail_from.

  5. Send him/her to the home page with pointers for more info in the Moin site.
  6. Delete the install directory or points the user to do so.

What follows is a rough user interface prototype:

EasyWebBasedInstall.png

Comments

If someone wants to start on this, please split this into multiple parts:

  1. a install cgi script doing the necessary install steps and uses a manually edited/uploaded config file
  2. migration/upgrade cgi
  3. backup / restore cgi
  4. (later and optional) a form based config cgi script

The config cgi is optional and can be done later. Everything it could do can be done easily (and far more flexible) with a local text editor and the resulting config ftped / POSTed to the server.

I think that if this is run as a cgi you would not need to know the apache user/group. Not absolutely sure though. I really like the mock-up! -- TimCera 2006-04-18 21:37:20


A plan page from an SoC applicant: PeterBurns/EasyWebBasedInstall

Project size estimation


On a debian system after that you do: apt-get install python-2.3-moinmoin you can execute this script:

   1 import os
   2 import sys
   3 import shutil
   4 import re
   5 import getopt
   6 import pwd #only on linux
   7 def CommandSubstitute(fileToOpen, pattern, with, number):
   8     """Substitute a pattern in a file
   9     Returs a list of string containing all the Text file, one line for each element."""
  10     f = open(fileToOpen, "r+")
  11     output = []
  12     for line in f.readlines():
  13         if number:
  14             if re.search(pattern, line) is not None:
  15                 line = re.sub(pattern, with, line)
  16                 if number is True:
  17                     pass
  18                 else:
  19                     number -= 1
  20         output.append(line)
  21     f.close()
  22     return output
  23 def WriteToFile(fileToOpen, output):
  24     """Write a list of lines in a file
  25     """
  26     f = open(fileToOpen, "w")
  27     for line_out in output:
  28         f.write(line_out)
  29     f.close()
  30 #Get informations
  31 path = raw_input("Enter the PATH in which you would set up a wiki instance: ")
  32 instance = raw_input("Enter the name of your instance: ")
  33 username = raw_input("Enter the name of the user that will own the wiki: ")
  34 #Check and create directories
  35 if not os.path.isdir(path):
  36     os.mkdir(path)
  37 if instance is not '':
  38     root = path + '/' + instance
  39     os.mkdir(root)
  40 else:
  41     root = path
  42 #Copy all the moin structure into the istance (for debian systems only)
  43 shutil.copytree('/usr/share/moin/data', root+'/data', True)
  44 shutil.copytree('/usr/share/moin/underlay', root+'/underlay', True)
  45 shutil.copy('/usr/share/doc/python2.3-moinmoin/examples/server/moinmodpy.py', root)
  46 shutil.copy('/usr/share/moin/config/wikiconfig.py', root)
  47 #set the correct permissions and owners
  48 server = pwd.getpwnam('www-data')
  49 user = pwd.getpwnam(username)
  50 for place, dirs, files in os.walk(root):
  51     for dire in dirs:
  52         for name in files:
  53             os.chmod(os.path.join(place, name), 0774)
  54             os.chown(os.path.join(place, name), user[2], server[3])
  55         os.chmod(place, 0774)
  56         os.chown(place, user[2], server[3])
  57 newFile = CommandSubstitute(os.path.join(root, 'wikiconfig.py'), './data/', os.path.join(root, 'data'), True)
  58 WriteToFile(os.path.join(root, 'wikiconfig.py'), newFile)
  59 newFile = CommandSubstitute(os.path.join(root, 'wikiconfig.py'), './underlay/', os.path.join(root, 'underlay'), True)
  60 WriteToFile(os.path.join(root, 'wikiconfig.py'), newFile)
  61 newFile = CommandSubstitute(os.path.join(root, 'moinmodpy.py'), '/path/to/wikiconfig', '.', True)
  62 WriteToFile(os.path.join(root, 'moinmodpy.py'), newFile)
  63 #installation finished
  64 print ''
  65 print ''
  66 print ''
  67 print '----------'
  68 print "Congratulations, you have installed MoinMoin. There is just one little thing to do: make your web server able to use MoinMoin. If you use apache2 and you use VirtualHosts you can add a new VirtualHost with this configuration:"

Then you must configure your apache web server to work with mod_python as described upper and you can start creating new pages.


  1. http://www.cpanel.net/ is a web based control panel for frequent admin functions like managing mail and ftp accounts, databases, spam filters, apache configuration, a file manager, etc. (1)

  2. If not, send to a special page in MoinMaster. (2)

  3. Each input has to have a link to more explanation for the non-expert user, maybe in MoinMaster too. (3)

MoinMoin: FeatureRequests/EasyWebBasedInstallOnHostingWithoutShellAccess (last edited 2007-10-29 19:09:35 by localhost)