Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Greeenone's avatar

Ease way to manage deploy

Hello everyone,

Some time ago I deployed my first Laravel app (as an API backend) on AWS. I used for that S3 bucket, EC2, CloudFront, Route53 and CodeDeploy. It took for me a lot of time (also fixing issues with CORS etc). Everything is also connected with Bitbucket pipelines, and after merge to staging or master it automatically deploys a new version.

I feel that I don’t really have control on that, and I don’t understand some stuff that I did (Like EC2 configuration).

Now, I’m creating a new internal app and I’m looking for an easier way to deploy laravel (Also only as a backend). I know that an easier way exists to deploy Laravel. I heard about Lambda, and some websites that are doing autodeploy. Someone can guide me a little bit? Should I use AWS Lambda, or something else?

I don’t really want to focus on devops and infra stuff

I will be glad for any help :)

Edit: I see that my AI friend from Laracast added some sugestions. I will try it, but if someone have others ideas or services, I will be (again) glad :)

0 likes
2 replies
LaryAI's avatar
Level 58

Certainly! Deploying a Laravel application can be simplified using various tools and services that abstract away much of the DevOps complexity. Here are a few options you can consider:

1. Laravel Vapor

Laravel Vapor is a serverless deployment platform for Laravel, powered by AWS Lambda. It abstracts away much of the infrastructure management and allows you to deploy your Laravel applications with ease.

Steps to Deploy with Laravel Vapor:

  1. Install Laravel Vapor CLI:

    composer global require laravel/vapor-cli
    
  2. Login to Vapor:

    vapor login
    
  3. Initialize Vapor in your project:

    vapor init
    
  4. Configure your vapor.yml file:

    id: 1
    name: your-project-name
    
    environments:
        production:
            memory: 1024
            cli-memory: 512
            timeout: 60
            runtime: php-7.4
            build:
                - 'composer install --no-dev'
                - 'php artisan migrate --force'
    
  5. Deploy your application:

    vapor deploy production
    

2. Forge

Laravel Forge is a server management and deployment service. It allows you to deploy your Laravel applications to various cloud providers like DigitalOcean, Linode, AWS, etc., with minimal configuration.

Steps to Deploy with Laravel Forge:

  1. Sign up for Laravel Forge: Laravel Forge
  2. Connect your server: Follow the instructions to connect your cloud provider and provision a new server.
  3. Deploy your application:
    • Connect your Git repository.
    • Configure your deployment script (Forge provides a default script that works for most Laravel applications).
    • Deploy your application with a single click.

3. Ploi

Ploi is another server management tool similar to Forge. It provides an easy-to-use interface for deploying Laravel applications.

Steps to Deploy with Ploi:

  1. Sign up for Ploi: Ploi
  2. Connect your server: Follow the instructions to connect your cloud provider and provision a new server.
  3. Deploy your application:
    • Connect your Git repository.
    • Configure your deployment script.
    • Deploy your application with a single click.

4. GitHub Actions

If you prefer to stick with AWS and want to automate deployments using GitHub Actions, you can set up a CI/CD pipeline.

Example GitHub Actions Workflow:

name: Deploy Laravel Application

on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '7.4'

    - name: Install dependencies
      run: composer install --no-dev --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts

    - name: Deploy to AWS
      env:
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        AWS_REGION: 'us-east-1'
      run: |
        aws s3 sync . s3://your-bucket-name --exclude ".git/*" --exclude "vendor/*" --exclude ".github/*"
        aws cloudfront create-invalidation --distribution-id your-distribution-id --paths "/*"

Conclusion

Each of these options has its own set of features and benefits. If you want to avoid managing servers and infrastructure, Laravel Vapor is a great choice. If you prefer a more traditional server setup but with easy management, Laravel Forge or Ploi are excellent options. For a more customizable CI/CD pipeline, GitHub Actions can be configured to deploy your application to AWS.

Choose the one that best fits your needs and comfort level with infrastructure management.

puklipo's avatar

Use Forge at first.

TIPS: Don't use Forge's AWS provider. Launch EC2(fresh Ubuntu) manually then use Custom VPS

Please or to participate in this conversation.