Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 29, 2022 07:14 am GMT

Deploy a PHP(Laravel) app on AWS Elastic Beanstalk via Codepipeline

In this tutorial I will explain you to deploy a PHP laravel application on AWS Elastic Beanstalk service.
About : Amazon Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.
Working: You simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, and automatic scaling to web application health monitoring, with ongoing fully managed patch and security updates.

Step-1) Create a Beanstalk Environment and APP

  • Select environment as web server environment Image1
  • Create the Application and Environment name:Image 2
  • Choose the Platform on which you want to deploy your app.Here We will choose PHP for our laravel project.Image 3
  • The next step is to upload the code(for now we will go with sample code as we will push the original code in the next version with the code pipeline.)Image 4
  • Click on create and let the enviornment get created.Image 5Finally It will show something like thisImage 6And when you click the APP url like this http://laravelapp-env.eba-muin3rqg.us-east-2.elasticbeanstalk.com/ it will open your app with sample code.Image 7

Step-2) Create the codePipeline

Go to searchbar, type codepipeline and click create codepipeline
Image 8

  • Now Add the source stage, connect to your version control system(like Github here) and select the repository(laraval-demo) and branch(dev)Image 9
  • Check the Start the pipeline on source code change to automatically starts your pipeline when a change occurs in the source code.
    Image 10

  • Skip the Build stage for now. Add Deployment stage (Pipelines must have at least two stages. Your second stage must be either a build or deployment stage.)
    Choose Elastic Beanstalk at the place of Deployment Provider, application name and environment name.
    Image 23
    Click Next and Review all the steps and cofiguration.
    Finally Click on Create Pipeline
    Image 23

  • After Pipeline is succesfull create and deployed it will look something like this:
    Image 24

  • Now Go to Beanstalk enviornment dashboard and open the application version you will found out that the latest version deployed is via codepipeline
    Image 26

  • See the health of our app as OK
    Image 44

  • Click on Beanstalk App URL like http://laravelapp-env.eba-muin3rqg.us-east-2.elasticbeanstalk.com/ to see our deployed laravel app.
    Image 54

Summary:

The CodePipeline wil trigger whenever we will push the changes into the git. Hence it is our Continuous integration pipeline.


Original Link: https://dev.to/tanmaygi/deploy-a-phplaravel-app-on-aws-elastic-beanstalk-via-codepipeline-934

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To