Skip to content

Need to Setup Auto-scaling on Laravel Application.

0

I have a client that running their Application on ec2 with the framework of PHP-Laravel.

Now he wants to setup auto-scaling and load-balancer setup in their Application.

in the Basic scenario i got the idea to how to setup auto-scaling:-

  1. Move the img part to s3 bucket
  2. rest of other code in store in ec2 itself. but client Query is that, he need to update the code twice in a month (after every 15 days). Then how to handle this scenario.

Suppose that after the scaling my two instance is running with load-balancer, in that scenario i have 2 Question :-

  1. in which ec2 instance client need to update the code files.
  2. if client update the code files in 1st ec2 then how to sync the files with 2nd ec2.
1 Answer
1

Hello Pritam,

There are a few issues that I see in your setup. Does your client not have source code management established and a CI/CD pipeline? Updating the code in EC2 instance actually defeats the autoscaling as manual intervention is needed.

You should suggest your customer to establish a CI/CD pipeline and establish triggers to push updated code to the servers automatically.

Of course there are options to sync the servers as well, but given that autoscaling will change server IPs it is not practical.

As far as I see it, the right solution is to establish CI/CD to update code.

answered 2 years ago

  • As the CI/CD is only capable when we have connect the server with CI/CD tools.

    for Example as I'm using Jenkins for CI/CD i need to connect my server with Jenkins to perform any execution on my server. but in the auto-scaling server is created automatically then how i add those server in Jenkins or any CI/CD tools to perform the action over there ??

    this is the deadlock situation for me where i actually stuck.

  • Actually tools like Jenkins are not needed for small and simple setup, you can establish a pipeline using scripts as well. I had setup a code update mechanism using shell scripts and cron. You can keep things simple as much as possible. For a small setup, tools only complicate the environments.

  • Hi Good Morning Mukul,

    thanks for your Guidance, but can you please share the script part with me so, i can check if that part can help me on this scenario it's a big help for me !!

    waiting for your reply !!

  • Hello Pritam,

    I have shared the source code on GitHub. Please fork, copy, or otherwise use (responsibly) from my repository. Look for a shell script called mdgitpull.sh and you can tailor it for your own needs.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.