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.

  • Thanks 1

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 Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot: