Automate App Setup with Laravel Initializer

Automate App Setup with Laravel Initializer

https://ift.tt/2s0oZLe

Automate App Setup with Laravel Initializer

Have you ever found yourself writing multiple manual steps to set up a Laravel application in a new environment? Laravel Initializer is a convenient way to automate installing and updating a Laravel application:

Laravel Initializer gives you the ability to declare multiple processes and run them with app:install and app:update artisan commands, which run predefined actions chain depending on the current environment.

The app:install and app:update commands use two distinct classes that run commands based on a given environment. First, the install command uses the App\Install class:

namespace App; use MadWeb\Initializer\Contracts\Runner; class Install { public function production(Runner $run) { return $run ->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader') ->artisan('key:generate') ->artisan('migrate', ['--force' => true]) ->artisan('storage:link') ->external('npm', 'install', '--production') ->external('npm', 'run', 'production') ->artisan('route:cache') ->artisan('config:cache') ->artisan('event:cache'); } public function local(Runner $run) { return $run ->external('composer', 'install') ->artisan('key:generate') ->artisan('migrate') ->artisan('storage:link') ->external('npm', 'install') ->external('npm', 'run', 'development'); } } 

The app:update command looks similar, using an App\Update class:

namespace App; use MadWeb\Initializer\Contracts\Runner; class Update { public function production(Runner $run) { return $run ->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader') ->external('npm', 'install', '--production') ->external('npm', 'run', 'production') ->artisan('route:cache') ->artisan('config:cache') ->artisan('event:cache') ->artisan('migrate', ['--force' => true]) ->artisan('cache:clear') ->artisan('queue:restart'); ->artisan('horizon:terminate'); } public function local(Runner $run) { return $run ->external('composer', 'install') ->external('npm', 'install') ->external('npm', 'run', 'development') ->artisan('migrate') ->artisan('cache:clear'); } } 

You can also inject dependencies from the service container if you need to access services while running commands.

This package contains a variety of runner actions you should check out in the readme. I found the MakeCronTask dispatch interesting:

$run->dispatch(new \MadWeb\Initializer\Jobs\MakeCronTask) 

MakeCronTask adds the following to the server’s crontab list:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1 

You can do other things like creating a supervisord config for a typical queue worker or horizon.

You can learn more about this package, get full installation instructions, and view the source code on GitHub at mad-web/laravel-initializer.


Filed in: News / packages


Enjoy this? Get Laravel News delivered straight to your inbox every Sunday.

No Spam, ever. We’ll never share your email address and you can opt out at any time.

programming

via Laravel News https://ift.tt/14pzU0d

November 21, 2019 at 09:11AM

Laravel: CSV Import Validation with Errors on Line X [VIDEO]

Laravel: CSV Import Validation with Errors on Line X [VIDEO]

https://www.youtube.com/watch?v=pshvWCCyCGw

Almost live-coding video where I show you how to make a validator for array imported from CSV.

programming

via Laravel News Links https://ift.tt/2dvygAJ

November 20, 2019 at 08:58AM

Amazon delivery infrastructure strained as COVID-19 outbreak sparks surge in online shopping

Amazon delivery infrastructure strained as COVID-19 outbreak sparks surge in online shopping

https://ift.tt/3b18EXX

Amazon’s fulfillment center in Dupont, Wash. (GeekWire Photo / Kevin Lisota)

With thousands of Americans telecommuting and self-isolating to slow the spread of COVID-19, Amazon’s Prime and Fresh delivery services are grappling with high demand and inventory issues, as warehouse workers report increased order volumes.

Amazon is out of stock on a number of household staples and popular items, according to the company’s COVID-19 response page.

“You will also notice that some of our delivery promises are longer than usual,” the site says. “We are working around the clock with our selling partners to ensure availability on all of our products, and bring on additional capacity to deliver all of your orders.”

The consumer impact: Amazon can no longer guarantee two-day delivery on all Prime orders and some of the program’s 150 million subscribers customers are already experiencing delays. The Amazon Fresh website warns grocery deliveries “may be temporarily unavailable due to increased demand.” Amazon Fresh did not have any delivery windows available in the Seattle area as of Monday morning.

The increased demand comes as Amazon navigates supply chain threats from slowed or shuttered factories in China. Amazon did not immediately respond to questions about the delays.

The worker impact: The Seattle tech giant has asked all employees who can work from home to do so, an option unavailable to warehouse workers and delivery drivers. The company is providing two weeks of paid time off to all employees diagnosed with the virus or placed under quarantine.

Amazon is spending $25 million to help its network of independent delivery drivers, Amazon Flex workers, and seasonal employees deal with disruptions caused by the outbreak. The Amazon Relief Fund will provide grants equal to about two weeks’ pay for workers who have the virus or are quarantined. Grants are also available to workers facing financial or other hardships. Several warehouse worker groups have been circulating blog posts and petitions calling for more comprehensive sick time.

Other changes: Amazon has paused all fulfillment center tours, canceled large events, and shifted to virtual job interviews.

Bottom line: High demand is already causing delays for Amazon Prime and Fresh customers, a phenomenon that could be exacerbated by slowed imports or outbreaks of the virus among warehouse workers, who are already fielding high volumes of orders. Experts predict Amazon’s delivery infrastructure “will falter,” Motherboard reports.

However, some predict that Amazon will be one of the companies least impacted by a potential recession despite the disruptions. Analysts with RBC Capital Markets wrote on March 13 that Amazon “will be only modestly impacted” during a global financial crisis, due to growing reliance on the company for consumer staples, and expectations of continued growth in its Amazon Web Services cloud division.

geeky

via GeekWire https://ift.tt/2pQ6rtD

March 16, 2020 at 01:35PM