kongondo

Sites Manager (ProcessSitesManager)

Recommended Posts

Sites Manager

 

16 September 2018:

FOR NOW, PLEASE DO NOT USE THIS MODULE IN A PRODUCTION SITE. A  RECENT ProcessWire UPDATE HAS BROKEN THE MODULE. I AM WORKING ON A FIX.

 

################

 

Sites Manager is a module for ProcessWire that allows Superusers to easily create/install ProcessWire sites on the same serverspace the module is running in. Only Superusers can use the module. You can create both stand-alone and multi-sites.

 

Single/Stand-alone Sites

Stand-alone or single-sites are sites that will run in their own document root/directory with their own wire and site folders, .htaccess, index.php, etc. In other words, a normal ProcessWire site.

Multiple Sites

Multi-sites are sites that will run off one wire folder (shared amongst two or more sites) each having their own site folder and database. In this regard, it is important to note that Sites Manager is not in itself a multiple sites solution! Rather, it is a utility that helps you create multi-sites to be run using the ProcessWire core multiple sites feature. For more on this core feature, see the official ProcessWire documentation, specifically the solution referred to as Option #1.

Option #1 approach requires the site admin to initially install ProcessWire in a temporary directory for each new site. The directory then needs to be renamed as site-xxx, where ‘xxx’ is any name you want to use to differentiate the installation from other sites, before it is moved to the webroot. For instance, site-mysite, site-another, site-whatever. In addition, the /wire/index.config.php file must be copied/moved to the webroot. Each time a site is added, the index.config.php has to be edited to add ‘domain’ => ‘site-directory’ key=>value pairs for the site. This process can become a bit tedious. This module aims to automate the whole multi-site site creation process.

The module is based off the official ProcessWire installer. Creating a site is as simple as completing and submitting a single form! You also have the option to type and paste values or reuse a pre-defined install configuration.

 

The module will:

  • Install a ProcessWire site in your named directory, applying chmod values as specified

  • Move the directory to your webroot

  • Update/Create a Superuser account as per the submitted form, including setting the desired admin theme and colour

  • For multi sites, update sites.json (used by index.config.php to get array of installed sites)

 

For multi sites, the only difference in relation to the core multi-sites index.config.php is that this file is slightly different from the one that ships with ProcessWire.

Download from GitHub: Sites Manager (Beta Release)

Features

  1. Install unlimited number of sites in one (multi-sites) or independent (single-site) ProcessWire installs.
  2. Install by completing a Form, Typing or pasting in configurations or using pre-created install configurations.
  3. Choose an Admin Theme to auto-install along with the site installation.
  4. For single-sites installation, download, save and reuse ProcessWire versions of your choice.
  5. Install and maintain site profiles for reuse to create other sites.
  6. Create install configurations to speed up installation tasks.
  7. Client and server-side validation of site creation values.
  8. Edit uploaded profiles (e.g., replace profile file).
  9. Lock installed sites, configurations and profiles to prevent editing.
  10. Bulk delete items such as site profiles, installed site directories and/or databases (confirmation required for latter two).
  11. View important site details (admin login, chmod, etc).
  12. Links to installed sites home and admin pages.
  13. Timezones auto-complete/-suggest.

Pre-requisites, Installation & Usage

Please see the documentation.

Technicalities/Issues

  • Only Superusers can use the module.

  • ProcessWire 2.7 - 3.x compatible

  • Currently using ProcessWire 2.7 installer (install.php)

  • For multi-sites, potential race condition when sites.json is being updated on a new site install vs. index.config.php accessing the json file?

  • Not tested with sub-directory installs (for instance localhost/pw/my-site-here/)

  • Currently not doing the extra/experimental database stuff (database charset and engine)

Future Possibilities

  • Install specified modules along with the ProcessWire install

  • Profile previews?

Credits

  1. @ryan: for the ProcessWire installer

  2. @abdus: for the index.config.php reading from JSON idea

  3. @swampmusic: for the challenge

Video Demo

Demo  showing how quick module works on a remote server [YMMV!]. Video shows downloading and processing two versions of ProcessWire (~takes 7 seconds) and installing a single/stand-alone ProcessWire 3 site using the new Admin Theme UI Kit (~2 seconds) on a remote server.

 

Screens

1

sites-manager-001.thumb.png.114a764e0d801f4c367d037147dbd552.png

2

sites-manager-002.thumb.png.f1b6f75cf5dcb2df9661a0f21664baca.png

 

 
  • Like 18

Share this post


Link to post
Share on other sites

Looks great! Makes me eager to set up a multisite :)

  • Like 1

Share this post


Link to post
Share on other sites

Really cool project. I am used to developing individual sites that with separate wire directories but it gets tedious to update each and every one of them, and not to mention duplicate /wire/ directories. I was thinking of moving to the official multi-site solution, but I'll start with your module. Thanks for sharing it with us.

50 minutes ago, kongondo said:

index.config.php reading from JSON idea

Although for simple configurations this may not matter, I've found out that using PHP files for configuration files are much easier to handle, and doesn't need parsing at all. It's as simple as this:

<?php // mysite.config.php

return [
    'site' => 'mysite',
    'domain' => 'mysite.com'
];

<?php // ConfigReader.php

$configs = [];
foreach(configFiles in configDir) {
    $configs[] = include(configFile);
}

https://github.com/mrkrstphr/array-config

To export as php configuration files you can use

http://php.net/manual/en/function.var-export.php

Major disadvantage is that it's php only whereas JSON is almost universal.

 

  • Like 5

Share this post


Link to post
Share on other sites

Cool stuff!

The profiles you mention: are they a different format from the profiles produced by ProcessExportProfile?

Just wondering because you said...

51 minutes ago, kongondo said:

Future Possibilities

  • Install specified modules along with the ProcessWire install

...but site profiles from ProcessExportProfile can include modules, so wasn't sure.

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, abdus said:

but it gets tedious to update each and every one of them

so why do you do that? ;)

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, Robin S said:

The profiles you mention: are they a different format from the profiles produced by ProcessExportProfile?

Just wondering because you said...

...but site profiles from ProcessExportProfile can include modules, so wasn't sure.

No, they are not different. I have not used ProcessExportProfile (but I've been thinking, how nice we have it; it will play nicely with ProcessMultiSites). I assume though that it exports the same type of profiles that ship with ProcessWire (the site-default, etc). so it should work.

What I meant is that, say, you have a blank profile. You want to use that to install several sites. Those sites have different module needs. When creating a site you will be able to paste or select module class names to fetch (live) and install along with the site creation. I haven't thought it through properly and it would mean a delay while the modules are being downloaded.  

Edited by kongondo
  • Like 3

Share this post


Link to post
Share on other sites
4 minutes ago, kongondo said:

What I meant is that, say, you have a blank profile. You want to use that to install several sites. Those sites have different module needs. When creating a site you will be able to paste or select module class names to fetch (live) and install along with the site creation. I haven't thought it through properly and it would mean a delay while the modules are being downloaded.  

exactly what i was talking about here: 

 

see also @abdus comment on top of page2

i don't like site profiles. i think they are far too unflexible mostly because of the reason kongondo said. a possibility to define modules that get installed by default would be great! maybe this module could be extended to a kind of advanced PW installation kit? for example it could also be nice to use it to install a single-site setup in a different directory on the server (in other words, having the possibility to choose wheter the new site should be installed as single or as multisite).

it would also be easy to choose the core version to use for single-site setups by defining the URL like this: https://github.com/processwire/processwire/archive/3.0.36.zip or that https://github.com/ryancramerdesign/ProcessWire/archive/2.7.2.zip

thanks for creating and sharing this module with us kongondo!

  • Like 3

Share this post


Link to post
Share on other sites
1 hour ago, bernhard said:

i don't like site profiles. i think they are far too unflexible

They ARE useful though ;) Think of them as the simplest way of SHARING a site – as a starting point – with the community and it is also needed by the PW installer. No more, no less. Great feature! :D

  • Like 1

Share this post


Link to post
Share on other sites

@kongondo,

It was a joy to wake up and see this effort you have undertaken!  Good luck on making this work.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, bernhard said:

for example it could also be nice to use it to install a single-site setup in a different directory on the server (in other words, having the possibility to choose wheter the new site should be installed as single or as multisite).

Yeah, I had similar thoughts when drafting the module. This is quite easy to accomplish. Actually, one other reason the module is alpha is that it could end up being more than a multi site thingy, hence I would need to change the Class name. 

3 hours ago, bernhard said:

it would also be easy to choose the core version to use for single-site setups by defining the URL like this: https://github.com/processwire/processwire/archive/3.0.36.zip or that https://github.com/ryancramerdesign/ProcessWire/archive/2.7.2.zip

Cool idea. I'll have a think.

  • Like 2

Share this post


Link to post
Share on other sites

great to hear that :)

hm... what do you think of splitting it into 3 parts:

  1. some kind of advanced pw-installer
  2. a process module to handle multisite installations
  3. a single php file that grabs the pw-installer similar to the online installer from soma (https://github.com/somatonic/PWOnlineInstaller/blob/master/grabpw.php)

hm... thinking about point 3 i'm not sure if that makes sens, but i'll leave it here for discussion. maybe it would be easier to do a git clone kongondos-great-pw-installer than creating an index.php, copying some lines of php that basically would do the same as my mentioned git clone?! what do you think?

i think it would be great to make the installation process as easy as possible and on the other hand more flexible than the one we already have (yes, i know we already have site profiles and whoever likes them please continue using them :D;) ). so if the installer was able to install a list of modules it could also install point 2 of my list!

i also think that this installer should be able to load standard setups of a pw-site from any url. be it a json file or some php-setup like abdus mentioned - don't know what would be better. but imagine an installer with one inputfield at the top that says:

Quote

load installation-configuration from URL: ...

this would make it possible to

  1. save your own basic pw-setups as simple gists
  2. share setups with others (eg on the forum for debugging, similar to the concept of VMs)

and all you would have to do was to put in an URL form the basic setup (that the browser should remember), choose admin username + password and database connection info. done :)

maybe a lot of what i want is already doable by adrians module toolkit? but still i think the process of installing pw in general can be optimized. or am i just missing some great options we may already have (like wireshell for example)? or can we use composer like this?

  • Like 1

Share this post


Link to post
Share on other sites
On 05/10/2017 at 7:07 AM, abdus said:

I was thinking of moving to the official multi-site solution, but I'll start with your module.

Just to clarify to those that might be confused by this line. This module is not a multi-site solution. It is a multi-site helper. You will still be using the official ProcessWire mulit-site solution. The module only helps you to auto-mate some of the manual tasks. The only notable difference is the how index.config.php is structured.

 

20 hours ago, bernhard said:

hm... what do you think of splitting it into 3 parts:

  1. some kind of advanced pw-installer
  2. a process module to handle multisite installations
  3. a single php file that grabs the pw-installer similar to the online installer from soma

I am not keen on splitting the module like this since it can, with a little tweaking, already achieve a standalone(single) installation. The only differences between a multi-site and single site are:

multi-site

  1. location of site folder -  located in same folder as the main site folder (e.g. /www/main-site/site/ for the main site and /www/main-site/site-something/ for the installed site
  2. site folder named site-something
  3. uses the existing wire folder (/www/main-site/wire/)
  4. needs index.config.php

single site

  1. location of site folder - located in its own folder (e.g. /www/another-site/site/)
  2. site folder named 'site'
  3. uses its own wire folder (/www/another-site/wire/)
  4. does not need the index.config.php

This means that all we have to do is (like you suggested earlier) tell the module in which directory on your server you want to install the single site, do the htaccess.txt renaming and copy over the wire folder as well as its index.php, LICENSE.txt, etc. That's all there is to it. The database stuff routines remain the same. So, I am thinking of a radio button to choose whether you are installing a single versus multi site, blah blah.

Edit:

In respect of selecting ProcessWire versions,  the module could check if you have a zip file in a designated folder to unzip from and if not, download the ProcessWire version of your choice, or something along those lines.

20 hours ago, bernhard said:

i also think that this installer should be able to load standard setups of a pw-site from any url. be it a json file or some php-setup like abdus mentioned - don't know what would be better. but imagine an installer with one inputfield at the top that says:

What is a standard setup :)? I am a bit jittery about the module communicating with any URL. I would prefer all that such setups are loaded locally. Maybe I am just being paranoid here :)

20 hours ago, bernhard said:

save your own basic pw-setups as simple gists

I was thinking of saving this locally. That's what I was intimating by this:

On 05/10/2017 at 6:57 AM, kongondo said:

Create installation profiles and/or allow JSON/CSV install configurations (useful for repetitive values, e.g. where Superuser email doesn’t change)

 

  • Like 4

Share this post


Link to post
Share on other sites

Update: Multi Sites Version 0.0.2.

