Issue: Export fails immediately
Hi Leon,
I'm running WordPress in a Docker container locally.
PHP version 8.0.10 Wordpress: latest upload_max_filesize set to 500M max_execution_time set to 36000
Downloaded WP2Static source from GitHub and built OK Downloaded WP2Static add on and build OK
Wordpress installed and runs on localhost:8000 (default theme at this point)
install WP2Static and WP2Static S3 addon via Add New PlugIn and uploads the zip files - both activated
Add S3 credentials and bin settings to the addon.
Click on Run/Generate Static site
Error returns immediately error code 500 - message about increasing max_execution_time
Looking at the network tab on Chrome developer tools, there's no other errors except for the admin-ajax.php call with Form Data: action: wp2static_run
Any ideas?
Many thanks
Hi @SChubb,
This is a common issue when using certain Docker configurations.
WP2Static attempts to crawl your site using the WP defined Site URL.
In a Docker setup, where Docker is exposing a port to the host, such as 8000 in your case, but the container's webserver serves at 80, WP2Static runs on the container and is attempting to crawl http://localhost:8000 (the WP site URL), but there is no webserver running on the container at 8000, only 80.
Editing the config per Docker guest to serve at the same port as is exposed to the host will fix this, but may be impractical, depending on your workflow.
My Lokl project makes this easier, allowing to quickly run multiple local WP sites optimised for static publishing on your local computer.
Please explore adjusting your current Docker setup or trying Lokl and letting me know if you find a suitable solution.
I'll leave this open to try and provide better error messaging in this case.
Hi @leonstafford,
Thanks for the response - couple of questions if that's OK?
So, to test things are working properly, I have WordPress running locally (not in a Docker container) via the WAMP stack - with a basic theme running. Site is available under localhost/mysite and can browse to it happily enough.
I've added in the WP2Static and WP2Static-S3-addon plugins and configured the S3 plugin with credentials that I've verified have upload rights to the named S3 bucket.
There's a couple of blank fields in the settings S3 settings - (profile, path prefix and all Cloudfront settings) - I'm assuming region would be in the form of eu-west-1? Sorry but the link to the docs https://wp2static.com/addons/s3/ is a 404.
Now, running WP2Static generates the following log:
2021-09-10 10:12:53: S3 Addon deploying 2021-09-10 10:12:53: Starting deployment 2021-09-10 10:12:53: Post-processing completed 2021-09-10 10:12:53: Finished processing crawled site. 2021-09-10 10:12:16: Processing crawled site. 2021-09-10 10:12:16: Starting post-processing 2021-09-10 10:12:16: Crawling completed 2021-09-10 10:12:16: Crawling complete. 4 crawled, 2354 skipped (cached). 2021-09-10 10:11:57: 404 for URL /robots.txt 2021-09-10 10:11:53: 404 for URL /favicon.ico 2021-09-10 10:11:38: Using CrawlCache. 2021-09-10 10:11:38: Starting to crawl detected URLs. 2021-09-10 10:11:38: Starting crawling
When it hits the S3 deploying line, it throws the error about error code 500 - message about increasing max_execution_time - even though when looking at the Diagnostics page, it confirms PHP execution time is unlimited.
Any ideas?
Hi @SChubb,
Couple of things come to mind:
- it shows most files not crawled due to caching. If there are files in the
wp-content/uploads/wp2static-processed-sitedir after a failure, you can be sure it got that far at least. If nothing in there, try WP2Static > Caches > Delete all caches, to confirm if site is actually being crawled. - the check max_execution_time message isn't great, it's suggested as a common issue on some hosting, but it can be misleading when an unrelated issue. We'll improve that
- WAMP for this plugin is much less reliable than any Linux/UNIX/BSD based hosting. I can't recall if WAMP uses Windows filepaths or UNIX filepaths (
C:\dirvs/dir). If it uses Windows ones, I'd try a different local hosting environment that does use UNIX file paths - if you can get the processed site to generate OK, then you could try the ZIP deployment addon and use the AWS CLI tools to deploy the generated static site. That's often helpful, just to get your first deploy done all the way through, then can come back and figure out any issues with deploying to S3 directly from the plugin
Not sure if the above will sort things out for you, please let me know if they don't and we'll try some other things.
Cheers,
Leon
Hi @SChubb,
This is a common issue when using certain Docker configurations.
WP2Static attempts to crawl your site using the WP defined Site URL.
In a Docker setup, where Docker is exposing a port to the host, such as
8000in your case, but the container's webserver serves at80, WP2Static runs on the container and is attempting to crawlhttp://localhost:8000(the WP site URL), but there is no webserver running on the container at8000, only80.Editing the config per Docker guest to serve at the same port as is exposed to the host will fix this, but may be impractical, depending on your workflow.
My Lokl project makes this easier, allowing to quickly run multiple local WP sites optimised for static publishing on your local computer.
Please explore adjusting your current Docker setup or trying Lokl and letting me know if you find a suitable solution.
I'll leave this open to try and provide better error messaging in this case.
Is there a way to expose the correct port via docker-composer yaml file?