JMS MULTISITE For Joomla! - Tutorial.jms2win

Transcription

JMS MULTISITE for joomla! Extends joomla! with multisite functionality« Technical (workshop) presentation »Joomla Day Mallorca9th and 10th april 2010www.jms2win.com08-Apr-2010Page : 1

Table of content Why did we created JMS MULTISITE (its history) ? Which are our requirement and solutions ? For whom JMS MULTISITE is designed ? What is JMS MULTISITE ?––A super switch, a dispatcher that is able to display the appropriate website depending on the domain,subdomain or subdirectoriesA set of tools to create, replicate, clone websites (a copy machine) that can be used : To supervise the installation, sharing of extensions and also supervise the dependencies between websites––From the front-end (Free or Billable websites)From the back-end to speed-up the website creation How the « super switch » is working ?–Concept of JMS MULTISITE to share the same joomla installation How a HTTP Server is working ?Functionalities present in the different version of Jms Multi Sites ? Security and proposed architecture. How to use JMS MULTISITE (the set of tools) ?–––How to create a websites from the front-end and back-end ?How to create the rules to replicate, clone a website and how to share the content of some extensionsCreation of menu item for the front-end website creation–How it is possible to share the articles ? Possibility to have different layouts Why to use JMS MULTISITE ? Who are using JMS MULTISITE today ? Our other products Conclusionswww.jms2win.com08-Apr-2010Page : 2

History 1www.jms2win.com08-Apr-2010Page : 3

History 2www.jms2win.com08-Apr-2010Page : 4

Our requirements & solutionsRequirements Have a unique maintenance andredure the disk spacce Be able to create website from :– The Back-end– The Front-end Be able to create a huge number of slavesites in a short time.Have a secured environment and be able tofilter the « front-end » parameters Share the users and data to avoidsynchronisations Share the individual articles(not all the articles) Have a tool to supervise the extensioninstallationSolutions to share the same joomla installation.So share the same joomladirectories. Replication (clone) of existingwebsistes that will be used astemplate.– Just change the DB parameters– Use keywords (or variable) to changedynamically some parameters Share some MySQL tables(All records or none) Articles sharing JMS MULTISITE « website tool »www.jms2win.com08-Apr-2010Page : 5

For whom JMS MULTISITES is designed ?www.jms2win.com08-Apr-2010Page : 6

What is JMS MULTISITES ?www.jms2win.com08-Apr-2010Page : 7

Super switch / set of toolswww.jms2win.com08-Apr-2010Page : 8

Set of tools to replicate the websiteswww.jms2win.com08-Apr-2010Page : 9

How the super-switch is working ?Jms Multi Sites works like a HTTP Server (apache, IIS, ) How a HTTP Server is working ?How the HTTP Server processing is applied in Jms Multi SitesHTTP Server (apache / IIS)VirtualHosthttp://www.domain1.comRequest (url)Application#2Index.phpdocument rootwww.domain1.comLocation 1 on diskwww.domain2.comLocation no 2Application#1Index.phpexecutePHPDisplay the web pageParked cument rootLocation 1 on diskAddOn domainsSymbolic LinksVirtualHostdocument rootVirtualHostwww.domain1.comLocation 1 on diskwww.domain1.comLocation 1 on diskwww.domain2.comLocation 1 on diskwww.domain2.comLocation no 2www.jms2win.com08-Apr-2010document rootPage : 10

HTTP Server processing VirtualHost * ServerName domain1.comServerAlias *.domain1.comDocumentRoot /home/user1/domain1/www. . . . . /VirtualHost Server admin tool Cpanel Plesk GoDaddy Etc DNS ServerConvert name into IP rIP 123.123.123.123IP:123.123.123.123BrowserParked domains123.123.123.123:80porthost www.domain1.com80portHttp - port 8021AddOn domainsUnix – apacheWindows - IISFTP ServerVirtual host namedirectoryName: domain1.comAlias: m ,www.domain2.comJMS 1.1 (Symbolic Links)Apache / IIS configurationVirtual host nameHTTP ServerApache / IIS configurationdirectoryName: domain1.comAlias: www.domain1.com/home/user1/domain1/wwwName: domain2.comAlias: www.domain2.com/home/user1/domain /www1Apache / IIS configurationVirtual host namedirectoryName: domain1.comAlias: www.domain1.com/home/user1/domain1/wwwName: domain2.comAlias: com08-Apr-2010Page : 11

JMS MULTISITES concept VirtualHost * ServerName domain1.comServerAlias *.domain1.com, *.domain2.comDocumentRoot /home/user1/domain1/www /VirtualHost ServerIP 123.123.123.123portHTTP ServerUnix – apacheWindows - IIS80port21FTP ServerApache / IIS configurationVirtual host namedirectoryName: domain1.comAlias: www.domain1.com,/home/user1/domain1/wwwdomain2.com ,www.domain2.comJms Multisite: Parse the HTTP protocol envelop to extract the domain, subdomain and subdirectory information Select the appropriate joomla « configuration.php » fileJMS Multisite configurationIDDomainsDB Configurationdomain1.com. /multisites/site1/configuration.phpsite2 www.domain2.comdomain2.com. /multisites/site2/configuration.phpDefault (not found) master website. /configuration.phpsite1 www.domain1.comwww.jms2win.com08-Apr-2010Page : 12

Version History Version 1.0 Version 1.1– Just share the same PHP code and require to assign the same « document root » toeach domain– Only select the appropriate « configuration.php » based on the « host » (domain orsubdomain)– Only create fresh slave sites– Introduction of the Symbolic Links functionality to allow deploy a slave site into anotherdirectory. Case where the HTTP admin tool does not allow assign a specific « document root »– Possibility to create websites from the front-end Template of websites Give the possibility to delears or branches, to create their own websites and avoid « head quarter » create allthe websitesAlso request from « templates (themes) » company to propose « ready to use » websites amoung differentthemesEtc – Possibility to replicate websites into a same DB Template of websitesVersion 1.2– Extended with the replication into another DB– Add the sharing of extensions– Creation of a « website tools » to supervise the « install », « sharing », « uninstall » ofthe extensionswww.jms2win.com08-Apr-2010Page : 13

Version 1.0: Share the joomla http://www.domain2.com/index.phpHTTP Serverwww.domain1.com directory AAADir: AAAjoomlaDBdomain1HTTP Serverwww.domain2.com directory BBBDir: BBBjoomlaDBdomain2As manymaintenanceaswebsiteswebsitesAs manymaintenance www.domain2.com/index.phpHTTP Serverwww.domain1.com dir: commonHTTP Serverwww.domain2.com dir: commonVersion JMS1.0DBdomain1Dir: CommonjoomlaDBdomain2eenanctniao ml a mjolegSi nwww.jms2win.com08-Apr-2010Page : 14

Version 1.0: Compared directoriesStandard JoomlaHosting directory ttp://www.siten.comVersion JMS1.0JMS MULTISITEShare the same Joomla files and p://www.siten.comEach websites duplicate the Joomla files and foldersThis require as many maintenance as there are websitesjosDB Site 1josDB Site 2josDB Site 3A single commonJoomla installationreduce themaintenance !josDB Site 1josDB Site 2josDB Site 3www.jms2win.com08-Apr-2010Page : 15

Version 1.1: Symbolic Link p://www.domain2.com/index.phpHTTP Serverwww.domain1.com directory AAADir: AAAjoomlaDBdomain1HTTP Serverwww.domain2.com directory BBBDir: BBBjoomlaDBdomain2As many maintenance as websitesMultiSiteSymbolic ain2.com/index.phpVersion JMSHTTP Serverwww.domain1.com directory AAAHTTP Serverwww.domain2.com directory BBB 1.1DBdomain1Dir: AAAjoomlaDBdomain2Dir: BBBlinked to AAASym Te bolic Linmplates kancenetniaml a moojelSi n gwww.jms2win.com08-Apr-2010Page : 16

Version 1.1 : Concept of the Symbolic Links The unix Symbolic Link is similar to– a shortcut on windows platform,– an alias on macintosh It does not consume disk space.(this is an alias, a link, a shortcut, a pointer to a directory or file)www.jms2win.com08-Apr-2010Page : 17

Version 1.1: Concept of templatesTemplate of websites: help to create websites from the Back-end or Front-endend eationkcBa tes crsiwebMasterMaster usersORendBack- e creationlatTempTemplates-end ationtnoFr te cresiwebwww.jms2win.com08-Apr-2010Page : 18

Version 1.2: Concept on the sharing of extensionsMySQLTable SharingMultiSiteVersion in2.com/index.phpHTTP Serverwww.domain1.com directory AAAHTTP Serverwww.domain2.com directory BBBAdvantages: Single instance of the Data No need to synchronize data reduct the risks of inconsistencies (or missing synchronization) 1.2DBdomain1Dir: AAAjoomlaTable XsDBdomain2Dir: BBBLinkedtables(Sharing)Table Xslinked to AAAancenetniaml a moojelSi n g LinkLink (share)(share) MySQLMySQL tablestables RequireRequire MySQLMySQL 5.05.0 oror higherhigher RequireRequire MySQLMySQL useruser privilegesprivilegeswww.jms2win.com08-Apr-2010Page : 19

JMS MULTISITES is A Super Switch that works like a HTTP Server to display theappropriate website based on a domain or subdomain orsubdirectory present in a URL Able to use symbolic link to share the files and folders andtherefore reduce the disk space and the number of files onthe disk Able to share the content of a limited number of extensionswith usage of MySQL sharing Able to create websites based on « templates and replicationrules »www.jms2win.com08-Apr-2010Page : 20

Security and proposed architectureThe MASTER must be considered asa repository or a library where all the extensions are installedSecurity of joomla the security of the less secured extensionComponents, modules, pluginsMasterusersFresh slave The global strength of a chain the strength of the weakest element of a chainExtensions installationRules &templatesTemplateof websitesFront-endWebsitecreationSlave 1userswww.jms2win.com08-Apr-2010Page : 21

Proposed architecture Objectives:–– GiveGive toto eacheach slaveslave sitessites theirtheir ownown directorydirectorybesidebeside thethe mastermaster (brother(brother directory)directory)MASTER AsAs thethe slaveslave sitessites isis notnot aa subdirectorysubdirectory ofof thethe mastermaster thenthenitit isis notnot seenseen byby SearchSearch EnginesEngines /domains/jms2win.org/public html/domains/jms2win.org/public html /subdomains/slave1/public html/subdomains/slave1/public html–– GiveGive thethe slaveslave sitesite thethe opportunityopportunity toto havehave«« privateprivate »» directoriesdirectories likelike aa «« downloaddownload »»directorydirectory loadwww.jms2win.com08-Apr-2010Page : 22

Proposed architectureURL Folders and DB Location on disk domainshttp://www.jms2win.orgJms2win.org /jd/domains/jms2win.org/public lave1.jd-jms2win.commasterslave1 /jd/subdomains/master/public htmlShare ://slave2.jd-jms2win.com /jd/subdomains/slave1/public html /jd/subdomains/slave1a/public htmltablesslave2 /jd/subdomains/slave2/public ve3slave3 /jms/jd/public html/slave3www.jms2win.com08-Apr-2010Page : 23

Example of slave sites masterslave1.jd.jms2win.com /jd/domains/jms2win.org/public htmlJms2win.orgslave1Share oupslave1a.jd.jms2win.com /jd/subdomains/master/public htmlBDDtableswww.jms2win.orgBDDtablesLocation on disk Websites URLpropagateactionsBDDtables /jd/subdomains/slave1/public htmlBDDBDD mmaster.jd.jms2win.com/slave3 /jd/subdomains/slave1a/public .jms2win.com /jd/subdomains/master/public s /jd/subdomains/slave1a1/public html /jd/subdomains/slave1b/public html /jd/subdomains/slave2/public html /jd/subdomains/master/public html /slave3www.jms2win.com08-Apr-2010Page : 24

How to create a website from the front-end and back-end ?Back-end FORMMANAGE SITEdddaCreate the website(s) that willbe used as template.Back-endTEMPLATESDefine the replication rules.dddddaCREATE WEBSITES dFront-en FORMSelect a template to make a copy ofa website.Back-end FORMMANAGE SITEddbdddbdInstall the pre-configured extensionsand put a default content (menu, ).CONCEPT1a, 1b, 3a, 2, menu, 3bwww.jms2win.com08-Apr-2010Page : 25

1a) Back-end: basic website creationa{site id}KEYWORDSmnemonic Provide a « site ID »:This is a in.com/subdirectory Provide the domain(s) root}{deploy dir}Path where deploy the slave Deploy directory (facultatif)This is the location that you have(or will) defined in your HTTP Server /home/domains/slave1 Page : 26

1b) Installation of the extensionsb Install an extension, you be1.done:From the slave sitestandard « Extension/Installation »OR2. Use the « WebsitesTools » that allowsyou connect on a slavesite and perform theinstallation, sharing orun-install of theextension withpossible propagationto the.www.jms2win.com08-Apr-2010Page : 27

3.a) Create a website from the Front-endFront-end masteratemplatesrulesSelectSelect aa templatetemplatethatthat containcontain thethe replicationreplication rulesrulesEnterEnter somesome parametersparameters Site Site titletitle Prefix Prefix A A newnew adminadmin emailemail Anewadminpassword A new admin passwordwww.jms2win.com08-Apr-2010Page : 28

3a) Front-end website creationConsistConsist inin thethe selectionselection ofof aatemplatetemplate (rules)(rules) andand inin providingprovidingsomesome basicbasic informationinformation suchsuch asas aawebsitewebsite prefixprefix andand aa titletitleaTemplatesRULES{site prefix}{site alias}TheThe ideaidea isis toto reducereduce thethenumbernumber ofof parametersparameters totoreducereduce thethe vulnerabilities.vulnerabilities.TheThe rulesrules usesuses keywordkeyword totoconvertconvert thethe parametersparametersintointo realreal valuesvalueswww.jms2win.com08-Apr-2010Page : 29

2) Create a templateA template definestemplates What to copy How to copyRULESCOMMONSHARING of EXTENSIONSSet of fields that can becomputed based on « keywords »Select website to replicate Fresh slave (no replication) MasterDefines which extension must be sharedFOLDERS SHARINGDefines the new directorystructureMASTERSLAVELinkedtables Slave sites with DBwww.jms2win.com08-Apr-2010Page : 30

2) Templates (Rules)COMMONSet of fields that can becomputed based on « keywords »SHARING of DIRECTORIESDefines the new directory structureFor example:MASTER Select a website to replicate and change some fields Domain name {site url}/multisites/{site id} New table prefix {site id} Deploy folder {site dir}SHARING of EXTENSIONSDefines which extension must besharedSLAVEFront-EndFront-EndPossible keywords {user id} : This is the joomla user identifier {site id} : Site identifier {site alias} : Site alias given by the front-enduser {root} : Absolute path on where is installed thecurrent website {multisites} : Absolute path to the multisitesdirectory. Equivalent to {root}/multisites {site dir} : Absolute path of the site directory.Equivalent to {multisites}/{site id} {rel site dir} : Relative path of the sitedirectory. Equivalent to multisites/{site id} {site domain} : Field domain fo the site {site url} : URL of the website {deploy dir} : Absolute path where the sitemust be deployed. {site prefix} : Specific site table prefix that afront-end would choose {rnd psw 6} to {rnd psw 10} : Randompassword on a length of 6 to 10 characters {rnd psw} : Random password on a length of 8characters {reset} : Force to reset the field value (clear it).Is generally used with FTP layer parameters*LinkedtablesActions: Create a Symbolic Link Ignore the directory Create a copy(and optionaly use another source) Create the directory based on a Zip or Tar.gz Special copy (images and templates) Directory subdirectory links Rewrite (for htaccess)*Full copyPartial linksRemarks: When a front-end parameters isentered, it is first converted into aback-end parameter. Jms Multisites only process theback-end parameters.www.jms2win.com08-Apr-2010Page : 31

2.1) Template - commonFRONT-END{site prefix}{site alias}Used when creation a websitefrom the front-endwww.{site id}{site id}{site id}.domain.com{site url}/{site id}{root}/{site id}{site dir}{site id}www.jms2win.com08-Apr-2010Page : 32

2.1) Front-end specific template parametersFront-end specific template parameters TitleDescriptionGroup Validity durationMaximum number of websites per userRedirection d’urlKeywords (prefix, alias, )Billable websites fieldsIs used by the front-end menu to filter the templates proposed to the users– Product SKUA reference to the VirtueMart SKU or any other product. (used by Bridge forVirtueMart).– The « Bridge for VirtueMart » update the website status(cancel, refund, pending, confirmed)www.jms2win.com08-Apr-2010Page : 33

2.2) Template – foldersDefine how to create the target directory based on the master directory structure.Actions:Actions: Create Create aa SymbolicSymbolic LinkLink Ignorethe Ignore the directorydirectory Create Create aa copycopy(and(and optionalyoptionaly useuse anotheranother source)source) Createthedirectory Create the directory basedbased onon aa ZipZip oror Tar.gzTar.gz Specialcopy(imagesandtemplates) Special copy (images and templates) Directory Directory subdirectorysubdirectory linkslinks Rewrite(for Rewrite (for htaccess)htaccess)MASTERSLAVESource pathPossibilityPossibility toto havehave aa specificspecific directorydirectory forfor thethe«« imagesimages »» andand «« templatestemplates ».».Full sharedAction special copyFull copyAction copywww.jms2win.com08-Apr-2010Partial sharingAction special copyTemplate folder {deploy dir}/templatesPage : 34

2.3) Template – sharing of extensionsRequire MySQL 5.0 or higher MySQL user with privileges to share tablesPHPMyAdmin (root)DBdomain1Table XsDBdomain2LinkedtablescPanel limitationsTable Xswww.jms2win.com08-Apr-2010Page : 35

Back-end menu overviewaabbbwww.jms2win.com08-Apr-2010Page : 36

3a) Front-end menuaBillableBillable websitewebsite-Product-Product SKUSKU-Execute-Execute additionaladditional scriptscript-Bridge-Bridge toto VirtueMartVirtueMartwww.jms2win.com08-Apr-2010Page : 37

Layouts managerLayoutsLayouts areare usedused toto changechange thethefront-endfront-end rendering.rendering.NotNot onlyonly thethe colorscolors andand lookslooksbutbut alsoalso thethe contentcontent displayed.displayed.ForFor exampleexample itit isis possiblepossible totocreatealayoutthatwouldcreate a layout that woulddisplaydisplay thethe websiteswebsites likelike aa«« directorydirectory »» ofof websiteswebsites forfor aa«« portalportal »»www.jms2win.com08-Apr-2010Page : 38

3b) back-end: create slave site using a templatebwww.jms2win.com08-Apr-2010Page : 39

Back-end : Menu Overview with contentwww.jms2win.com08-Apr-2010Page : 40

Sharing articlesPossibilityPossibility toto selectselect FROMFROM whichwhich websitewebsitethethe article,article, categorycategory oror sectionsection mustmust bebe read.read.PULLPULL thethe articles.articles.www.jms2win.com08-Apr-2010Page : 41

Menu « Sharing of Articles »From any slaves sitesSlave 1, slave 2, slave 3, Xwww.jms2win.com08-Apr-2010Page : 42

Article Sharing for JMS MULTISITECompare the standard joomla with « Multi Sites Article Sharing » Require JMS MULTISITE to retreive the configurationsWorks with MySQL 4.0Can NOT submit an article for another websitewww.jms2win.com08-Apr-2010Page : 43

Article Sharing possible organisationUse the menu« Mutli Sites Article Sharing »PublisherPublisher websitewebsiteSections cle s athee aarrticle er,,layy thDispplaDispubblilisshherid pu onaall aarrtiticcleless,,SSititee idtinaontia nsseecctitioonn porrts sspo tsccaateteggoorryy Categories«« SportsSports »» websitewebsite«« CultureCulture »» websitewebsite SportsRead/write Culture Financialnews«« FinancialFinancial news»news» websitewebsiteTheThe publisherpublisher doesdoes notnot decidedecide wherewhere thethe articlesarticles arearedisplayed.displayed.ThisThis isis thethe slaveslave sitessites thatthat decidedecide whichwhich articlesarticles arearedisplayeddisplayed Page : 44

Why to use JMS MULTISITE ?Save times To update the content of the websites With benefit of sharing a limited number of extensions (including the users) With the sharing of articles. To create new websites : With benefit of the templates of websites ready to use. With benefit of the sharing of directories that just require creating a DB when buildinga new website. With benefit that the final user can create the websites themselves.(ie 300 persons * 1 site is easier than 1 administrateur * 300 sites). To update Joomla and its extensions as there is only one instance of thePHP code. To do backup as there is only one joomla installation to backupSave money Multi Level Marketing possiblities. Minisites specialized on some « keywords » to promote specific products and therefore increase their sales (money). Hosting less expensives. Reduce disk space Reduce the number of number of files and folders to maintain. (Maybe a solution when the number of iNodes is limited). As you save time, you win money.www.jms2win.com08-Apr-2010Page : 45

Who are using JMS MULTISITE today ? Public administrations to equip mayors, cities,districts, departments, . Schools to equip departments, promoteprojects, provide sites for students to training, . Some large companies with many subsidiaries,representatives, dealers, projects, departments,present in several countries, . Companies who wants use the Multi LevelMarketing and create mini-sites for the promotionproducts, . Online stores with several sites who want toshare a single catalog of products, . Websites such as newspapers, localpublications, information services and themesdestinated to specific professions (ie doctor), .www.jms2win.com08-Apr-2010Page : 46

Our other productswww.jms2win.com08-Apr-2010Page : 47

ConclusionThank you to the organizers of the Joomla Day Mallorcafor their support and allowing us to present our extension "JMS MULTISITE".Thank you to all those who have or will watch this presentation and for theirattention.For more information on JMS MULTISITE and see some videos, come visit our age : 48

www.jms2win.com Joomla Day Mallorca 9th and 10th april 2010 JMS MULTISITE for joomla! Extends joomla! with multisit