Heroku Buildpack with Apache, PHP and Grunt - php

I use this Heroku Buildpack to compile my recent project on Heroku https://github.com/gcpantazis/heroku-buildpack-php-gruntjs
It works great with Node version 0.8.x. However, when I change to Node version 0.10.x and push code to heroku, it shows me this error "Failed to install -g grunt-cli --silent dependencies with npm".
Any help would be appreciated.

You can combine the regular PHP and Node.js buildpacks using heroku-buildpack-multi. Example: http://heroku-multipack-nodejs-php-ex.herokuapp.com

We use two buildpacks to enable us to compile frontend assets with Grunt
$ heroku buildpacks:set heroku/nodejs
Buildpack set. Next release on your-application will use heroku/nodejs.
Run git push heroku master to create a new release using this buildpack.
$ heroku buildpacks:set heroku/php --index 2
Buildpack set. Next release on your-application will use:
1. heroku/nodejs
2. heroku/php
Run git push heroku master to create a new release using these buildpacks.

Related

How to add PHP extensions for Composer to Azure DevOps Pipeline

I'm trying to deploy my PHP (CakePHP) application through Azure DevOps and install Composer dependencies in the build step of the pipeline, using a Windows hosted agent.
The composer install is failing because common PHP extensions (namely intl and fileinfo) are unavailable to the PHP executable running in the build. Once deployed, the Web App on Azure does have these extensions. The composer web app extension is installed on the actual app service on Azure and there is a composer.phar file in the root of the repository.
The step I'm trying to run is just php composer.phar install --no-scripts --no-interaction --optimize-autoloader.
The pipeline fails with this error, but I have no idea how to access the .ini file or provide any options.
To enable extensions, verify that they are enabled in your .ini files:
- C:\tools\php\php.ini
PHP_INI_SCAN_DIR can be set, but this 'php template' from DevOps wipes out any added configuration properties when a new deploy happens. This also seems to be a totally different PHP than what the App Service actually runs. I can make a new template for config options, but the PHP extension issue seems to still be there on the build step.
If anyone knows how to simply have composer install dependencies and have them included in the build artifact (.zip file) created, I would greatly appreciate it. Thank you!
As answered in the comment by Levi Lu-MSFT, I was able to modify the PHP configuration by adding a new build task using the Command Line task and entering:
echo extension=intl >> C:\tools\php\php.ini
echo extension=fileinfo >> C:\tools\php\php.ini
Adding quotes caused an issue, but without it seems to work.

What would a Laravel deploy script look like?

I'm using Buddy Works to deploy my project to a server.
When creating a pipeline to deploy my Laravel project, I'm asked to enter deployment actions; this is where I'm stuck.
So far, I have set it to run the following composer commands:
composer validate
composer install
Because this is usually what I do when running my project locally. But I understand that I also need to run Apache and such (I use WAMP so it sorts all that for me).
I've searched on Google and all I got was composer install. Is this all I need to do or is there more?
Prior to using deployment tools, I used to upload files directly to the server, so CI/CD or other DevOps duties are very new to me.
It's good idea to reload php as well as migrate new tables :)
composer install --no-interaction --prefer-dist --optimize-autoloader
echo "" | sudo -S service php7.3-fpm reload
php artisan migrate --force
If you're using DigitalOcean and you have $12 to spare you could use ready tools such as Laravel Forge :)

Minishift - How to compile assets using Laravel mix

I have a minishift instance running on my laptop. I am running a Laravel app on it and it's configured to use a private git repository (a copy of repo is present on my laptop from where I push the changes to the git repository). Now my question is
How do I compile assets on it using laravel mix after I make CSS changes on my local repository and push them to the git repo?
Till now I have tried to:
Run npm dev by logging in to minishift using SSH. But it gives the error npm not installed.
The npm package was added to the S2I base image only recently, it may not have got through to official images yet if using the Minishift from the CDK. It should have got through to CentOS based builder images that would be used by Origin based Minishift.
https://github.com/sclorg/s2i-base-container/issues/115
Where did you get Minishift from and what version?

Which is the minimum version of git to run composer?

