How deploy an single install with multiple site?
Created 10 months ago by wakanda

Hello community !

I have some personal websites on Pyrocms2 and some others with others misc framework (CodeIgniter, Wordpress...). I would like to migrate them without using a lot of resources server. (no multiple complete install of pyrocms3).

What is the best way for to have 1 core install (or 1 dev + 1 prod) of Pyro3 with :

  • 1 Folder for each project/app/domain (img, js, css, less, html/twig...) outside of pyro root folder
  • 1 Separate database for each project/app/domain (+ maybe 1 database of core)


adidiego  —  10 months ago Best Answer

Well, your request is a bit tricky and you will have to do some tests... I will assume you have some knowledge on how to create PyroCMS applications and/or about the Sites Pro module. For the part of having one folder for each project, you could try with symlinks, but since there is not a single global folder which holds each application, it will be a bit tricky. When you create a new application in Pyro, it generates new folders inside /storage/streams/[app] and /resources/[app] and /public/app/[app] The database part is also tricky, and there isn't a direct or automatic way to do it. The only option is to manage multiple database configurations and doing some coding that decides which database connection configuration needs to use. In your config/database.php configuration file: 'connections' => 'main' => [...] for the main database, you are going to need this mainly to keep the registry of applications and applications_domains 'connections' => '[app-conn]' => [...] for each app database connection Then, you will have to override/extend the \Anomaly\Streams\Platform\Application\ApplicationModel and hardcode the $connection property to always use the 'main' connection.

class ApplicationModel extends \Anomaly\Streams\Platform\Application\ApplicationModel
    protected $connection = 'main';

Then, you will need to specify the DB_CONNECTION that each of you applications must use in each of your application .env files that should be placed into /resources/[app]/.env


I have a personal project that is doing this, and it works.


wakanda  —  10 months ago

I like this approch. I will try with simlinks in unique folder ( /storage, /resources and /public ) and try to extend ApplicationModel for multiple database. Many thanks for this answer @adidiego !