Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

multisites possible?


Go to End


107 Posts   35702 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 January 2009 at 3:43am

Yup. You just need to put the sapphire. jsparty, and cms folders in some central location (preferably above the web root) and then just symlink to them in your silverstripe root.

I have a shell script i run to set up a new instance. Takes about 28 seconds. So there, Drupal. ;-)

Avatar
astate

Community Member, 35 Posts

21 January 2009 at 6:19am

Hello UncleCheese,

Can i have you shell script you run to setup a new instance ?

Thanks :)

Avatar
JamesS

Community Member, 5 Posts

13 May 2009 at 12:08am

Hi Uncle Cheese

I too have been working with SS multisites and have written a shell script to install. Works great, however have problems with GD and creating the _resampled directory due to the relative path in the gd.php class no liking being outside the document root. I think I saw you post somewhere else about changing the path. What changes have you had to make to get multisites working seamlessly in addition to the symlinks and followsymlinks/open_basedir settings? Would really appreciate any help.

Cheers
James

Avatar
ollie

Community Member, 4 Posts

4 June 2009 at 2:54pm

UncleCheese

Is it possible to do what you say on a reseller hosting plan (shared server) using cpanel?

Avatar
bummzack

Community Member, 904 Posts

4 June 2009 at 6:19pm

Hi ollie

I don't think that's possible. You'll run into trouble creating these symbolic links from your Control Panel. Some hosting providers allow ssh access though. If you got ssh access, it is most certainly doable.

Avatar
TWoSH

Community Member, 13 Posts

16 June 2009 at 7:34pm

Hi guys!

I've been studying SS now for some time trying to get a grip on the multi-sites "issue". There are a lot of posts lying around asking the same question over and over again; what exactly needs modification in order to use symlinks for multiple sites?

Having read through quite a few of these without finding any specifics me and my coders have of course started digging in the code ourselves and here is what we've found out so far:

In our test installations (using silverstripe version 2.3.1 on a linux server) we created symlinks for cms, jsparty and sapphire. We did not create a silverstripe-cache folder prior to installation. (Should we? Grateful for a clear answer on this one...) In our .htaccess files we have FollowSymLinks activated.

Following UncleCheeses hints we started on File.php, Folder.php and GD.php.

In the file sapphire/filesystem/GD.php you need to change:

In function makeDir($dirname) the variable $dirname contains a relative path to the assets folder. By replacing .. in the variable with the return value of Director::BaseFolder() you get the correct path.

In function writeTo($filename) the variable $filename contains a relative path to the assets folder. By replacing .. in the variable with the return value of Director::BaseFolder() you get the correct path. (I.e. same as in makeDir)

These two changes seems to allow SS to create the _resampled folder and save resized images correctly under it. (Please comment on these changes UncleCheese, if you have the time...)

Prior to the changes the system tried to create the folder and save the files under the linked "master" installation. However it is not perfect... For instance the small thumbnails that shows (should show) when you insert a image in the TinyMCE editor does not show because they are still saved in the master installations asset/xyz/ folder. We have not yet had enough time to figure out what to change to get this working. Help would be appriciated (UncleCheese?). GD.php should be fine, nothing more to do there, but File and Folder are still unmodified.

UncleCheese says that it works great and you have a script that sets up a new sites in seconds. What I can't figure out is if this works good, why is it not implemented/changed/fixed in the core? Are there any caveeats to this that would hinder a normal installation for instance? Does it break anything else? Could you, UncleCheese, please post exact details on what needs to be changed in the files and your experience?

I will post any details that we find out, but the going is slow, since this is our first endevour into SS code. (Haven't even done a site with it yet). But this is a very important issue for us since we are evaluating a move from our own CMS to SS. Being used to apply for instance security fixes and upgrades on one master installation for all our customers this is a big thing for us.

Tim

Avatar
quamsta

Community Member, 29 Posts

17 June 2009 at 2:27am

Wow! Thanks for the awesome reply. I've had this question regarding symlinks for a while too. Can we get this fixed in the next release?

Avatar
JamesS

Community Member, 5 Posts

17 June 2009 at 9:14am

I haven't had a chance to try it out yet, but this is what Uncle Cheese told me:

-----------------------------------------------------

The basic premise is this:

ln -s /var/ss/2.3.1/sapphire
ln -s /var/ss/2.3.1/jsparty
ln -s /var/ss/2.3.1/cms
ln -s /var/ss/lib
cp -R /var/ss/web_skel/* .

"web_skel" is a directory containing my mysite structure, along with assets, and .htaccess (which includes an important FollowSymLinks flag). I have some page and dataobject classes I reuse on all of my sites as well as a DataObjectDecorator for Page, which includes some handy global functions like <% if MyIP %> for ip restricting template changes, and a few others.

"lib" is a repository of all kinds of third party stuff I reuse. The latest jQuery is in there, shadobox, sifr, etc. It's a lot easier than installing it on a case-by-case basis. I even have some packaged up, so I can just put $JQuery or $Shadowbox on my template and it includes all of its dependencies.

The mods to Image.php I believe can be as simple as finding ../ and replacing it with Director::baseFolder()."/" You have to do the same to:

/cms/code/AssetAdmin.php
/sapphire/core/model/ErrorPage.php

-----------------------------------------------------