Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How come all of wordpress files not uploaded in EFS? #19

Open
wobeng opened this issue Feb 20, 2018 · 22 comments
Open

How come all of wordpress files not uploaded in EFS? #19

wobeng opened this issue Feb 20, 2018 · 22 comments

Comments

@wobeng
Copy link

wobeng commented Feb 20, 2018

Hi,

How come all of WordPress files not uploaded on EFS? This will make updating wordpress much easier.

@mwunderl
Copy link
Contributor

Hi Welby,

I think that could work if you copy all of the WordPress files onto the file system during deployment and use the document_root option serve the mounted directory. You would need a script to manage the copy operation and avoid overwriting the files after installation.

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

Can you elaborate on "You would need a script to manage the copy operation and avoid overwriting the files after installation"

Also this would mean I can just update the files on EFS and have it instantly change on all the servers right? (I don't have to go through eb deploy)

@oadam
Copy link

oadam commented Feb 20, 2018

I agree with @wobeng that things would be easier if the setup was just a php beanstalk environment with document root pointing to an EFS folder. Plugins could be installed and updated through the UI without any redeployment.

I've googled a lot and nobody seems to be doing this. Do you know why ? Is it only for performance reasons or would it cause stability issues ?

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

I'm going to test this out with OPcache to see how well it works

@mwunderl
Copy link
Contributor

After the mount script, you could have another script copy the WordPress files onto the mounted file system. You only want to do this once, but the script will run every time an instance is added to your environment by AutoScaling, or if you upgrade to a newer Beanstalk platform version. Please try it and post your findings!

@oadam
Copy link

oadam commented Feb 20, 2018

@mwunderl not sure if we are all on the same line. In our scenario there would be nothing to copy because the whole wordpress install will be in EFS.
As long as the mount is done the machine should be ready to go, no ?

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

@oadam that's exactly what I was going to ask.

@mwunderl
Copy link
Contributor

How would you get the WordPress files onto EFS?

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

@mwunderl I was thinking of updating EFS separately from ELB. This way if I update my EFS, all my servers are updated instantly

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

github --> codebuild --> mount efs --> upload/update files

All elb servers updated.

@oadam
Copy link

oadam commented Feb 20, 2018

@mwunderl my setup would be mounting the EFS on my personal machine, unzip a fresh wordpress in it, and launch the environment using the EFS volume as the webroot.
Still it puzzles me a lot that all wordpress tutorials are using EFS/NFS only for the wp-upload folder. There must be a good reason but I haven't found it yet.

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

@oadam there might a lag maybe..that's why I suggested OPcache

@mwunderl
Copy link
Contributor

The benefit of the current design is portability and ease of setup. Everything runs through Beanstalk environment creation and deployment. I would like to see an alternate version where the EFS file system is independent (see 15) as long as the deployment was automated with CloudFormation templates and scripts. Processes that involve mounting shares or SSHing into hosts locally are too fragile.

@mwunderl
Copy link
Contributor

The wp-config.php in this project is modified to use environment variables through Beanstalk for configuration. The mount configuration is built with that and the deployment concerns noted above in mind.

@wobeng
Copy link
Author

wobeng commented Feb 20, 2018

The flaw with the current setup is not being able to install a plugin or update WordPress via admin panel. so it's easy to setup for hard to maintain.

Mounting EFS local for development and mounting EFS as web root in ELB seems to be the best option.

@ITmaze
Copy link

ITmaze commented Feb 20, 2018 via email

@wywarren
Copy link

I have a system setup now with a zipped wordpress installation saved on EFS and unzipping it to a new folder with it being mounted on an EC2 is incredibly slow. Copying an existing folder is also incredibly slow. With my basic setup and around 20 plugins, it takes about 10-15 minutes to do this vs ~5s on my EBS. I recently mounted an efs to my apache folder and have redirected the root to use efs. Page loading is fine, but deploying new installs with my current method as well as updating plugins are incredibly slow. I'm thinking of either pregenerating and caching these unused installations in my setup, or a way to have the wordpress install (with plugins) sit on my EBS2 on the EC2 and then run the wp-configs off of EFS. I'm open to new ideas, but the inability to spawn multiple wordpress installations in a fast manner seems like a big downer. Other tutorials have suggested preloading your EFS with a large file to shift it into the next tier for better IO but it seems like a hack implementation and you still won't get anywhere near the speed of EBS.

@ihmc3jn09hk
Copy link

ihmc3jn09hk commented Feb 9, 2019

Could you share the way your whole setup is? I have migrated a WP site (similar to urs, ~20 plugins) from a standalone server to AWS. Current architecture is a Nginx+Php-fpm+MySQL individual instance setup and mounted with EFS. All WP files are put on the EFS. The old server is a 2vCPUs-2GB Ram SSD machine while now I have 3 t2.micro instances + 1 EFS. The initial thought expects page loading should be much faster, yet it's terribly slow. DOM load time of the old server and AWS setup are ~4s and ~20s. I know there will be some overhead for communication using individual instances v.s. all-in-one server. Furthermore, the WP files are now at a network drive, the EFS, which introduces even more overhead. But such loading time could never be acceptable. I tried the Beanstalk but never success a single deployment even I followed the official BeanStalk for WP example. The BS is incredibly slow and those useless error messages drove me bonkers. This motivated me to use instances directly. However no good result at all.

@JohnCallanan
Copy link

JohnCallanan commented Feb 9, 2019 via email

@wywarren
Copy link

I ended up doing a neat cheat to leverage a setup that uses the best of EFS and the best of EBS to create a hybrid mix.

After crawling through multiple blog posts and articles, it seems EFS as a whole is ~5 times slower in IOPS compared to EBS. In my tests it was much slower than that. The only recommended cheat from the readings were to stuff oversized large files into the EFS to bump up its tier to allow for higher IOPS. Also, at the end of the day, EFS's concurrent access capabilities are more expensive than EBS storage.

So if you're running a single website, that requires high availability, putting all the core wp files onto the EFS is an OK approach. Although plugin updates and other IO will be a bit slower, all changes can be done once and propagated across all EC2 instances.

In our case we're running multiple sites that require high availability and require better/scalable maintenance. We started by looking at how Wordpress Multisites are setup. We took a sample installation and modified the provided htaccess file and used that for our server.

In this setup we begin by installing https://wordpress.org/plugins/amazon-s3-and-cloudfront/. It offloads all the image files onto S3. With this all we have sitting on the EBS is the single wordpress folder (with all the plugins). The wp-config.php on the EBS refers to different wp-config.php sitting on the EFS depending on the url path for each site. The EFS wp-config.php's refer to different database connections which determine which plugins in the folder are activated or not. If there are any future updates, we would end up just updating one EBS and creating a new image from it and then destroying and recreating them behind the load balancer. The amount of overhead storage on the EBS becomes significantly lower as it only contains one wordpress folder as a base and no media files.

You could technically do custom routing for certain url paths to store test environments on certain EBS volumes as well and roll them over to production that way, but I'm still looking into more effective ways to do this.

The downside (if you want to call it that), is that all sites have the same set of plugins installed although they can be selectively activated for each site.

@ihmc3jn09hk
Copy link

For anyone interested, to save your time, I have confirmed the major overhead is at the EFS junction, legit!

@gizmogaurav
Copy link

I have set a new wordpress account on was with Fargate, EFS, Aurora My SQL using cloud formation. Now as an Infra set up all the components are in place. But let's say different developers work on different parts of WP like plugins/themes etc now we want to push that folder onto EFS via git repository. I am not sure what should be the correct way of deployment I don't want to run my stack again for WordPress image /efs/rds to setup again. There should be a proper way to upload those into EFS.

I have one approach in mine, but not sure if it is the correct one. I can zip my plugins and themes folder and send it to S3 bucket through Jenkins. and then use Aws data sync to copy data to the efs directory.

Can someone guide me in the right direction or what should be the correct approach . . ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants