Giter VIP home page Giter VIP logo

aws-codedeploy-bitbucket-laravel's Introduction

Laravel CI\CD using AWS RDS EC2 S3 CodeDeploy BitBucket and Bash

Author Emad Zaamout | [email protected]

Laravel Deployment Automation. Using:

  • AWS EC2 Instance – to host our production server (optional + staging)
  • AWS RDS Instance – to run MySQL 8 Server for our Laravel project
  • AWS S3 Bucket – to store our revisions
  • AWS CodeDeploy – to run deployments
  • AWS Server Manager – to store and populate our .env file
  • Bitbucket – to store our code repository and run pipelines
  • Bash – to create our scripts

Code Files Youtube Tutorial Video Blog Github Bitbucket

Complete CI\CD Pipelines.

Make sure to include the following repository variables inside your Bitbucket repository. They are used by the scripts.

  • AWS_SECRET_ACCESS_KEY: AWS IAM User Security Credentials secret access key.
  • AWS_ACCESS_ID: AWS IAM User Security Credentials access key id.
  • AWS_DEFAULT_REGION: Your AWS Resources region. I.e. ca-central-1
  • DEPLOYMENT_GROUP_NAME: CodeDeploy, Application Deployment Group Name.
  • S3_BUCKET: S3 Bucket name.

./devops/hooks/after-install.sh Once CodeDeploy agent is installed onto your server and a deploy action is triggered; CodeDeploy triggers hooks that allow you to run scripts on your server during certain events. Supported events are: ** ApplicationStop, DownloadBundle, BeforeInstall, Install, AfterInstall, ApplicationStart, ValidateService.** Used inside inside ./appspec.yml. This script runs inside our server after our application is installed. We change user owner to ubuntu & fix storage permission issues, run composer install and load our env file from AWS Systems Manager.

devops/scripts/generate-env.sh Runs inside bitbucket-pipelines.yml. Creates a tar bundle for our project and stores it in AWS S3 Bucket. Then creates a new deployment using AWS CodeDeploy. The files are listed inside the bundle.conf file.

devops/build-for-production.sh Used inside bitbucket-pipelines.yml. Builds Laravel App for production. Different than testing.

devops/build-project.sh Used inside Bitbucket pipelines. Builds Laravel project and prepares it for testing. Creates an .env file from .env.pipelines.

devops/build-server.sh Used inside bitbucket-pipelines.yml. Builds server for testing stage.

devops/deploy-production.sh Used inside bitbucket-pipelines.yml. Creates a tar bundle for our project and stores it in AWS S3 Bucket. Then creates a new deployment using AWS CodeDeploy. The files are listed inside the bundle.conf file.

devops/run-tests.sh

.env.pipelines Runs inside your production server on new deployment. loads your .env file stored inside AWS Systems Manager (Paramater).

bitbucket-pipelines.yml Runs inside Bitbucket. Triggers Bitbucket pipelines per your specification.

appspec.yml Runs inside your production server on deployment. Add this to give CodeDeploy instructions.

bundle.conf Lists all files or directories that you want to include in the bundle.tar file that we will create and and store inside S3. Used for deployment..

devops/scripts/build-production-server.sh Not used anywhere. Just helps install all what you need on your production server to run a basic laravel project. Run manually.

devops/scripts/configure-apache.sh Not used anywhere. Just helps you set up apache2 conf, disable default site and enable new site. Change variables.

aws-codedeploy-bitbucket-laravel's People

Contributors

dependabot[bot] avatar emad-zaamout avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.