bernhard Posted January 5, 2018 Share Posted January 5, 2018 DEPRECATED - USE ROCKMIGRATIONS INSTEAD I'm very happy to share my newest module called "ProcessWire Kickstart" that I developed during the holidays Maybe some of you already saw the preview thread about this... What it does: This module makes it possible to install ProcessWire in a fully automated process. You can define all necessary settings in one single php file and you can even define "recipes" that get executed after installation. This means you can install modules, adopt settings and do whatever you want with your new site using the PW API (like creating pages and so on). You could also place a kind of frontend boilerplate on your git account and grab that after installation and place it in your templates folder. I ran out of time so maybe someone could try that out and show how he did it Additional to that there is a ProcessModule to install in your ProcessWire admin which makes creating and testing recipes super easy. Note: Alpha realese until this module gets some more testing. Please be careful with this tool since it does some heavy file system manipulations (unzipping, moving and DELETING whole directories...). Use at your own risk. Usage: Just grab a copy of the kickstarter, place it on your server, visit yournewsite.com/kickstart.php, adjust settings (like username+password) as needed and hit "install". If your mysql user does not have the rights to create a new database then you have to create a database before running the installer! Download: via SSH: cd /var/www/yournewsitedirectory wget baumrock.com/kickstart.php // or using curl curl baumrock.com/kickstart.php -L --output kickstart.php Manually: Klick baumrock.com/kickstart.php and upload the file to your server Note: baumrock.com/kickstart.php returns the current master file from the gitlab repo and changes the namespace of the script so that it can install itself via recipe. If you don't need to install the kickstart processmodule via recipe you could also download the kickstart.php file from gitlab. Screenshots/Walkthrough: The initial Screen: You can either upload a file via the left panel or take my example file from the gitlab repo: This way you can create your own kickstartfiles and host it on your own accounts. When the file is loaded you can easily edit all necessary informations, like username, password and the url where to grab ProcessWire from. I just tried it with an old version as well... 2.7 worked just fine (having the old installer that recently was updated) but an ancient 2.2.4 version failed. I don't think anybody will ever need to install lots of old versions of pw with this tool but I wanted to mention it here. Hit "install" and lean back - on my VPS it takes 15 seconds to install my very own custom version of processwire with all modules that i need After logging into your admin you'll see that all modules from your recipe are installed: Recipe Editor: As recipes are executed after processwire was installed you have all your API magic available there. Running this scripts is only possible inside of a working processwire installation, so I created a module to help you with that task. See the comments of the sample recipe for more information! I hope this tool helps you to save lots of time and create lots of awesome ProcessWire websites I would be happy to see how you use this and please share useful recipes here in the thread so that everybody can profit. Maybe you just want to throw in an idea what could be done (for example I can imagine a recipe that checks file permissions on the system after installation)... Some parts of the code and maybe also part of the idea are taken from @Soma 's old and still great online installer, thx for that! 24 Link to comment Share on other sites More sharing options...
dotnetic Posted January 8, 2018 Share Posted January 8, 2018 Thank you Bernhard for your efforts. This looks great. Hope I find the time to test it in the next days. 2 Link to comment Share on other sites More sharing options...
Robin S Posted January 8, 2018 Share Posted January 8, 2018 Looks cool, thanks! I think it would be a good idea to include some advice that when using on a live server users should password protect the directory that kickstart.php is uploaded to, until the install process is completed and kickstart.php is removed. Otherwise there is a security risk that a third-party might access the script and thereby be able to upload any files of their choosing. Password protection info:ApachecPanel (essentially just a GUI for Apache basic auth) 1 Link to comment Share on other sites More sharing options...
kongondo Posted January 9, 2018 Share Posted January 9, 2018 45 minutes ago, Robin S said: I think it would be a good idea to include some advice that when using on a live server users should password protect the directory that kickstart.php is uploaded to, I haven't studied the code but wondering if uploading to a non-web-accessible system directory might help? E.g. Quote /var/outsidewebaccess/.dotdirectory 1 Link to comment Share on other sites More sharing options...
bernhard Posted January 9, 2018 Author Share Posted January 9, 2018 13 hours ago, Robin S said: Otherwise there is a security risk that a third-party might access the script and thereby be able to upload any files of their choosing. Hm... thanks for that hint. I'm not sure if I like the idea of adding a password. It would break the functionality - at least I would have to put in more work. I didn't think of password protecting it, because that's the same with the regular installer (it is also visible to the public as long as the installation did not finish). The only difference at PW Kickstart is that it enables you uploading files, that's true... But still i don't think that it is necessary to password protect the directory. The goal of this installer to make the process of creating new pw websites as easy and as fast as possible and to eliminate all of the repetitive tasks that one has to do on every new pw installation. Ok I just got an idea: The downloader at baumrock.com/kickstart.php actually grabs the file from the gitlab repo and replaces the namespace ProcessWire on the first line with namespace Kickstart. This is do make sure the installer works both as an installer and as a helper for the Recipe Processmodule. I could easily add some lines of code to that service that adds the IP of the requesting client to the kickstart.php file and blocks all requests that do not come from that IP. What do you guys think? 2 Link to comment Share on other sites More sharing options...
fbg13 Posted January 9, 2018 Share Posted January 9, 2018 How about making it only visible when a get variable is set and has the same value as a variable set by the user? $pass = '12345'; if ($_GET['pass'] !== $pass) { exit; } 1 Link to comment Share on other sites More sharing options...
dotnetic Posted January 9, 2018 Share Posted January 9, 2018 I think this unnecessary, because there is not a single installer (of which I know) out there that is password protected (not PW, not WordPress, not Drupal, not NextCloud, etc.). And even if it was so, I think that most guys develop on a local machine and then upload to a live server. I know: People do stuff differently. However: Because of the upload functionality, it is a high security risk if people can upload files, without checking for permission. I think this does not matter on a local server, but on a live server it does. 3 Link to comment Share on other sites More sharing options...
dotnetic Posted January 9, 2018 Share Posted January 9, 2018 Just to clarify: The security problem exists if your server is reachable from the internet. No matter if local or housed. Link to comment Share on other sites More sharing options...
dotnetic Posted January 20, 2018 Share Posted January 20, 2018 Hi @bernhard. I wanted to test your module, but it does not work on my system. Maybe it's windows related. I am on Windows 10, with latest PHP/APACHE/MYSQL. When I select "Load a Kickstartfile from URL" and enter the URL to your Example Snippet from Gitlab Repo it downloads ProcessWire and after this my directory looks like this: but then the script says: "404 page not found (no site configuration or install.php available)". I would like to test and help you fix this. 1 Link to comment Share on other sites More sharing options...
dotnetic Posted January 20, 2018 Share Posted January 20, 2018 This seems to be a problem if I use a subdirectory like http://localhost/pwtest/kickstart.php instead of http://pwtest.localhost/kickstart.php. I will check this. 1 Link to comment Share on other sites More sharing options...
bernhard Posted January 20, 2018 Author Share Posted January 20, 2018 hey jmartsch thanks for your interest and help I found the problem and did a quickfix. Seems to work now inside the root directory and also in a subdirectory: https://gitlab.com/baumrock/kickstart/commit/a68ba04c53e144ee1255faea704ab9c350b7fbe8 I have to leave now so I could not do more testing - could you please check if the recipes folder gets deleted after installation? Think I have to fix that. Also it should have thrown an error during installation, have to fix that too. But it should work now Thanks Link to comment Share on other sites More sharing options...
bernhard Posted January 27, 2018 Author Share Posted January 27, 2018 Just pushed a little update that makes the definition of recipes easier, see this sample: <?php $password = $this->randomPassword(); return [ 'pw' =>'https://github.com/processwire/processwire/archive/dev.zip', 'profile' => 'site-default', 'settings' => [ 'timezone' => 368, // vienna 'dbName' => 'yourdbname', 'dbUser' => 'root', 'dbPass' => $this->randomPassword(), 'admin_name' => 'youradminurl', 'username' => 'youradminusername', 'userpass' => $password, 'userpass_confirm' => $password, //'dbTablesAction' => 'remove', // overwrite existing tables? ], 'recipes' => [ function() { $this->msg('Installing RockMockup...'); $this->installModule('RockMockup', 'https://gitlab.com/baumrock/RockMockup/repository/master/archive.zip'); $this->succ('RockMockup installation completed'); }, ], ]; I also added this video to the first post to demonstrate how easy it is to use (I think all the screenshots may have made the impression that it is complicated)! 5 Link to comment Share on other sites More sharing options...
StanLindsey Posted February 2, 2018 Share Posted February 2, 2018 Can this module set up some templates, fields and pages? Link to comment Share on other sites More sharing options...
bernhard Posted February 2, 2018 Author Share Posted February 2, 2018 11 minutes ago, StanLindsey said: Can this module set up some templates, fields and pages? yes google "site:processwire.com create template field api" see some example code: https://processwire.com/talk/topic/1051-adding-and-assigning-fields-without-using-gui/?do=findComment&comment=9150 create a recipe that executes this code you could also make the recipe install the migrations module, copy over some migrations from a git repo and then execute this migrations. 1 Link to comment Share on other sites More sharing options...
StanLindsey Posted February 2, 2018 Share Posted February 2, 2018 16 minutes ago, bernhard said: yes google "site:processwire.com create template field api" see some example code: https://processwire.com/talk/topic/1051-adding-and-assigning-fields-without-using-gui/?do=findComment&comment=9150 create a recipe that executes this code you could also make the recipe install the migrations module, copy over some migrations from a git repo and then execute this migrations. I already do this for most of my builds for fixtures but can't find a way to edit the other "data" of a template - the url info or other advanced data. Link to comment Share on other sites More sharing options...
bernhard Posted February 2, 2018 Author Share Posted February 2, 2018 10 minutes ago, StanLindsey said: but can't find a way to edit the other "data" of a template - the url info or other advanced data. I don't get your point, sorry. But it seems like this has nothing to do with my kickstart module so I guess it would be better to ask in the general support category? Link to comment Share on other sites More sharing options...
StanLindsey Posted February 2, 2018 Share Posted February 2, 2018 3 minutes ago, bernhard said: I don't get your point, sorry. But it seems like this has nothing to do with my kickstart module so I guess it would be better to ask in the general support category? Yeah sorry - went off topic - but that's why I originally asked - if there was any additional functionality included for setting up templates and fields beyond the default APIs capabilities. The migrations module install idea is genius though. Thanks. 1 Link to comment Share on other sites More sharing options...
bernhard Posted April 8, 2018 Author Share Posted April 8, 2018 'recipes' => [ // sample callback as recipe function() { $this->msg('Installing AOS...'); $aos = $this->installModule('AdminOnSteroids', 'https://github.com/rolandtoth/AdminOnSteroids/archive/master.zip'); $this->wire->modules->saveConfig($aos, [ 'enabled' => 1, 'enabledSubmodules' => ['FieldAndTemplateEditLinks'], ]); $tracy = $this->installModule('TracyDebugger', 'https://github.com/adrianbj/TracyDebugger/archive/master.zip'); $this->wire->modules->saveConfig($tracy, [ 'superuserForceDevelopment' => 1, 'editor' => 'vscode://file/%file:%line', ]); }, ], Current version of the kickstartfile: Installs AOS, enables it, enables editlinks. Installs TracyDebugger and sets editor protocoll handler for vscode. 1-click installation of ProcessWire with custom module setup and (in contrary to using site profiles) UP-TO-DATE modules and pw-version! Since january I have not run the default pw installer once... 2 Link to comment Share on other sites More sharing options...
Beluga Posted October 16, 2018 Share Posted October 16, 2018 Thanks for this module, I am just getting into it - the long way ? I will explain what I needed to hack in order to make this work with my three-container Docker setup. First, I want to ask something: How can I set 'timezone' and 'httpHosts'? I saw in the example kickstartfile you had a numeric ID for Vienna, but that seems very odd (and how to find out the ID)!? I tried with these, but they didn't make it into the config.php 'timezone' => 'Europe/Helsinki' 'httpHosts' => ['0.0.0.0:2015','0.0.0.0','localhost:2015','localhost'] Now some interesting notes from my Docker adventure. These are hacks to the kickstart.php file. - I had to change the checkPHP function to always return true, because it wanted to run 'php -l', but php binary does not exist in my web server container! I can always validate the syntax of my recipe myself, so it's fine. - I learned I need to specify 0.0.0.0 in my Caddyfile instead of localhost, because otherwise curl will get connection refused. This was helpful in debugging: https://blog.kettle.io/debugging-curl-requests-in-php/ Then in the postToPW function I gave the container address: $url = 'http://caddy:2015/install.php'; - because Caddy is not Apache, I always get the Apache mod_rewrite on PW's compatibility check. So I silenced the error: // do all the pw installation steps if($this->postToPW(['step'=>1], ['stepname' => 'Check compatibility', 'errors' => [], 'quiet' => true])) { During the testing phase I benefited from commenting out the zip download and deletion: //$this->downloadAndSave($this->config['pw'], 'pw.zip'); and //if($delete) unlink($zipfile); 2 Link to comment Share on other sites More sharing options...
bernhard Posted October 16, 2018 Author Share Posted October 16, 2018 42 minutes ago, Beluga said: How can I set 'timezone' and 'httpHosts'? I saw in the example kickstartfile you had a numeric ID for Vienna, but that seems very odd (and how to find out the ID)!? I tried with these, but they didn't make it into the config.php The timezone IDs are taken from the default PW installer. There is a select field and you can lookup the IDs there. That's how the installer is set up - no idea where these IDs come from ? To your other questions: I can imagine that it took some effort to make it work. Does it work now? Do you have any specific suggestions for improvements? I'm short on time and I use kickstart on my PC just to setup new installations. I don't plan to develop a general installer replacement. I'm happy to accept PRs though ? Hope that helps! Link to comment Share on other sites More sharing options...
Beluga Posted October 16, 2018 Share Posted October 16, 2018 Yep, it works fine. I'll see if I can come up with something for the php linting and the compatibility error (but am not in a hurry). Ah, and now I notice my syntax error for the httpHosts, should have just been a string with the hosts separated by newlines like in your defaults: $hosts = "www.".ltrim($this->host, 'www.')."\n".ltrim($this->host, 'www.'); Cheers. 1 Link to comment Share on other sites More sharing options...
Beluga Posted October 19, 2018 Share Posted October 19, 2018 Created this MR https://gitlab.com/baumrock/kickstart/merge_requests/1 so weirdos like me can use kickstart.php?skiplint and the config parameter skipcompat. Other stuff: Maybe there could be a 'httpHosts' in the example kickstartfile, to show the \n and a comment emphasising that you have to use double-quotes for them to work? The function timezones() in install.php gets the tz list with PHP's timezone_identifiers_list and adds some extras. It would seem to me that the number and ordering of this data might change at any point in history, so it feels a bit awkward to rely on the IDs we happen to get at present. On the other hand, the current solution using CURLOPT_POSTFIELDS to pass stuff to install.php is simple and getting the tz IDs by parsing the select option texts would add a gymnastic extra step. 1 Link to comment Share on other sites More sharing options...
bernhard Posted October 22, 2018 Author Share Posted October 22, 2018 On 10/19/2018 at 11:57 AM, Beluga said: Created this MR https://gitlab.com/baumrock/kickstart/merge_requests/1 so weirdos like me can use kickstart.php?skiplint and the config parameter skipcompat. Thx, done! Also added an example for the hosts setting. 1 Link to comment Share on other sites More sharing options...
wbmnfktr Posted June 14, 2019 Share Posted June 14, 2019 Well... I stumbled across this almost by accident and... I really like love it. 1 remote file 1 setup file Ready to go Almost as easy as setting up a new project in laragon. <?php /** * Universal Starter Default * * @author wbmnfktr, webmanufaktur.net * @version 1 * */ $password = $this->randomPassword(16); return [ 'pw' =>'https://github.com/processwire/processwire/archive/dev.zip', 'profile' => 'https://github.com/webmanufaktur/pwbmultiblank/archive/master.zip', 'settings' => [ 'timezone' => 368, // vienna 'dbUser' => 'root', 'dbPass' => '', 'dbTablesAction' => 'remove', ], 'recipes' => [ function() { $this->installModule('FieldtypeRepeater'); $this->installModule('HannaCodeDialog', 'https://github.com/Toutouwai/HannaCodeDialog/archive/master.zip'); $this->installModule('ImportPagesCSV', 'https://github.com/ryancramerdesign/ImportPagesCSV/zipball/master'); $this->installModule('InputfieldPageAutocomplete'); $this->installModule('LazyCron'); $this->installModule('MinimalFieldset', 'https://github.com/Toutouwai/MinimalFieldset/archive/master.zip'); $this->installModule('PageHitCounter', 'https://github.com/FlipZoomMedia/PageHitCounter/archive/master.zip'); $this->installModule('PagePathHistory'); $this->installModule('ProcessDatabaseBackups','https://github.com/ryancramerdesign/ProcessDatabaseBackups/archive/master.zip'); $this->installModule('ProcessExportProfile', 'https://github.com/ryancramerdesign/ProcessExportProfile/archive/master.zip'); $this->installModule('ProcessForgotPassword'); $this->installModule('ProcessJumplinks', 'https://gitlab.com/rockettpw/seo/jumplinks-one/-/archive/1.5.54/jumplinks-one-1.5.54.zip'); $this->installModule('ProcessMenuBuilder', 'https://github.com/kongondo/MenuBuilder/archive/master.zip'); $this->installModule('ProcessPageClone'); $this->installModule('TextformatterHannaCode', 'https://github.com/ryancramerdesign/ProcessHannaCode/archive/master.zip'); }, ], ]; 1 Link to comment Share on other sites More sharing options...
gornycreative Posted July 2, 2020 Share Posted July 2, 2020 Am I right in thinking you could use this to install Duplicator and then install a Duplicator backup package? Would that be an alternative to building out a full blown recipe including all the modules, etc.? I have a number of installation images that I like to deploy for different use cases and most of them also include some default documentation. Modules, templates, fields, vendors scripts, etc. I suppose the advantage to a recipe would be always pulling the latest master branches for certain dependencies? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now