This repository contains recipes to provision and deploy OpsWorks stacks with Laravel 5+.
You'll need to create an OpsWorks stack that uses Ubuntu 14.04 LTS, as the recipes in this repository are designed to work with that OS.
When creating a stack, indicate that you want to use custom Chef cookbooks, with a repository type of Git and a repository URL of https://github.com/portaremedia/laravel-opsworks
(or your own repository URL if you decide to fork this one). You will not need an SSH key if the repository is public (like this one). The other settings for the stack you may set as you please.
You'll need to add the following recipes to the PHP App Server layer so that it can operate a Laravel installation.
In the setup stage, add the php::mcrypt_enable
recipe. This will enable the PHP Mcrypt extension which is required by Laravel.
In the deploy stage, add the following recipes.
-
laravel::environment_variables
This recipe will populate your.env
file with the database configuration of your OpsWorks data store (whether it be a database instance or RDS instance). It will also take the custom environment variables from your app configuration and place them into your.env
file. -
laravel::symlink_storage
This will move thestorage
directory into a shared directory so that it can be used by each release of your app. For example, if you're storing cache/sessions or other application data in the storage folder it can be used by the next release after a deployment (so it won't force your users to re-authenticate or the app to re-build the cache). -
laravel::storage_permissions
This will make sure that the storage permissions are set properly on storage/app storage/framework storage/logs bootstrap/cache. -
laravel::migrations
Allows the first instance of your stack to run a migration. -
composer::install
This will install Composer and then the dependencies of your application for the given release, without the development dependencies.
Set all of the environment variables for Laravel such as APP_KEY, DB_USERNAME, DB_PASSWORD, etc.
opsworks-agent-cli get_json