ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Setting up load balanced environment

December 14, 2011 12:22pm

Subscribe [6]
  • #1 / Dec 14, 2011 12:22pm

    AirWatch

    26 posts

    Hello,

    We have licensed and are working with ExpressionEngine 2.3.1, and are in design/development phases to replace a static HTML site. We’re looking for the best way to configure our system.

    Currently, our site runs on two dedicated servers with a load balancer (it gets a few thousand visits per day), and has a staging server.

    We will expand this to two dedicated servers, a dedicated MySQL server, the load balancer, and the staging server (all WAMP environments), but we do have some questions on this approach:

    1. Where does ExpressionEngine itself actually get installed? On both production servers, or on the load balancer, or…?
    2. We’ll have several users who are able to upload files via ExpressionEngine. How can we ensure that these files are present on both servers when they get uploaded, so users who view the site are able to see all images, PDFs, etc.?

    I’m hoping to hear any examples of how this can be done, best practices for doing it, issues we’ll run into, etc.

    Thanks,
    Jonathan

  • #2 / Dec 15, 2011 2:21pm

    Focus Lab Dev Team

    1129 posts

    Hey Jonathan,

    I don’t know about the multiple production environments / load balancer side of the question. I can tell you though that for the staging environment and production workflow you’ll want a dynamic path configuration setup. This won’t answer all of your questions but might get you going:

    https://github.com/focuslabllc/ee-master-config

  • #3 / Dec 15, 2011 2:39pm

    Eric Barnes

    487 posts

    We currently have a custom CodeIgniter cms that pretty much has this exact setup.  So I will outline how we do it to hopefully give you some ideas.

    We are running AWS with an RDS and two instances behind a load balancer with auto scaling. So based on load new instances can be brought up or removed as needed. The way AWS works is if an instance is terminated it is gone forever. So I had to be careful what is on the server and ensure nothing is on it that I can’t afford to loose.

    #1 - On each instance we have a base install of the cms and the site files. All of these are stored in a git repo so if a new server is brought up everything will be up to date with an automated git pull.

    #2. - The tricky part is photos and uploaded assets. For this everything is processed on the server then immediately pushed to S3. The front end only displays s3 links so both are always in sync. However the problem with this is when you later need to alter an image. (cropping, resizing, etc).  Since the image might not exist on a given instance we use curl to download it from s3, make our changes, then push it back.

    Now comes the fun part and that is deployments. What I decided with the advice of some friends (gaker) 😛 is to use python with fabric and boto to have a deployment script that will ssh in to each running instance, perform a git pull, then push s3 assets (css, js) to a timestamped folder, and finally update the db with the new timestamp. Since you are going to have dedicated servers you could probably use something like beanstalkapp for that. Since you will always know that you have two servers.

    I hope this helps and makes sense 😊

  • #4 / Dec 15, 2011 3:47pm

    Kevin Smith

    4784 posts

    Great answers from Erik and Eric! Thanks guys.

    Jonathan, we’re not actually set up to support questions on hosting environments and server setups, but it does look like you’re getting some help from the community on this one. Would you like for me to move this thread over to the Community Help forum so you can continue your discussion?

  • #5 / Dec 15, 2011 4:21pm

    AirWatch

    26 posts

    Many thanks for the answers, here. I’m hoping we’ll be able to do something like the AWS solution Eric mentions, but we don’t have a CDN at this point.

    But sure, Kevin, you can move to the Community Help forum if necessary. I’d love to hear any additional insights.

    Thanks,
    Jonathan

  • #6 / Dec 16, 2011 5:03am

    Pv Ledoux

    95 posts

    Hi Jonathan,

    I’m currently working to deploy that kind of configuration:

    - 2 (or more servers, depending the # of requests/min) application servers running ExpressionEngine (NginX)
    - 2 Mysql DB Servers (master-master replication)
    - 2 Memcache servers

    As we are hosted on Rackspace Cloud, it’s relatively easy to start a load balanced project. They help us to startup the project, vps, etc. We use their CDN to store the uploaded files.

    We deploy with git and cssh (maybe I will try Capistrano later).

    Best regards,

    Pv

  • #7 / Dec 16, 2011 12:52pm

    trif3cta

    148 posts

    Capistrano with the Railsless Deploy Gem works great for PHP apps. Using Git, some clever symlinking and Rsync you should be able to keep uploaded assets between environments/boxes work. Using a standalone domain, bucket or CDN to serve assets is a smart idea too.

    Fabric is really cool too, but you don’t get as much out of the box as Cap (if memory serves Fabric was written in response to Capistrano).

    If you’re already wicked in Bash or Perl, you may as well go that route. If you’re totally sadistic you could try Phing.

    The multi-server config from Erik and others is a must.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases