After enormous amounts of frustration, I've finally worked out a recipe for setting up Drupal development websites working with composer, git and deployHQ - the submodules were the fly in the ointment, here is how to work with them.
First, create a new Drupal web development project using composer
>$ composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --stability dev --no-interaction
Next, rename web to public_html - so it plays nicely with cPanel
edit composer.json file - swap this in to replace the extras section renaming web to public_html
rename the web directory to public_html
>$ composer update
We then get some doctrine errors because of our php version, this fixes them - add these to require section of composer.json
>$ git ls-files --stage | grep 160000
This should give you a list of files something like this (extra info removed)
now do this for each module found:
git submodule add https://github.com/minkphp/Mink.git vendor/behat/mink
git submodule add https://github.com/drush-ops/drush.git vendor/drush/drush
git submodule add https://git.drupal.org/project/googleanalytics public_html/modules/contrib/googleanalytics
you can find the git location from the config file in the modules repo
>$ git submodule sync # update URLs of submodules
>$ git submodule update --init # install new submodules and update state
I now have a .gitmodules file with these lines in it
And my main git repo now has these lines added to the config file
All, quite fiddly and fragile but it seems to work.
Now you can push and deploy and all should go smoothly! Next time you run composer update it should all just work. Check out some of our CMS website design portfolio to see some websites that we have created using these techniques.
Drupal development can be tough and it's not always the obvious areas that trip you up.