Run several sandboxes with one Nette source?

Notice: This thread is very old.
onkelheinz
Member | 3
+
0
-

Is it possible to install several sandboxes that use the same Nette source? For example:
dir/NetteSource
htdocs/my-nette-sandboxes/sandbox1
htdocs/my-nette-sandboxes/sandbox2
htdocs/my-nette-sandboxes/sandbox3

Milo
Nette Core | 1283
+
0
-

What do you mean by NetteSource? The Nette components source? If so, sure. There are more ways to do it. In principle, remove Nette components from sandboxes' composer.json and load Nette libraries as first.

As a NetteSource you can use:

  • prepared standalone package, the Nette directory with loader.php, or minified nette.phar.
  • create NetteSource dir with composer.json which will require all desired components, composer update and use NetteSource/vendor/autoload.php

and so on…

onkelheinz
Member | 3
+
0
-

Thanks for your reply, Milo!

onkelheinz
Member | 3
+
0
-

for nette noobs like me.
how to host several mandants (sandboxes) with one nette setup:

~ git clone https://github.com/nette/nette.git [your-dir]
~ cd [your-dir]
~ composer install
~ mkdir [your-mandants]
~ cd [your-mandants]
~ composer create-project nette/web-project [mandant1]
~ cd [mandant1]
~ rm -r -f vendor
~ cd app
~ nano bootstrap.php

edit the first line, so autoload.php can be found two directories higher:
old: require __DIR__ . ‘/../vendor/autoload.php’;
new: require __DIR__ . ‘/../../../vendor/autoload.php’;
save the file and exit nano (or other text editor)

~ cd ..
~ cd www
~ nano .htaccess

uncomment line
# RewriteBase /
save the file and exit nano

cd to [your-dir]/vendor and create .htaccess with following content:
Order Allow,Deny
Deny from all

route subdomain.your-domain.tld to your-webserver-root/[your-dir]/[your-mandants]/[mandant1]/www/
call subdomain.your-domain.tld and enjoy nette congrats!

more mandants?
cd to [your-dir]/[your-mandants]
~ cp -r mandant1 mandant2

conclusion: seems to work, but I don't know whether this approach is best practice.

Last edited by onkelheinz (2015-06-18 17:22)