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

squibby's avatar

How to start out with automated scripted deployment? Help

Hi,

I have been working on a large Laravel project which is deployed via AWS. It currently has multiple EC2, load balancers, VPC, s3 and more as part of my deployment process. My deployments are all manual at the moment which can be time consuming as there are multiple 3rd party services and apis which all need to be connected also.

I want and need to be able to automate all of this as I will be deploying multiple instances of the project as required. So....

What is the best way to automate / speed up my deployment process? I am looking for some general advice here. Or some links to some places I can investigate. I am capable of creating complex laravel applications but the automated deployment side of things is where I am not yet educated.

I have seen but don't fully understand - docker, aws cloud formations, ansible and other but not sure which direction to go or this is what is suitable.

My ultimate goal is to be able to build a small laravel app which can be used to trigger the deployment / scripts which auto build my infrastructure and set up environment the same each time.

If anyone has some advice i would be most appreciative. Many Thanks.

0 likes
4 replies
markotitel's avatar

Hi,

Have you manually setup load balancing and EC2 instances, or do you use ElasticBeansTalk? If you will use AWS then I would suggest ElasticBeanstalk as your applilcation manager.

Regarding "general" scaled Laravel setup,

Assets and storage should be shared. ( That I assume you are aware ) CI/CD workflow basically consists of getting the code packed and pushed to the servers.

Lets say you have fixed number of servers behind loadbalancer.

Setup a cronjob that will check your GIT repo and pull the changes, do the necessary commands like composer npm artisan and any other specific to your project.

That is basic approach which works well.

Now if you have dynamic scaling, then you could do the same approach just add needed commands in startup script cloud-init.

You should store your variables somewhere for the servers to fetch them.

One approach is to use ready made tools liek Gitlab CI/CD pipelines.

I would not go to Docker as a solution just because it is "modern" and is hyped everywhere. Depends on your needs but you will not gain anything with simply deciding to go with docker until you grasp of your entire automation workflow.

CloudFormation is a templating language which provisions AWS services.

ElasticBeansTalk is a free tool which provisions CloudFormation script and sets everything for you. Afterwards, you simply upload ZIP archive of your application and it automagically deploys to all instances. It also takes care of autoscaling for you.

If you will use AWS go for ElasticBeansTalk.

I am using it for bunch of PHP Laravel apps.

squibby's avatar

Thanks for your info.

Currently I am setting everything up manually. Then for my Ec2 I am provisioning with a custom server provisioning script via Laravel forge. Laravel forge also handles the code deployments, queues, cron and everything else.

From what I have looked at, elastic beanstalk wont work with forge unless Im mistaken. I have spent a few days playing around with aws cloud formations, I think I should be able to script out the architecture exactly as I set it out manually using formations. It is pretty complex though so will take me a while to get my head around all the settings.

If that goes to plan, I will then look at perhaps using forge apis, to hook into the ec2s and provision etc.

Question about beanstalk though.. If using beanstalk do you stull have access to all the underlying servers, rds etc or is it all contained in 1. Beanstalk sounds like a nice solution but i'm not sure how I could make it work with my current setup.

markotitel's avatar

Have you mentioned Forge in your original question?

Is Forge ultimate tool for you?

Forge does not handle Cron, queues.

ElasticBeansTalk is management tool, not a service.

I am not sure how you are not sure that ElasticBeanstalk cannot work with your current setup.

Please or to participate in this conversation.