Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.
/ laravel-sail-ecs Public archive

A boilerplate for Laravel application using Laravel Sail ⛵️ for local development and AWS ECS for production.

Notifications You must be signed in to change notification settings

tvqqq/laravel-sail-ecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-sail-ecs

Local development (Sail)

ENV configuration

  1. Update the Local port in .env.

  2. Enable XDebug.

  • Set SAIL_XDEBUG=true
  • Run sail build --no-cache
  • Check sail php -v

Expose the URL to Internet

  1. Just need HTTP: sail share (30 mins).

  2. HTTPS: use ngrok http --region=ap 81 (120 mins and ngrok makes life much easier).

Command line

  1. Open .zshrc, add alias sail="./vendor/bin/sail".

  2. Replace php by sail, eg: sail artisan queue:work.

Production (ECS)

  1. Create an IAM user with Policy:
  • AmazonEC2ContainerRegistryFullAccess
  • AmazonECS_FullAccess
  1. Add AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY into Github repository > Settings > Secrets.

  2. Create a bucket via AWS console and upload your production .env file.

    NOTE: file name must be your-app-name.env, eg: laravel-sail-ecs.env.

  3. Copy cfn_parameters.example.json to cfn_parameters.json. Update your own parameters in cfn_parameters.json then create stack from cloudformation.yml.

    NOTE: keep ServiceTaskDesiredCount = 0 as initial.

    aws cloudformation create-stack \
    --stack-name laravel-sail-ecs \
    --template-body file://cloudformation.yml \
    --parameters file://cfn_parameters.json \
    --capabilities CAPABILITY_NAMED_IAM
    
  4. Push your code to branch main.

  5. Change ServiceTaskDesiredCount = 0 into ServiceTaskDesiredCount = 1 in file cfn_parameters.json.

  6. Run this command to update-stack on CloudFormation.

    aws cloudformation update-stack \
    --stack-name laravel-sail-ecs \
    --template-body file://cloudformation.yml \
    --parameters file://cfn_parameters.json \
    --capabilities CAPABILITY_NAMED_IAM
    

About

A boilerplate for Laravel application using Laravel Sail ⛵️ for local development and AWS ECS for production.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published