Launch gulp task from a backend php/angularjs - php

I'm a newbie with Gulp, I made a some custom tasks and would like to launch any task from any HTML, PHP, AngularJS application.
Is it possible? I try to find some feature at Google but I can't look nothing about it.

Gulp is mainly meant to run as a development tool. You usually run some tasks during build or pre-deploy.
Having said that, it is possible to run gulp from php just as any external process, using exec or shell_exec, provided that your node or nvm environment is properly setup.
To execute gulp directly from within php is something probably unable to do as gulp requires node.js.

Related

Bundling Electron JS with laravel and sqlite

I developed a desktop application in react and electronjs. And built an API with laravel, eveything works perfectly. The challenge I have is, how I can deploy and run my electron app locally without having to manually setup the laravel API.
I am looking for a way to have all of this setup and installed once. I checked out a couple of options and one of such is php-server but that wasn't still going to cut it.
Shell Scripting
I have thought about executing a shell script to create the server instance pull my laravel application from github, set it all up on docker.
The challenge is, if any of my users run docker ps they would see all the processes running on my docker instance.
A possible solution would be isolating docker so it's not accessible globally but only within the application.
I don't know how to achieve this.
If this is achievable please drop some guide on how to achieve that or maybe suggest a better way to handle my current situation.

Hot reload when working with Vue

Is there a way to enable something like hot reload when working with single file Vue components in laravel? The laravel docs suggest gulp watch, but doesn't that mean I will have to kill the laravel dev server each time I make a change to a component? Is there a way to reload when I add (or make a change to) a component without having to stop the server and run the gulp command?
You should only need to issue the gulp watch command once, then it will continue to run. I don't know what system you're on but if you're using a Bash Terminal you can run it as a background task using the Ampersand. You could also be running your development server as a backgrounded task, use homestead, or open up two terminal windows.

How to run (or should I run) PHP composer on Jelastic?

Basically what I'm trying to do is to create a simple multi-node env with varnish+nginx+mariadb+memcached. By now I've managed to launch the environment and attach git project to it. The problem is that we work with php and symfony2, which requires composer to be executed at least once in order to properly deploy the application.
Outside of jelastic we use Jenkins + Ant (but we don't scale horizontally in automatic on the projects where this setup is used, so it's not a problem to add node manually).
So the question is: How can I run composer or ant with build.xml on each deploy?
I see that Java environments have a build server option, is there something like this for php environments?
PHP projects do not have a "standard" build server in the way that many Java projects do - requirements for PHP build tools are more varied depending on the particular project.
For example one customer may ask for grunt, another for ant, and another for phing.
If you want to perform a sophisticated build, you can create your own build node for your PHP project using an Elastic VPS or separate Docker environment. To deploy the built project to your servers you can use SSH connections, or simply git push and set the runtime environment to auto-update (e.g. via ZDT feature) from that git repo / branch.
If your needs are more simple, you can install composer directly onto your php runtime node in the normal way via SSH.
E.g.
$ curl -sS https://getcomposer.org/installer | php
There are more detailed tips about how to tidy that up (add to your PATH etc.) at http://kb.layershift.com/jelastic-install-composer

Behat with Jenkins or Maven?

Is Behat compatible with Jenkins and Maven.Can it be easily integrated? if not , then which BDD frameworks integrate well with Jenkins
Thanks
The simplest way to get jenkins running your behat suite is to use a shell script. Providing you've got a PHP environment setup on your jenkins host and the project dependancies installed through composer, you can specify a simple command such as bin/behat. This will run your behat feature suite, returning an error code if the suite fails. Jenkins should pick this up and fail your job too.
In my experience, having a specific profile in behat.yml for specifying formatters and parameters is useful. As a result your command may look something like: bin/behat --profile ci
You can of course wrap these commands in something like maven or rake and instead of running a shell script in your jenkins job, you can invoke a rake/maven etc task. I use rake for my projects as it's much easier to maintain your build when it starts doing more than just running behat.

PHP Heroku background workers?

I'm using Heroku running a PHP app, I need to setup background workers which talk to external APIs and write to my DB, Heroku has lots of info about setting up workers for Ruby but not for PHP.
Is this easily doable on Heroku with PHP?
I've never tackled launching background processes and I can't seem to find any docs detailing it...
Add the following environment variables:
# Add this config
$ heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
Then you can just add the worker to your Procfile.
worker: cd ~/www/ && ~/php/bin/php worker.php

Categories