DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:redirect_farm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tips:redirect_farm [2012-05-02 01:33] – [Step 6: Configure the Animal] turnermmtips:redirect_farm [2017-06-27 23:52] (current) 144.91.58.132
Line 1: Line 1:
 ====== The redirect farm ====== ====== The redirect farm ======
 +
 +A setup that is very similar to the setup that is described on this page is now part of DokuWiki. The [[:farms]] documentation describes how it can be used. This page might still be useful as it describes some things like more advanced techniques how animals can be created that aren't covered in the new documentation yet that are still valid. Once this information has been transferred to the new documentation pages, this page should be deleted.
  
 In a farm, one single copy of wiki engine (the farmer) is used to run several individual wikis (the animals). For a generic introduction, and for different approaches to set up a DokuWiki farm, see [[tips:farm]]. In a farm, one single copy of wiki engine (the farmer) is used to run several individual wikis (the animals). For a generic introduction, and for different approaches to set up a DokuWiki farm, see [[tips:farm]].
Line 219: Line 221:
 </code> </code>
  
-**Test:** Point your browser to ''http://localhost/barn/cow''. You should get a "DokuWiki Setup Error" explaining that "This Wiki doesn't exist!".+**Test:** Point your browser to ''http://localhost/barn/cow/''. You should get a "DokuWiki Setup Error" explaining that "This Wiki doesn't exist!".
  
 === Clear the farmer wiki === === Clear the farmer wiki ===
Line 227: Line 229:
 <code bash> <code bash>
 rm install.php rm install.php