I have a website hosted and I want to use composer to resolve my project dependencies on production. But everytime I run composer update I get this error:
$
[RuntimeException]
Failed to execute git status --porcelain --untracked-files=no
error: unknown option `porcelain'
I got the conclusion: git's version on host is too old and it cant recognize --porcelain option.
So, I need update git on host but for what version? What is it the minimum version I can update git to run composer without any issue?
The --porcelain option has been added to git status in git 1.7.0-rc0, commit 6f15787 in September 2009.
So you need at least a git 1.7+.

Pushing a PHP app to Bluemix results in BuildpackCompileFailed

I am trying to push my PHP app to Bluemix with cf push phpinfo-jbs2 -b https://github.com/cloudfoundry/php-buildpack.git and I am getting a message that says BuildpackCompileFailed (full error below).
Any ideas on how to fix this?
[08:49 AM] jsloyer#Jeffs-MacBook-Pro-2 [php]>cf push phpinfo-jbs2 -b https://github.com/cloudfoundry/php-buildpack.git
Creating app phpinfo-jbs2 in org jbsloyer#us.ibm.com / space dev as jbsloyer#us.ibm.com...
OK
Creating route phpinfo-jbs2.mybluemix.net...
OK
Binding phpinfo-jbs2.mybluemix.net to phpinfo-jbs2...
OK
Uploading phpinfo-jbs2...
Uploading app files from: /Users/jsloyer/Downloads/php
Uploading 717, 3 files
Done uploading
OK
Starting app phpinfo-jbs2 in org jbsloyer#us.ibm.com / space dev as jbsloyer#us.ibm.com...
-----> Downloaded app package (4.0K)
Cloning into '/tmp/buildpacks/php-buildpack'...
Submodule 'compile-extensions' (https://github.com/cloudfoundry-incubator/compile-extensions) registered for path 'compile-extensions'
Cloning into 'compile-extensions'...
Submodule path 'compile-extensions': checked out 'ce9345a9a6e7b00266194cadd18dbef37e791a7b'
It looks like you're deploying on a stack (currently set to *lucid64*) that's not supported by this buildpack.
That could be because you're using a recent buildpack release on a deprecated stack.
If you're using the buildpack installed by your CF admin, please let your admin know you saw this error message.
If you at one point specified a buildpack that's at git URL, please make sure you're pointed at a version that supports this stack.
Staging failed: Buildpack compilation step failed
FAILED
BuildpackCompileFailed
TIP: use 'cf logs phpinfo-jbs2 --recent' for more information
Recently the company that owns development for Ubuntu (Cannonical) just announced it is dropping support for lucid 64 which is Ubuntu 10.04 LTS.  What does this mean for Cloud Foundry and the PHP buildpack?
Well nothing really but there is a couple gotcha's you should know about.
If you are pushing an app to Cloud Foundry and getting an error message like the following there is a workaround you need to do to get the PHP buildpack to work.
[08:49 AM] jsloyer#Jeffs-MacBook-Pro-2 [php]>cf push phpinfo-jbs2 -b https://github.com/cloudfoundry/php-buildpack.git
.....
It looks like you're deploying on a stack (currently set to *lucid64*) that's not supported by this buildpack.
That could be because you're using a recent buildpack release on a deprecated stack.
If you're using the buildpack installed by your CF admin, please let your admin know you saw this error message.
If you at one point specified a buildpack that's at git URL, please make sure you're pointed at a version that supports this stack.
Staging failed: Buildpack compilation step failed
FAILED
BuildpackCompileFailed
What this is saying is the instance of Cloud Foundry that you are running on the default stack is an old version of Ubuntu. The PHP buildpack expects the newer version of linux. This stack is called cflinuxfs2, also known as Ubuntu 14.04.
To work around this you just need to specify the stack you want to use.
cf push phpinfo-jbs2 -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
More information on this issue can be found at Github.
To avoid these type of issues, you can use the compatible buildpack that has been pre-installed into Bluemix.
cf push <appname> -b php_buildpack
To see all pre-installed buildpacks:
cf buildpacks

Categories