drupal-project icon indicating copy to clipboard operation
drupal-project copied to clipboard

Creating a deployment artifact

Open michaellenahan opened this issue 8 years ago • 14 comments

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?

michaellenahan avatar May 11 '17 15:05 michaellenahan

You should use a continuous integration tool for that like Jenkins.

thomascys avatar May 18 '17 08:05 thomascys

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.

FatherShawn avatar Mar 08 '18 18:03 FatherShawn

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.

jonpugh avatar Mar 08 '18 19:03 jonpugh

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

FatherShawn avatar Mar 08 '18 19:03 FatherShawn

@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 avatar Apr 16 '18 21:04 derhasi

@derhasi I think that what we did in Ballast is a lighter weight alternative to BLT

FatherShawn avatar Apr 16 '18 21:04 FatherShawn

@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

derhasi avatar Apr 17 '18 13:04 derhasi

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.

FatherShawn avatar Apr 17 '18 14:04 FatherShawn

Is this still in the works? I really love to see this <3

vierlex avatar Sep 11 '18 18:09 vierlex

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 avatar Sep 11 '18 18:09 FatherShawn

@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!

jonpugh avatar Aug 26 '20 14:08 jonpugh

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.

normanlolx avatar Jan 12 '21 21:01 normanlolx

@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.

d70rr3s avatar Jul 19 '21 11:07 d70rr3s

Try https://github.com/drevops/git-artifact

AlexSkrypnyk avatar Oct 08 '23 04:10 AlexSkrypnyk