Recently Browsing 0 members
No registered users viewing this page.
By Lex Sanchez
I do not know if someone before using ProcessWire with AWS CloudFront, currently I have problems with the login, it does not work for any reason, when I check in the logs generated by ProcessWire, it only indicates This request was aborted because it appears to be forged. (in /wire/core/SessionCSRF.php line 190).
I have allowed CloudFront to forward all headers, cookies and allow all methods (GET, POST, PUT).
When I perform the same process from the ip server if it works or from the balancer.
Has anyone successfully installed Processwire on an Amazon EC2 instance/virtual server?
Which configuration works; Amazon Linux or one of the other flavors?
How do you get file permissions and the database working?
Which lines in .htaccess cause problems on Amazon AWS?
What are the pitfalls to watch out for?
Why can't I get it working...?
The first problem I run into is an error message that the installer doesn't have write access and that I should manually rename the 'site-myprofile' folder to 'site'. Attempt to chmod all the files and folders to 777 don't seem to have any effect on that and some files do get written fine.
But I keep ending up with inaccessable pages and fatal server errors. I am not asking you to solve my problem. I am curious what other people's experiences are with this. Can it be done or am I wasting my time?
The module extends the default FieldtypeFile and InputfieldFile modules and adds few extra methods.
For the most part it behaves just like the default files modules, the biggest difference is how you get the file's url. Instead of using $page->fieldname->eq(0)->url you use $page->fieldname->eq(0)->s3url(). Files are not stored locally, they are deleted when the page is saved, if page saving is ommited the file remains on the local server until the page is saved. Another difference is the file size, the default module get the file size directly from the local file, while here it's stored in the database.
There is an option to store the files locally, its intented in case one wants to stop using S3 and change back to local storage. What it does is it changes the s3url() method to serve files from local server instead of S3, disables uploading to S3 and disables local file deletion on page save. It does not tranfer files from S3 to local server, that can be done with the aws-cli's through the sync function. Files stored on S3 have the same structure as they would have on the local server.
Been struggling with this for quite a while, but i think i finally managed to make it work/behave the way i wanted.
All feedback is welcome!
I am trying to use Amazon S3 to store video files for a client. I am having trouble getting the SDK to work. I am sure it is a stupid error on my part but my head is sore from banging it against my desk and I thought I would finally ask for some help.
I am running PW 3.0.11 on NGINX.
1. Amazon recommends using Composer to install the SDK. I was not sure where in the path to install the SDK so I put composer in the /site folder and installed the SDK there (putting vendor at the same level as modules), then I put the require and uses statements in _init.php. I always got an error saying it could not load the aws or s3 classes from the library.
2. So, then I tried to use aws.phar. I put that in the /site directory but once again, no matter what I do, it will not load with the following error:
require(): Failed opening required '/site/aws.phar'
The file is there with proper permissions and the code for loading is:
// --- amazon S3 stuff require $config->urls->site . 'aws.phar'; $s3 = new Aws\S3\S3Client([ 'version' => 'latest', 'region' => 'us-standard', ]); So, here are my questions:
1. In general, where is the correct place to put a php library? It is not a PW module so I assume it should not go in the modules folder.
2. Should I use Composer to install the SDK? If so, where do I put the files? Should I add the AWS SDK to the main composer.json file or put it somewhere else?
3. If I don't use Composer, where do I put the aws.phar file so that PW can load it?
4. Should I not put the 'require' in the _init.php file and move it to another file (_func.php)?
I am sure there is a massive face-palm in my future when this gets sorted out.