-rm -r data +rm -r data ### too dangerous for the time being 
-rm conf/*.dist+mv data data.bak ### revert if there is a problem with loading the stylesheet vi csss.php
 </code> </code>
 +
 +At present, css.php tests for the existence of data/pages. Hopefully, this will be fixed: <del>http://bugs.dokuwiki.org/index.php?do=details&task_id=2508</del> -> Closed. For the time being, it depends on $conf['basedir'] whether data/pages is searched in the farmer or in the animal directory. If in doubt, better do **not** remove the data directory.
 ==== Step 5: Create an Animal ==== ==== Step 5: Create an Animal ====
  
Line 291: Line 295:
 **Test:** ''http://localhost/barn/cow'' should yield a "DokuWiki Setup Error" because there is no datadir ('pages'). **Test:** ''http://localhost/barn/cow'' should yield a "DokuWiki Setup Error" because there is no datadir ('pages').
  
-If you find you need to set the basedir configuration option, uncomment the basedir setting the the above script, replacing it with the one needed for the current animal. +If you find you need to set the basedir configuration option, uncomment the basedir setting in the the above script, replacing it with the one needed for the current animal.  This can be automated; see the [[#advanced_configuration|Advanced Configuration]] script
 + 
 ==== Step 7: Create Animal Data Directories ==== ==== Step 7: Create Animal Data Directories ====
  
Line 312: Line 316:
 ===== Advanced Configuration ===== ===== Advanced Configuration =====
  
-==== Using a Script to Setup an Animal ====+==== Using a Bash Script to Setup an Animal ====
  
 Here's a little bash script which will perform the above steps in one go inside the directory it's executed in (if you're using this with other scripts you have to make sure you ''cd'' into the designated directory before executing it). Save it as ''addanimal'', make sure it's in your shell ''$PATH'' (i.e. by putting it into ''/usr/local/bin''), and make it executable. It takes the domain/directory of the new animal as argument. Here's a little bash script which will perform the above steps in one go inside the directory it's executed in (if you're using this with other scripts you have to make sure you ''cd'' into the designated directory before executing it). Save it as ''addanimal'', make sure it's in your shell ''$PATH'' (i.e. by putting it into ''/usr/local/bin''), and make it executable. It takes the domain/directory of the new animal as argument.
Line 323: Line 327:
     exit 1     exit 1
 fi fi
 +
 +# set_basedir
 +# Author: Myron Turner
 +set_basedir() {
 +BARN=`pwd | awk -F/ '{ print $(NF)  }'`
 +echo "'/"$BARN"/$1/'"
 +}
  
 ANIMAL=${PWD}/${1} ANIMAL=${PWD}/${1}
Line 350: Line 361:
 echo "<?php echo "<?php
 \$conf['savedir'] = DOKU_CONF.'../data'; \$conf['savedir'] = DOKU_CONF.'../data';
 +# \$conf['basedir'] = `set_basedir $1`;
 \$conf['updatecheck'] = 0;" > ${ANIMAL}/conf/local.protected.php \$conf['updatecheck'] = 0;" > ${ANIMAL}/conf/local.protected.php
  
Line 382: Line 394:
 </code> </code>
  
 +**basedir:** \\
 +You may need to set the ''basedir'' configuration option.  If so, uncomment the following line in the addanimal script:
 +   # \$conf['basedir'] = `set_basedir $1`;
 +This will create a ''basedir'' setting for the animal being added.  Without setting this option, there have been some problems accessing new animals.((See http://forum.dokuwiki.org/thread/8342 which describes one problem.  Another is the corruption of the browser output.))
 +
 +==== Using a Powershell Script to Setup an Animal ====  
 +for those who prefer IIS, here is a small powershell script. You need to customize it to your Environment. Be aware, we use Active Directory and SSO. This script is still an alpha version!
 +Features of this script:
 +  * Create AD Groups for Control ACL over AD Groups
 +  * Set NTFS Permissions on IIS Server
 +  * Enable SSO
 +
 +Tested with IIS 8 and PHP 5.6 and Detritus.
 +<code New-DokuwikiAnimal.ps1>
 +<#
 + .SYNOPSIS
 + Legt Dokuwiki Animals an.
 + .DESCRIPTION
 + Legt Dokuwiki Animals an. Inklusive AD-Gruppen, ACL, Konfig, NTFS Rechte, ....
 + .EXAMPLE  
 +        New-DokuwikiAnimal.ps1 -Animal IT
 + .INPUTS
 + Animal
 + .OUTPUTS
 + Keine.
 + .NOTES
 + Author     : Fabian Niesen
 + Filename   : New-DokuwikiAnimal.ps1
 + Requires   : PowerShell Version 3.0
 +
 + Version    : 0.1
 + History    : 0.1 Los geht es
 +    .LINK
 +
 +#>
 +
 +Param(
 + [Parameter(Mandatory=$false, Position=1, ValueFromPipeline=$False)]
 + [String]$Animal="!notset!"
 +)
 +
 +clear-host 
 +### Parameters ###
 +$wwwroot ="C:\inetpub\wwwroot"
 +$farmpath = $wwwroot+"\wiki"
 +$GroupOU = "OU=Wiki,OU=groups,DC=domain,DC=tld"
 +$wikiadmins = "Wiki-Admins"
 +$GroupPreFix = "Wiki-"
 +$ErrorActionPreference = "Stop"
 +$before = Get-Date
 +$date = get-date -format yyyyMMdd-HHmm
 +
 +### Proof for administrative permissions (UAC) ###
 +If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( [Security.Principal.WindowsBuiltInRole] "Administrator"))
 +{
 +    Write-Warning "Not run as administrator! You failed! ;)"
 +    break    
 +
 +
 +Write-Host "Lade ActiveDirectory Module"
 +try
 +{
 +  Import-Module ActiveDirectory 
 +}
 +catch
 +{
 +Write-Warning "ActiveDirectory Module ist missing. Please install first"
 +break
 +}
 +
 +If ($Animal -eq "!notset!") { 
 +  Write-Host ""
 +  $Animal = $( Read-Host "How should the animal be named?" )
 +  Write-Host ""
 +}
 +
 +$cleananimal = $($Animal -replace " ","").ToLower()
 +$animalpath = $farmpath+"\"+$cleananimal
 +try
 +{
 +new-item -Path $animalpath -ItemType directory| Out-Null
 +}
 +catch
 +{
 +break
 +}
 +
 +$GroupRead = $GroupPreFix+$Animal+"-Lesen"
 +$GroupEditor = $GroupPreFix+$Animal+"-Editor"
 +$GroupManager = $GroupPreFix+$Animal+"-Manager"
 +$GroupAdmins = $GroupPreFix+$Animal+"-Admins"
 +
 +New-ADGroup -Name $GroupRead -SamAccountName $GroupRead -GroupCategory Security -GroupScope Global -DisplayName $GroupRead -Path $GroupOU 
 +New-ADGroup -Name $GroupEditor -SamAccountName $GroupEditor -GroupCategory Security -GroupScope Global -DisplayName $GroupEditor -Path $GroupOU
 +New-ADGroup -Name $GroupManager -SamAccountName $GroupManager -GroupCategory Security -GroupScope Global -DisplayName $GroupManager -Path $GroupOU"
 +New-ADGroup -Name $GroupAdmins -SamAccountName $GroupAdmins -GroupCategory Security -GroupScope Global -DisplayName $GroupAdmins -Path $GroupOU 
 +
 +Add-ADGroupMember $GroupAdmins $wikiadmins
 +Add-ADGroupMember $GroupRead $GroupEditor,$GroupManager,$GroupAdmins
 +
 +
 +$inherit = [system.security.accesscontrol.InheritanceFlags]"ContainerInherit, ObjectInherit"
 +$propagation = [system.security.accesscontrol.PropagationFlags]"InheritOnly"
 +$modify = [System.Security.AccessControl.FileSystemRights]"Read, Write, Modify, ExecuteFile" 
 +$read = [System.Security.AccessControl.FileSystemRights]"ReadAndExecute"
 +
 +$groups = @($GroupRead,$GroupEditor,$GroupManager,$GroupAdmins)
 +foreach ($group in $groups) {
 +
 +  $Acl = (Get-Item $wwwroot).GetAccessControl('Access')
 +  $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,"None","None","Allow")
 +  $Acl.AddAccessRule($Ar)
 +  Set-Acl $wwwroot $Acl
 +
 +  $Acl = (Get-Item $farmpath).GetAccessControl('Access')
 +  $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,"None","None","Allow")
 +  $Acl.AddAccessRule($Ar)
 +  Set-Acl $farmpath $Acl
 +
 +  $Acl = (Get-Item $($wwwroot+"\dokuwiki")).GetAccessControl('Access')
 +  $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,$inherit, $propagation, "Allow")  
 +  $Acl.AddAccessRule($Ar)
 +  Set-Acl $($wwwroot+"\dokuwiki") $Acl  
 + 
 +  ##NTFS Für Animal
 +  $Acl = (Get-Item $animalpath).GetAccessControl('Access')
 +  IF ($group -eq $GroupEditor -OR $group -eq $GroupManager -OR $group -eq $GroupAdmin) {
 +    $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$modify,$inherit, $propagation, "Allow")
 +  } Else {
 +    $Ar = New-Object  system.security.accesscontrol.filesystemaccessrule($group,$read,$inherit, $propagation, "Allow")
 +  }
 +  $Acl.AddAccessRule($Ar)
 +  Set-Acl $animalpath $Acl
 +}
 +
 +new-item -Path $($animalpath+"\data\") -ItemType directory| Out-Null
 +new-item -Path $($animalpath+"\conf\") -ItemType directory| Out-Null
 +$verz = @("attic","cache","index","locks","media","media_attic","media_meta","meta","pages","tmp")
 +foreach ($ver in $verz) {
 +new-item -Path $($animalpath+"\data\"+$ver) -ItemType directory | Out-Null
 +}
 +$conffiles = @("local.php","local.protected.php","acl.auth.php","users.auth.php","plugins.local.php")
 +foreach ($conffile in $conffiles) {
 +new-item -Path $($animalpath+"\conf\"+$conffile) -ItemType File| Out-Null
 +}
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\pages\wiki") -Destination $($animalpath+"\data\pages\") -Recurse
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\pages\playground") -Destination $($animalpath+"\data\pages\") -Recurse
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\meta\wiki") -Destination $($animalpath+"\data\meta\") -Recurse
 +Copy-Item -Path $($wwwroot+"\dokuwiki\data\media\wiki\logo.png") -Destination $($animalpath+"\data\media\")
 +
 +### Writing 
 +$lc = $animalpath+"\conf\local.protected.php"
 +"<?php" | Out-File $lc 
 +"`$conf['title'] = '$Animal Wiki';" | Out-File $lc -Append 
 +"`$conf['lang'] = 'en';" | Out-File $lc -Append 
 +"`$conf['license'] = '0';" | Out-File $lc -Append 
 +"`$conf['useacl'] = 1;" | Out-File $lc -Append 
 +"`$conf['authtype'] = 'authad';" | Out-File $lc -Append 
 +"`$conf['superuser'] = '@$GroupAdmins';" | Out-File $lc -Append 
 +"`$conf['manager'] = '@$GroupManager';" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['account_suffix'] = '@domain.tld';" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['base_dn'] = 'DC=Domain,DC=tld';" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['domain_controllers'] = 'DC1, DC2';" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['sso'] = 1;" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['expirywarn'] = 5;" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['recursive_groups'] = 1;" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['admin_username'] = 'SSO-User';" | Out-File $lc -Append 
 +"`$conf['plugin']['authad']['admin_password'] = 'SSO-PW';" | Out-File $lc -Append 
 +"`$conf['basedir'] = '/$cleananimal/';" | Out-File $lc -Append 
 +"`$conf['useheading'] = 'content';" | Out-File $lc -Append 
 +"`$conf['sneaky_index'] = 1;" | Out-File $lc -Append 
 +"`$conf['disableactions'] = 'register,resendpwd,profile,profile_delete';" | Out-File $lc -Append 
 +"`$conf['remoteuser'] = '@$GroupRead';" | Out-File $lc -Append 
 +"`$conf['target']['interwiki'] = '_blank';" | Out-File $lc -Append 
 +"`$conf['target']['extern'] = '_blank';" | Out-File $lc -Append 
 +"`$conf['target']['windows'] = '_blank';" | Out-File $lc -Append 
 +"`$conf['subscribers'] = 1;" | Out-File $lc -Append 
 +"`$conf['mailfrom'] = 'wiki@domain.tld';" | Out-File $lc -Append 
 +"`$conf['mailprefix'] = '$Animal Wiki: ';" | Out-File $lc -Append 
 +"`$conf['gzip_output'] = 1;" | Out-File $lc -Append 
 +"`$conf['savedir'] = DOKU_CONF.'../data';" | Out-File $lc -Append
 +$file_content = Get-Content "$lc";
 +[System.IO.File]::WriteAllLines("$lc", $file_content);
 +
 +##Set ACL
 +### Writing acl.auth.php
 +$aclc = $animalpath+"\conf\acl.auth.php"
 +$file= "acl.auth.php"
 +"# acl.auth.php" | Out-File $aclc 
 +"# <?php exit()?>" | Out-File $aclc -Append 
 +"# Don't modify the lines above" | Out-File $aclc -Append 
 +"# Access Control Lists" | Out-File $aclc -Append 
 +"* @$($GroupAdmins -replace '-','%2d') 16" | Out-File $aclc -Append 
 +"* @$($GroupManager -replace '-','%2d') 16" | Out-File $aclc -Append 
 +"* @$($GroupEditor -replace '-','%2d') 8" | Out-File $aclc -Append 
 +"* @$($GroupRead -replace '-','%2d') 1" | Out-File $aclc -Append 
 +$file_content = Get-Content "$aclc";
 +[System.IO.File]::WriteAllLines("$aclc", $file_content);
 +
 +## Startseite
 +$startpage = $animalpath+"\data\pages\start.txt"
 +"====== Welcome at $Animal Wiki ======" |Out-File $startpage -Append
 +"==== Usage of DokuWiki ====" |Out-File $startpage -Append
 + * [[wiki:syntax|DokuWiki Syntax]]" |Out-File $startpage -Append
 + * [[playground:playground|Playgound]]" |Out-File $startpage -Append
 +
 +$file_content = Get-Content "$startpage"
 +[System.IO.File]::WriteAllLines("$startpage", $file_content)
 +</code>
 +
 + --- [[user>FNiesen]] //2016/04/19 09:44//
 ==== URL Rewriting ==== ==== URL Rewriting ====
  
Line 388: Line 611:
 ==== Enabling/disabling plugins in animals ==== ==== Enabling/disabling plugins in animals ====
  
-Since Angua the plugins can be enabled and disabled per animal using the plugin manager ([[devel:develonly]]). Activating and deactivating is stored in the ''plugins.local.php'' config file. You can globally (or locally) fix the enabling or disabling of plugins by adding their values to ''plugins.protected.php''.+Since Angua the plugins can be enabled and disabled per animal using the plugin manager. Activating and deactivating is stored in the ''plugins.local.php'' config file. You can globally (or locally) fix the enabling or disabling of plugins by adding their values to ''plugins.protected.php''.
 But before Angua you would need to change the following: But before Angua you would need to change the following:
  
tips/redirect_farm.1335915187.txt.gz · Last modified: 2012-05-02 01:33 by turnermm

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki