Creating a deployment artifact
I am in the process of deploying my first drupal-composer-template-based project. Because the vendor directory is gitignored, I need to create a 'deployment artifact' containing the files I need on the server, and deploy those files to the server.
https://www.jeffgeerling.com/blog/2017/composer-and-drupal-are-still-strange-bedfellows#1
Acquia's Build and Launch tools (https://github.com/acquia/blt) has scripts for doing this.
Is there something similar available for drupal-composer? What scripts are people using?
You should use a continuous integration tool for that like Jenkins.
We use robo to prepare a deployment branch in https://packagist.org/packages/digitalpulp/ballast - the RoboFile could be modified to make a tarball instead. And we use Codeship for our CI to automate this.
I think his point is that it would be nice to include a standard script or command in this project for doing this right out of the box.
I'm going to look into building this directly into this project. I started a plugin that adds a composer command some months ago in https://packagist.org/packages/jonpugh/composer-git-build , inspired by the BLT scripts.
If we can collaborate on a simple composer plugin we can create a standard artifact builder command, and then include it in the require-dev of this project, it would be amazing.
That's a cool idea @jonpugh - I'll have a look. I also looked at the BLT scripts and took some inspiration, but in general a cleaner approach. https://github.com/digitalpulp/ballast/blob/8c227f3c665c9b651ff46b8e54918adc895e1fdd/scripts/robo/RoboFile.php#L709
@jonpugh I'd love to see a "lightweight" alternative of acquia/blt for this purpose. In addition, this would make working with composer easier for beginners.
@derhasi I think that what we did in Ballast is a lighter weight alternative to BLT
@FatherShawn Ballast looks like a well-thought tool. I personally would like to see just that "build me a branch with all necessary dependencies"-part as an easy to use tool. So the idea of @jonpugh to create a separate command would be great. Maybe that is also something that can come out of Ballast or be reintegrated there.
We currently use a bash script for that purpose and hook that up to our Gitlab CI. I pasted a version of it in https://gist.github.com/derhasi/20ad9f7461192dfdc081c3e31d13df8d
We have methods for this in Ballast now - it's how we do our deployment, so it would be a small lift to pull out just the branch building into a command. Please open a feature request issue in our project so we can track it.
Is this still in the works? I really love to see this <3
I haven't had a chance to work on it. Our code is open source and the latest deployment class is here: https://github.com/digitalpulp/ballast/blob/master/scripts/robo/src/Commands/DeployCommands.php
@FatherShawn would you be interested in co-developing/maintaining a component that handles this feature?
My coworker @solomongiffored just asked about committing vendor today, and Google gently brought me here!
This feature request sounds a bit out-of-scope to me since there are like hundreds of CI SaaS out there and every tool seems to do it differently.
@leymannx the use case behind a feature like this is in some cases (not as sparse as one may think) your CI environment cannot access Internet for security reasons, so you cannot simply trigger a composer install during the build phase of a pipeline. Instead you have 2 options build your project an generate an artifact with it (preferred, just as Aquia's BLT) or commit your entire dependencies tree to your repository.
Try https://github.com/drevops/git-artifact