Multi Sites can now install single/stand-alone sites! The Multi Sites in the name now means installing and managing multiple sites :P! For single sites use, the module now downloads, strips, compresses and save ProcessWire versions of your choice for reuse (rather than downloading each time you install a single site). These ProcessWire files can be refreshed on demand, e.g. when a new version of ProcessWire comes out. README is now complete. See changelog for more details.

Download from GitHub.

Changelog

  1. Support for installing single/stand-alone sites.
  2. Added Type or Paste and Install Configuration methods for creating sites.
  3. Create and edit site install configurations.
  4. Download, store and restore various versions of ProcessWire (for single-site installations).
  5. UI enhancements.

I'll update first post later.

Screens

1

multisites-version-002-001.thumb.png.68d53d6c6b893052a71068bfb71627b9.png

2

multisites-version-002-002.thumb.png.45bfc60ef15cda727665baa8a3e12bf5.png

3

multisites-version-002-003.thumb.png.094b8fe96bf13f28ec7f71f445aa7501.png

4

multisites-version-002-004.thumb.png.ead01014f6e663b87376a995b6d56ac8.png

Edited by kongondo
  • Like 6

Share this post


Link to post
Share on other sites
7 hours ago, kongondo said:

Multi Sites in the name now means installing and managing multiple sites :P!

Great news! Now I just have to find the time to try it out... BTW, how about renaming it to something like Sites Manager? Is it too late to rename it to something more descriptive and less confusing? There is another group of modules with almost the same name:

also:

Multiple solutions with multiple multies in their names are a bit confusing ;) 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, szabesz said:

BTW, how about renaming it to something like Sites Manager? Is it too late to rename it to something more descriptive and less confusing? There is another group of modules with almost the same name:

Not, it's not late at all. In fact, I forgot to mention it. I was looking for name suggestions! (one of the reasons I still left it in Alpha, actually). Thanks! I like sites manager. Let's see if there are more suggestions.

All,

Module Name

Name suggestions for this module please? We currently have:

  1. Sites Manager

Upgrading

Please note, version 002 includes some templates not in version 001. A re-installation is required I am afraid.

  • Like 1

Share this post


Link to post
Share on other sites

Can't wait to use this for something... Now all I need is a nice big client that needs multiple sites. ;-)

59 minutes ago, swampmusic said:

I am buried deep in vuejs these last weeks

In this boat as well. Vue is awesome! Somewhat of a paradigm shift, but fine - just the reactivity system on its own is great!

Share this post


Link to post
Share on other sites

Update: Multi Sites Sites Manager Version 0.0.3.

Multi Sites is dead! :o Long live Multi Sites!! :)

Happy to announce Beta Release of Sites Manager.

Please note, no upgrade path from versions 001 or 002 of Multi Sites. I have updated the first post.

Download: GitHub

Demo: Remote server single site install (PW 3.x + AdminThemeUIKit).  YouTube

Documentation: GitHub

Changelog

  1. Changed name to Sites Manager (formerly Multi Sites). Thanks to @szabesz for suggestion.
  2. Fixed bugs in Type or Paste method (key=value pairs must now be separated by new line).
  3. Beta release.
Edited by kongondo
minor cleanup
  • Like 3

Share this post


Link to post
Share on other sites

trying this out for the first time. I get this error every time i try to add my first site. Am i doing something wrong?

 

"Error saving admin account"

Screen Shot 2018-09-15 at 7.24.40 PM.png

Share this post


Link to post
Share on other sites

Hi @DxJR,

Welcome to the forums and ProcessWire. Thanks for testing the module. What ProcessWire version are you using? A recent ProcessWire update seems to have broken the module. I noticed this when setting up some sites last week. I've not had a chance to debug it yet. I am quite busy at the moment and don't know when I'll look into it. Until then, please do not to use the module in production sites. I'll update the first post.

Share this post


Link to post
Share on other sites

@kongondo thanks so much for your quick response. Newish to the forums, but been a processwire devoted user for YEARS! Excited to see what this module can do.

  • Like 2

Share this post


Link to post
Share on other sites

@kongondo hey, i know you're busy and probably haven't had time, just wanted to know if you found a solution to this yet. Thanks so much

Share this post


Link to post
Share on other sites

