FarmSetupByExample-Talk

Summary: Talk page for Farm Setup By Example.
Maintainer: Hagan Fox
Users: +2 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

  • 15-Jun-2008 DaveG: Excellent tutorial. Since the context of the article is 'security' then you might want to add a section describing the permissions on the main directories and files.
  • tamouse February 09, 2013, at 12:20 PM : I liked this write-up as well. Very informative. I've been implementing wiki farms for a while, and went off in another direction as driven by WikiFarmAlternative, then came back to doing it "standard" way. Still wanting to make the contents innaccessible to direct download (planning on implementing these under either lighttpd or nginx, which don't do .htaccess files) by putting them outside the field's DocumentRoot, I experimented a bit and came up with the following configuration:
    • Farm is installed at /var/farm/pmwiki-latest/var/farm/pmwiki-2.2.45
    • Field is installed at ~/public_html/testfield
      • contains:
testfield/
|-- index.php
`-- local/
    `-- config.php
`-- pub/
  • testfield/index.php:
<?php include_once("/var/www/newfarm/pmwiki-latest/pmwiki.php");
  • testfield/local/config.php:
<?php if (!defined('PmWiki')) exit();
// testfield config.php -- testing if everything for wiki can be set outside DocumentRoot
define('tw_root','/home/tamara/testfield.data');

$WikiDir = new PageStore(tw_root.'/{$FullName}');
$WorkDir = tw_root."/workdir/";
$WikiLibDir = array(&$WikiDir,
		    new PageStore(tw_root.'/wikilib2.d/{$FullName}'),
		    new PageStore('$FarmD/wikilib.d/{$FullName}'));
include_once(tw_root.'/local/config.php');
  • Set up the out-of-root data area in ~/data/testfield.data:
testfield.data/
|-- wiki.d/
|-- wikilib.d/
|-- workdir/
`-- local/
    `-- config.php
  • testfield.data/local/config.php:
<?php if(!defined('PmWiki')) exit();

//--  $WikiTitle is the name that appears in the browser's title bar.
$WikiTitle = 'Testfield';
$WikiTag   = "See if I can put a wiki's data outside the document root";

include_once("$FarmD/scripts/xlpage-utf-8.php");

// ... the rest of the standard field config stuff goes here
  • For reference, /var/www/newfarm/pmwiki-latest/local/farmconfig.php contains:
<?php
if(!defined('PmWiki')) exit("Must be run inside PmWiki");

$FarmPubDirUrl = '/pub/'; // symlinked from /var/www/newfarm/pmwiki-latest/pub to /var/www/htdocs/pub

Skins

12-April-2023, 12:46 AM Kat?: Guidance here is fantastic, though I'm admittedly getting a bit tripped up on setting up wikifarm-wide skins. Is there a specific syntax that needs to be called in the farmconfig once the skin is installed in the main wiki pub/skins directory? My cookbook, scripts, and everything else is working perfectly, but the skins are the main trip-up. Trying to just set up the Vector skin as the default for all my wikis and just using css variables to change colors and such given there's little sense in maintaining 4+ different versions of the same skin for all my little fields!

If the farm fields are all on the same domain name (not on different domains, or on subdomains), you can set the variable $FarmPubDirUrl in farmconfig.php to the URL of the farm's pmwiki/pub directory. If you have separate websites, this may or may not work, or you can create a symbolic link say field/common to pmwiki/pub, and set $FarmPubDirUrl in the field's config.php to the field/common URL. If you cannot create a symbolic link in the different websites, the easiest solution is to make a pub/skins folder in the fields and copy there the skin you want to use. --Petko

12-April-2023, 6:03 AM Kat?: Ah, yeah, they are all on the same domain name! I'm pretty sure I have my $FarmPubDirUrl set up appropriately seeing my cookbook files and such are working. More what I meant is do I need to call the skin in the farm farmconfig like you would a recipe such as with

include_once("$FarmD/pub/skins/vector/vector.php") or include_once("$FarmD/pub/skins/vector/vector.templ") or include_once("$FarmD/skins/vector/vector.templ") ?

I've tried a couple different variations of above and have been unable to get it working, so I wasn't sure if I was doing something wrong there or was missing a step. Thanks for the guidance!

Oh you don't include the skin or the template, you simply set $Skin = "vector"; in farmconfig.php. --Petko

12-April-2023, 8:56 AM Kat?: Ahhhh. Seems I was making it more complicated than it needed to be! I got thrown off because the CSS wasn't working, so it looked like there was just no skin being applied. But experimenting with changing $Skin around more it does seem that the template is switching, so that must mean there is just a css link that's off somewhere and is not working with the farm setup for whatever reason. It works fine if the skin is local, but not if applied through the farmconfig, even if all the css files are in the pub/skins directory on the main wiki.

I'll look into that more after work and see if I can figure out what's up with that! Thank you very much for your help, Petko, otherwise I'd be chasing after something that's way more complicated than it actually is.

So, there is the file pub/css/local.css that should be in the fields and is only applied to the fields or to the base, not to the all wikis in the farm (create the directories pub and pub/css and place the field's CSS files there). Same for pub/css/Group.css or pub/css/Group.Page.css, they need to be in the fields and apply to that field where they are. I don't recommend editing the skin directly, just place your changes in the local.css files which should override the styles defined in the skins. --Petko

12-April-2023, 2:44 PM Kat?: I got it working! For the sake of documenting what happened in case anyone else ever runs into this, I didn't have the http:// in the beginning of my url for my $FarmPubDirUrl. I never thought to change it because all my cookbook recipes and everything were operating fine, but apparently that is needed for the skin CSS to load properly. As a happy bonus, that also fixed the issue I was having with my togglable tables/table of contents not working. Apparently, the scripts for those were also not loading properly as a result of the http:// not being present in the direct path. So go figure! Thanks again for the help, Petko. I was planning on making ample use of the local.css files because I basically want to use them to switch out the colors and things using css variables to control the color/images on my different wikis. I can now start messing around with getting that setup, so yay!

Talk page for the Farm Setup By Example recipe (users).