thmsnhl

Working together in larger Teams

Recommended Posts

Hi everybody,

we started our first Processwire driven project in my new company and for the first time, I was working on one site with more than 2 colleagues on the same site.

It didn't take long for us to stumble across some problems when multiple developers work at the same time, conflicts with updating the database on vagrant machines, like duplicate entries for page IDs, errors when setting up fields and stuff like this. We ended up working on a dedicated database server, that we linked to our vagrant machines and most of the problems were gone, but the performance of this constellation is really bad compared to our first approach with database running on vagrant machines.

I already tried to find a solution in the forums but I couldn't find anyone with problems like this.

So I was wondering: how do you manage projects with multiple developers on vagrant machines in a git-based workflow?

  • Like 3

Share this post


Link to post
Share on other sites

Hey thmsnhl, 

 

I'm using ProcessWire for a few projects at work as well as for my personal projects. Originally coming from Ruby On Rails I also encountered problems with our database synchronization when it comes to team development on a single project. Depending on the project we solved this using Field/Template Export/Import while also only working on certain parts of the page. Most projects are already finished in terms of template/field structure so there is no need to have an always up-to-date local database snapshot.

If the project is not finished in terms of template/field structure we usually sit together and draft a "this-solves-everything"-kind of template/field and synchronize this to our local databases once and then just code ahead.

 

Other frameworks solve this by using Migrations and although ProcessWire does not support Migrations in the core (as of now) you can use this module: https://modules.processwire.com/modules/migrations/ (Here are a few code samples and documentation: https://lostkobrakai.github.io/Migrations/).

This module does not directly add tables and columns to the database like RoR migrations do but instead allows you to do nearly everything you can do in the Admin UI using code. You can for example create templates, move fields around, install modules, setup users etc.

It can be a bit tedious at first to learn all the new APIs this module offers but the benefits, especially for large projects, speak for themselves. 

These migrations can be safely checked into your git repository and whenever one of your teammates encounters a problem with his out-to-date database he can simply run the migrations files. 

So instead of adding templates and fields on production you write them in code and deploy your changes to production, then you migrate either using the CLI utility or the admin backend. You can also integrate this into your build toolchain (like Amazon CodeStar). 

 

Check this code example I bet it feels quite familiar:

<?php

class Migration_2018_01_16_12_32 extends Migration {
    public static $description = "Add postalcode to a hotel";

    public function update() {
        $this->insertIntoTemplate('hotel', 'postalcode', 'title');

        $this->editInTemplateContext('home', 'postalcode', function($f){
            $f->label = "Hotel Postalcode";
            $f->columnWidth = 50;
        });
    }

    public function downgrade() {
        $t = $this->templates->get('hotel');
        $t->fieldgroup->remove('postalcode');
        $t->fieldgroup->save();
    }
}

This adds a `postalcode` field right after the title field to the hotel template. And it removes this field when you rollback your migration.

This is how we tackle this problem.

 

  • Like 12

Share this post


Link to post
Share on other sites

Thank you Mobiletrooper, I haven't found this earlier but it looks like a solid approach!

I will give this a try in the future.

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 rickm
      Hey all,
      A while back I was trying to get Processwire working on the Homestead vagrant box - a really handy vagrant box made by Taylor Otwell (Laravel creator). One cool thing about homestead is it has its own config file where you can set 'path maps' which map a folder on your computer to the vagrant box, and then also set up hostnames. So for example you can set up 10 domains pointing to different locations on your machine, making it a nice all in one vagrant development box for your sites. 
      One thing it didn't do was support processwire. The way it works is it uses setup files for each site, and you can specify things like a site to use nginx, a site to use apache, etc. 
      So to get round this I wrote a custom setup script for it to get processwire working, and it works really well. I've put it up on github should anyone else find it handy, it's a pretty simple little script and is based on the Laravel one included in Homestead.
      Hopefully it'll be useful to someone out there  You can grab it here: https://github.com/rickmills/homestead-processwire
    • By modifiedcontent
      I have one central website, with membership registration and content etc., and then several related websites with their own URL/domains, each on Processwire, all on the same server.
      I would like to access the database of the central website from the sister websites. How would I do that?
      You can't bootstrap one PW installation into another. You can include template parts from one in the other by just using the server path, but whatever you try to get/post just comes/goes to the database of the site you are on.
      Could you switch databases by including the config.php from another PW installation somewhere?
      What is the correct, secure way to do this?
    • By ksymmons
      Hey guys,
      As the question says, I'd really like to learn about your initial client communication workflows. In other words, what's your process like from the moment you get a request to provide a quote for a website to the moment you actually send the quote?
      My current workflow:
      A client fills out the contact form on my site to request a quote. I review the information provided and send them a Word document questionnaire with a list of questions. I ask for things like project scope, features needed, desired timeline, allocated budget, etc. They fill out the document and send it back to me. I review the information provided and make sure I've got everything I need. I write and send the quote to the client. Client accepts the quote. I send them a contract, get it signed and collect 50% of total payment. I gather some extra information from them, usually just by asking questions via email or by sending them another Word document questionnaire. I start building their site. Lately, I've been thinking about changing this workflow a bit. Currently, my online contact form has three fields: name, email and message. What I'm thinking is, what if I provide a select toggle above my form so that clients can choose between a simple, general enquiries form and a larger form (with all the questions I've got in my Word document) to request a quote? This would allow me to do away with the Word document, and would make this a one-step process.
      The reason why I haven't done this so far is because I'm not sure how good of an idea it is to have a long contact form with say, 10-15 questions. What's your take on this?
      Another thing I'm not entirely happy with is having to send them two questionnaires (steps 2 and 8). The reason why I do this is because I don't want to overwhelm them with lots of questions at the beginning, and also because, to be honest, the questions I ask in the 2nd questionnaire do not really influence pricing, as they have more to do with the nature of their business, their goals with the new site, possible corporate colours they may have, things like that.
      What do you guys think? Does my workflow seem sensible to you? Is it similar to what you do? What would you change?
      Thanks, and sorry for the brick!
      P.S. If some of you guys are willing to share your client questionnaires I would certainly appreciate it.
    • By answersmode
      Please help me........
      DATABASE CONNECTION PROBLEM  - CREATE DATABASE IF NOT EXISTS `lwteswm664_ltingesjfo_itbd` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
      Error
      SQL query:
       
      -- -- Database: `lwteswm664_ltingesjfo_itbd` -- CREATE DATABASE IF NOT EXISTS `lwteswm664_ltingesjfo_itbd` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;  
      MySQL said:
      #1044 - Access denied for user 'newhost'@'localhost' to database 'lwteswm664_ltingesjfo_itbd' 
       
      I'm facing this peoblem in my website xxxxx and xxxxx When I wanted to upload my databaz backup file.
      Now what can I do?
      Please help me........
       
       

    • By hezmann
      Hi!  I've just started on ProcessWire, coming from Wordpress.  I've done several sites in WP but this new one is just to data driven for Wordpress to handle without so many plugins and custom code it just seemed like there must be a better option so here I am.  I used to do a lot of stuff in Access (many years ago) and have some experience with PHP/MySQL.
      I've had a look at a few tutorials and created the planets website etc.  I have a specific structure that I'm looking to create so thought I would ask for some expert advice before making every mistake in the book.
      I do a lot of long distance (inn to inn) walking and am always looking for new ones which involves searching many different sites.  I've yet to find a good repository for this type of thing so thought I would build my own.  The basic structure is (more info added later but trying to get basic idea of best practices):
       
      Walks -> Walk Variations <->Walk Segments <-> Walk Towns (go into Walk Segments as Start and End Towns).
      Walks <->Links
      Walk Towns <-> Accomodation, Walk Towns <-> Dining
      Should I be using ProFields?  How should I structure this as far as fields/templates?
      Thanks in advance for your help.
      Heather