@DxJR Sorry, I haven't had a chance to look at it yet. If you are able to help debug it please, that would help get us there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By BitPoet
      MediaLibrary
      Update: MediaLibrary can now be found in the official module list.
      Out of necessity, I've started to implement a simple media library module.
      The basic mechanism is that it adds a MediaLibrary template with file and image fields. Pages of this type can be added anywhere in the page tree.
      The link and image pickers in CKEditor are extended to allow quick selection of library pages from dropdowns. In the link picker this happens in the MediaLibrary tab, where you can also see a preview of the selected image. In the image picker, simply select a library from the dropdown at the top, everything else is handled by standard functionality.
      I've put the code onto github. This module is compatible with ProcessWire 3.
      Steps to usage:
      Download the module's zip from github (switch to the pw3 branche beforehand if you want to test on PW 3.x) and unpack it into site/modules Click "Modules" -> "Refresh" in the admin Click "Install" for MediaLibrary For testing, create a page with the MediaLibrary template under home (give it an expressive title like 'Global Media') and add some images and files Edit a differnt page with a CKEditor field and add a link and an image to see the MediaLibrary features in action (see the screencap for details) Optionally, go into the module settings for MediaLibrary Note: this module is far from being as elaborate as Kongondo's Media Manager (and doesn't plan to be). If you need a feature-rich solution for integrated media management, give it a look.
      Feel free to change the settings for MediaFiles and MediaImages fields, just keep the type as multiple.
      There are some not-so-pretty hacks for creating and inserting the correct markup, which could probably be changed to use standard input fields, though I'm a bit at a loss right now how to get it to work. I've also still got to take a look at error handling before I can call it fit for production. All feedback and pointers are appreciated (that's also why I post this in the development section).

      Edit 09.03.2016 / version 0.0.4: there's now also a "Media" admin page with a shortcut to quickly add a new library.

      Edit 01.05.2016:
      Version 0.0.8:
      - The module now supports nested media libraries (all descendants of eligible media libraries are also selectable in link/image picker).
      - There's a MediaLibrary::getPageMediaLibraries method you can hook after to modify the array of available libraries.
      - You can switch between (default) select dropdowns or radio boxes in the module configuration of MediaLIbrary to choose libraries.
      Edit 10.10.2018:
      Version 0.1.3:
      - Dropped compatibility for ProcessWire legacy versions by adding namespaces
      - Allow deletion of libraries from the Media overview admin page
      - Added an option to hide media libraries from the page tree (optionally also for superusers)
    • By Robin S
      This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now.
      Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead.
      Add Template Enhancements
      A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin.

      Features
      Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage
      Install the Add Template Enhancements module.
      Configure the module settings according to what suits you.
       
      https://github.com/Toutouwai/AddTemplateEnhancements
      https://modules.processwire.com/modules/add-template-enhancements/
    • By Mike Rockett
      As I mentioned in this issue, I've create a new textformatter for ParsedownExtraPlugin, which adds some oomph to your markdown.
      Repo: Parsedown Extra Plugin
      Unlike the built-in textformatter for Parsedown and Parsedown Extra, this should be used when you want to use Extra with additional configuration/customisation.
      Some examples:
      ### Test {.heading} - A [external link](https://google.com/){.google} with `google` as a class that opens in a new tab if the config property is set. - [Another link](/page){target=_blank} that opens in a new tab even though it isn't external. ```html .html <p>Test</p> ``` There's some config options available to you, such as setting attributes on all/external images and links, setting table and table-cell alignment classes, adjusting footnote classes and IDs, adding <code> attributes to their parent <pre> elements, and changing the <code> class if your syntax highlighter does not use language-*.
      I was thinking about adding the ability to make links open in a new tab by appending a plus to the link syntax, but only external links should be opening in a new tab anyway. Further, this would add extra, unnecessary processing time.
      Please let me know if you bump into any problems. ☺️
    • By Mike Rockett
      TextformatterTypographer (0.4.0 Beta)
      A ProcessWire wrapper for the awesome PHP Typography class, originally authored by KINGdesk LLC and enhanced by Peter Putzer in wp-Typography. Like Smartypants, it supercharges text fields with enhanced typography and typesetting, such as smart quotations, hyphenation in 59 languages, ellipses, copyright-, trade-, and service-marks, math symbols, and more.
      Learn more on my blog
      It's based on the PHP-Typography library found over at wp-Typography, which is more frequently updated and feature rich that its original by KINGdesk LLC.
      The module itself is fully configurable. I haven't done extensive testing, but there is nothing complex about this, and so I only envisage a typographical bug here and there, if any.
      Please do test it out and let me know what you think.
      Also note that I have indicated support for PW 2.8, but I haven't tested there as yet. This was built on PW 3.0.42/62.
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.50
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy!