totoff Posted November 27, 2015 Share Posted November 27, 2015 Hi all, my new website is online but not yet finished. Though it looks good, I have plans for several improvements on both, coding and design. I wonder how others develop on websites that are live? What is your workflow? Do you have a clone and sync your changes back to live? Do you put the site offline for the times you develop on it? Or don't you care at all and just work on the live site? Curious to learn how others deal with this task. Thanks! Link to comment Share on other sites More sharing options...
horst Posted November 27, 2015 Share Posted November 27, 2015 (edited) Hi @totoff, it depends on what tasks I want apply to a site. If it only rely on template files, css and js files, I switch from regular to dev-files. Means, I use a little abstraction layer for including my files like this: $myMainJSfile = "scripts/main.js"; $myMainCSSfile = "styles/main.css"; When working on a live site, I use something like this: if($user->isSuperuser()) { $config->debug = true; $myMainJSfile = "scripts/main.dev.js"; $myMainCSSfile = "styles/main.dev.css"; } else { $myMainJSfile = "scripts/main.js"; $myMainCSSfile = "styles/main.css"; } When working on templatefiles, I put in the top of the template file a few lines of code: if($user->isSuperuser()) { include("./nameOfMyTemplateFile.dev.php"); return; } This switches to a dev version of the template file and returns directly after including it. (The code of the original isn't executed). This is a basic description. Depending on how you have organized your site, there is a lot room for improvements, go into depth, make it a more granular system. But you get the idea. If I need to alter the DB too, I use a separate site/config.dev.php too. YOu can read about it here, scroll down to the end: "Maintaining a separate development configuration file". (I duplicate the DB to a dev-version and connect to it for development) Edited November 27, 2015 by horst added more to the example, (I hit the post button by accident) 7 Link to comment Share on other sites More sharing options...
totoff Posted November 27, 2015 Author Share Posted November 27, 2015 @Horst great explanation and a convincing concept. Thanks for sharing! 1 Link to comment Share on other sites More sharing options...
mr-fan Posted November 27, 2015 Share Posted November 27, 2015 (edited) This methode works for the complete /template/ folder, too....so you could have a whole dev version and change it to live and back if there was problems.... From Diogo's tipps to bookmark: https://processwire.com/talk/topic/2475-quick-tip-for-testing-on-live-website/#entry23571 Best version i see on this topic for me i copy the template folder and rename it to /dev/ and use the snippet from the post above...make a backup of the live templates and copy the dev files...so you can create simple steps. Not that perfect like versioning with git - but for small/medium websites it should be a save methode to test and change things live without a risk. regards mr-fan Edit: Additional there is a great recipe from Raymond on this topic https://processwire-recipes.com/recipes/use-different-sets-of-template-files/ Edited November 27, 2015 by mr-fan 4 Link to comment Share on other sites More sharing options...
tooth-paste Posted November 29, 2015 Share Posted November 29, 2015 $myMainJSfile = "scripts/main.js"; $myMainCSSfile = "styles/main.css"; @Horst: How do you add this line exactly. Is it in a metatag? Do you use the header template? Link to comment Share on other sites More sharing options...
horst Posted November 29, 2015 Share Posted November 29, 2015 Hi, it is just an example. I use module SPEX, that provides delayed output and a lot more. With it I call the files like this: $spex->addScript('scripts/jquery.min.js'); $spex->addScript($myMainJSfile); $spex->addStyle('styles/main.less'); It is similar to the regular use of $config->scripts->add( $config->urls->templates . $myMainJSfile ); Link to comment Share on other sites More sharing options...
justb3a Posted December 1, 2015 Share Posted December 1, 2015 That's interesting. Usually I have a local copy of each site. For sync (and deploy) I use capistrano. For example: cap production db:server_to_local. - db:server_to_local Import server database locally --- executes --- - db:dump_server_db dump server database - db:download_server_dump download server database dump - db:dump_local_db backup local database - db:import_server_db import server database locally - db:download_assets you will be asked, whether to fetch assets from server This way I can also sync between servers easily (production to staging for example). 5 Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 1, 2015 Share Posted December 1, 2015 @justb3a Can you handle things like fresh content on the prod. server with this tool? Simple db transfers just don't cut it most of the time. Link to comment Share on other sites More sharing options...
justb3a Posted December 1, 2015 Share Posted December 1, 2015 I'll make sure that nobody is working on the content for that time (for example disabling login for editors). And I exclude tables which contain dynamic content, for example incoming contact requests ( ignore_tables = ['field_scf_email', 'field_scf_fullname', ... ]; ). But I know this doesn't handle all cases... 1 Link to comment Share on other sites More sharing options...
pwired Posted December 1, 2015 Share Posted December 1, 2015 There seems to be a web ui for it as well: https://github.com/peritor/webistrano Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted December 1, 2015 Share Posted December 1, 2015 While we're on the topic of Capistrano, I thought I'd mention a project called WordMove which I found recently: https://github.com/welaika/wordmove 1 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted December 2, 2015 Share Posted December 2, 2015 I am yet trying to encorporate this in my workflow, but deployer seems to be valid alternative to capistrano. And it is in PHP, so no need for Ruby. The developer is Russian, so that gives me a little pride. A lot of Capistrano maintainers are also my fellow contrymen - just to point that we not only bomb and confront . @pwired: There seems to be a web interface to deployer too. You can see it on the frontpage of offsite and the source is on github/ At least i think I saw it there. 5 Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 2, 2015 Share Posted December 2, 2015 I'm currently working on a bigger project with migration files, like posted here: https://processwire.com/talk/topic/11382-migrating-modules/?p=106238. Currently there's no migration automation, but it keeps changes to the db manageable by source control. I just deploy by git pull and then run the new migrations manually. 3 Link to comment Share on other sites More sharing options...
pwired Posted December 2, 2015 Share Posted December 2, 2015 Hi Ivan I think it must be this one: https://github.com/ngmy/webloyer Link to comment Share on other sites More sharing options...
pwired Posted December 2, 2015 Share Posted December 2, 2015 How do you guys deploy processwire sites on windows ? Link to comment Share on other sites More sharing options...
pwired Posted December 2, 2015 Share Posted December 2, 2015 Ivan's post about deployer really motivates me to leave ftp for what it is and setup a virtual machine with linux. Probably antiX-13.2 (debian) because it is so fast and light. After some digging with google I found a real good and clear tuto about deployer for beginners: https://codereviewvideos.com/course/deployer-easy-php-deployment/video/introduction-to-deployerhttps://codereviewvideos.com/course/deployer-easy-php-deployment/video/installing-deployer After the first two video's you have to subscribe to see the rest of the video's but the tuto text goes on until the end. But I am happy to subscribe there as codereviewvideos made a good impression on me. Site is very easy to navigate, easy to read, clear layout/design/font. Easy to follow video's with clear spoken voice. (no I am not affiliated) I saw also video's there about gulp, vagrant, restfulAPI, composer, phpstorm and a Blog. 1 Link to comment Share on other sites More sharing options...
Christophe Posted December 2, 2015 Share Posted December 2, 2015 A ProcessWire version is needed here: https://github.com/deployphp/deployer/tree/master/recipe 3 Link to comment Share on other sites More sharing options...
elabx Posted December 2, 2015 Share Posted December 2, 2015 Does Deployer need a production server with SSH to work?? Or could I write a task with the PHP ftp class?? And the same for a database dump, then upload and replace data?? Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted December 2, 2015 Share Posted December 2, 2015 @elabx:I found this answer for you. Guess It all makes no sense without ssh. Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 2, 2015 Share Posted December 2, 2015 Deployment over ftp just doesn't make sense as you cannot access the db via ftp. Also ftp can upload files, but not execute them, so it's really a lot less useful in that context. Link to comment Share on other sites More sharing options...
horst Posted December 2, 2015 Share Posted December 2, 2015 Deployment over ftp just doesn't make sense as you cannot access the db via ftp. Also ftp can upload files, but not execute them, so it's really a lot less useful in that context. Hhm, this is right, in general. - But, if you use FTP from within a php script, you can use it for deploying. To execute scripts, you can A) upload individual scripts to the server (via FTP). and after upload, you can trigger the execution via HTTP. Accessing DBs also is easy. I have used php for a long time for syncing files on live and local servers. Scanning local project directory and collect last-modified + crc32 checksums, than do the same on the live server. - Hhm, I found an old script, - tested it and - surprise - it is still running! (I will upload some screenshots.) It originally was created in that times when webdev often was writing and deploying static html files, or maybe some php files but without a CMS, etc. (around 1998/99, for me) So, this is only in the context of historical interest. 5 Link to comment Share on other sites More sharing options...
Can Posted July 20, 2016 Share Posted July 20, 2016 On 2.12.2015 at 6:49 AM, Christophe said: A ProcessWire version is needed here: https://github.com/deployphp/deployer/tree/master/recipe Just posted mine in the forums https://processwire.com/talk/topic/13825-deployer-recipe/ Link to comment Share on other sites More sharing options...
Recommended Posts