Deploy Laravel 5 applications on AWS Elastic Beanstalk
![Generate app key for laravel elastic beanstalk free Generate app key for laravel elastic beanstalk free](/uploads/1/2/6/1/126139535/919561445.jpg)
Jul 29, 2017 First, login into your AWS and navigate to Elastic Beanstalk service dashboard clicking Services in the upper left corner. Click on the Create New Application in the right side. Fill the application name, e.g. Lavue-on-aws (we will use this name through the article because it sounds nice) and click on Create. Every application in EB requires at least one environment. Feb 07, 2017 Scaling Laravel Using AWS Elastic Beanstalk Part 3: Setting up Elastic Beanstalk In my last article we set up the supporting services we would require for our Laravel app once we deploy it to the Elastic Beanstalk architecture. Hot on the heels of my Laravel on AWS Elastic Beanstalk Dev Guide (i.e., 2.5 years later), I’m happy to publish my Laravel 5 on AWS Elastic Beanstalk Production Guide! So let’s dive right into it. Background There have been a lot of changes with Laravel and with Elastic Beanstalk since my Dev Guide in.
gistfile1.sh
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk. |
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config) |
# -------------------------------- Commands ------------------------------------ |
# Use 'commands' key to execute commands on the EC2 instance. The commands are |
# processed in alphabetical order by name, and they run before the application |
# and web server are set up and the application version file is extracted. |
# ------------------------------------------------------------------------------ |
commands: |
01updateComposer: |
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update |
option_settings: |
- namespace: aws:elasticbeanstalk:application:environment |
option_name: COMPOSER_HOME |
value: /root |
- namespace: aws:elasticbeanstalk:container:php:phpini |
option_name: document_root |
value: /public |
- namespace: aws:elasticbeanstalk:container:php:phpini |
option_name: memory_limit |
value: 512M |
# Create RDS database, requires adding env variables. |
# Resources: |
# AWSEBRDSDatabase: |
# Type: AWS::RDS::DBInstance |
# Properties: |
# AllocatedStorage: 5 |
# DBInstanceClass: db.t1.micro |
# DBName: #insert db name |
# Engine: mysql |
# EngineVersion: 5.6 |
# MasterUsername: #insert name |
# MasterUserPassword: #insert pass |
# ---------------------------- Container Commands ------------------------------ |
# You can use the container_commands key to execute commands for your container. |
# The commands in container_commands are processed in alphabetical order by |
# name. They run after the application and web server have been set up and the |
# application version file has been extracted, but before the application |
# version is deployed. They also have access to environment variables such as |
# your AWS security credentials. Additionally, you can use leader_only. One |
# instance is chosen to be the leader in an Auto Scaling group. If the |
# leader_only value is set to true, the command runs only on the instance |
# that is marked as the leader. |
# |
# Artisan commands include environment flag for production. If you are not |
# deploying to a production environment, update the flag. |
# ------------------------------------------------------------------------------ |
container_commands: |
01express: |
command: 'echo AWS Container Commands started, starting Composer install.' |
02installComposer: |
command: 'php /opt/elasticbeanstalk/support/composer.phar install' |
cwd: '/var/app/ondeck' |
03express: |
command: 'echo Composer install completed, starting Laravel migration' |
04migrations: |
command: 'php artisan migrate --env=production' |
cwd: '/var/app/ondeck' |
05express: |
command: 'echo Completed Laravel migration, starting Laravel database seeding' |
06seeds: |
command: 'php artisan db:seed --env=production' |
cwd: '/var/app/ondeck' |
leader_only: true |
07express: |
command: 'echo Completed database seeting, Container Commands complete.' |
commented Apr 19, 2019
You rock |
![Beanstalk Beanstalk](/uploads/1/2/6/1/126139535/529836003.png)
Laravel App Function
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment