Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Static sites w/ GS - speed & security. "GetSimpler"
#1
Hi everyone,

I really like getsimple - the simple design and file-backed DB approach is much nicer than wordpress.

However, I run my wordpress sites as pre-generated static HTML sites, because 99% of the time my site content doesn't change. The wordpress plugin I use is this one: http://wordpress.org/extend/plugins/really-static/. Since doing this I basically stopped worrying about security updates to Wordpress, because my wordpress admin site isn't exposed to the public. However I'd rather use getsimple than wordpress.

The advantages of doing this are:

a. Faster page serves - static HTML pages are much faster to serve anyway (no processing involved/includes), and can be completely cached in memory for minimum delay via e.g. memlockd or Apache's mod_file_cache. This decrease in page serve time directly impacts Google rank and viewer happiness.

b. Much more security. Hide your 'real' getsimple site from public view and expose only the generated static HTML copy. Static HTML pages are essentially unhackable. Getsimple seems well written, but it is a matter of fact that the software has had vulnerabilities published in the past.

c. Less overhead - apache uses less memory since most of the time PHP isn't running, and

d. Ability to run the client website on a different server from the admin website. e.g. run getsimple locally, autogenerate the whole client site, zip and upload. This means the client-facing site doesn't need PHP installed locally (further security gain). It also means the admin-facing site doesn't need to worry about security updates; it's never exposed to the public (further security gain).

So, hopefully I've convinced you all that this would be an awesome idea (and if you agree, please do help out by flagging this post so that the local coding geniuses spot it!)

Can someone write a getsimple plugin to autogenerate a static site complete with themes? (or can this feature be built into the core distribution? I bet there are heaps of users for whom dynamic page generation is total overkill).

Thanks, and farewell...
The amusing cow...
Reply
#2
Another related point:

MoveableType is another fairly famous CMS that can autogenerate static sites. However, look at this review - it takes 44 minutes on a dedicated private server to generate this guy's blog?

http://urbansemiotic.com/2010/01/22/the-...01-review/

Seems to me that GetSimple's 'keep it simple' approach could pay dividends in this context.
Reply
#3
this sounds like a great idea. I guarantee that we have a couple great developers out there that can create such a plugin. I also guarantee that it won't take 44 minutes.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#4
Thanks for the vote of confidence, Chris :-)

I think the pseudocode would look something like:

0. Specify a base URL from which the static version of your site will be accessed, and whether links in the static site should be relative or absolute.

1. Calculate all possible legitimate URLs that might be accessed from internal links between pages (optionally including e.g. plugins like blog), starting from the front page.

2. Run the PHP code for each of the URLs to make each page and save as .html in an appropriate directory underneath a root directory (static_html) which will be placed at the base URL. Track the mapping between URLs and HTML files.

3. Rewrite the <A> tags in the generated page to map to the correct .html file using the mapping above - optionally as either relative links or absolute links based on the base url.

4. Copy all referenced dependencies (IMG, CSS etc) to the correct place with the static_html folder.

(1) could be done by looking at GS's internal site structure metadata or by traditional web spidering. Metadata is probably the safer option given the risk that plugins may not behave as expected during spidering. On the other hand, spidering is more likely to be able to include content from plugins without further modification.
Reply
#5
Hi, mr. or mrs. cow, ;=)

please tell me what would be the advantages for this small system?

GS is not vulnerable as big content-producers like WP are, it has a clear basis of xml files (which are kind of static as well in my opinion).

What would be advantages? I don't get it and I am curious
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#6
Hi there

Quickly did this system.

It stored the html files in
/plugins/dominion_static_pages/

No auto ftp and stuff yet, but can be added, basically it will just create the html not create a subdir for theme etc it will expect the theme to be where it is, this if you want to run from server it must be same dir structure
also plugins that use its own css etc from its folders will also need there structure.

In short it basically does what you will do if you do a view source and save to file from browser, but it also changes the LINKS for you to point to the generated html file (auto fix that for you).

Just a note, to generate the pages you must click on each page. for each page you click on, it will generate the static page for you

hope it helps
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#7
Connie Wrote:Hi, mr. or mrs. cow, ;=)

please tell me what would be the advantages for this small system?

GS is not vulnerable as big content-producers like WP are, it has a clear basis of xml files (which are kind of static as well in my opinion).

What would be advantages? I don't get it and I am curious

Think he means he can generate the page and remove the admin part totally and just have a plain html page. good if you want to generate a page for a client but dont want to give the whole system so that somebody might bugger it up. Also less overhead for reading the html files each time, just plain file streaming when requests comes in.

Not everybody will use it, but for simple small sites that dont need admin part. This is ideal/preferred sometimes.
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#8
Added entry under plugins

http://get-simple.info/forum/topic/2273/...es-plugin/
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#9
I'd like to discuss the cons and pros of such a scenario, so that I might understand that request better:

1)
I doubt that a small static site will load faster than a small xml site ...

6 HTML files <=> 6 XML files, will there be a noticeable difference?

2)
in such a scenario: admin-area will be gone, plugins will still work?
how to configure image galleries, add images etc.?

3)
how to update pages? Start the old story again, with editing offline and upload ?

4)

the fear that such a system will be "bugged" by the users / clients ...
- we have multi-user-plugin with restricted profiles
- you can place the admin area in some subdirectory so that it is hidden, even to the user/client

All the advantages of ContentManagement will be lost ...
I just see disadvantages in relation to ContentManagement

in case you do not want ContentManagement, why not use a plain HTML-editor and upload?
Just like I did since 1993?
Back to the roots?

so, give me some enlightment, maybe there are really reasons for that and I am just blind ;=)

Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#10
Connie Wrote:I'd like to discuss the cons and pros of such a scenario, so that I might understand that request better:

1)
I doubt that a small static site will load faster than a small xml site ...

6 HTML files <=> 6 XML files, will there be a noticeable difference?

2)
in such a scenario: admin-area will be gone, plugins will still work?
how to configure image galleries, add images etc.?

3)
how to update pages? Start the old story again, with editing offline and upload ?

4)

the fear that such a system will be "bugged" by the users / clients ...
- we have multi-user-plugin with restricted profiles
- you can place the admin area in some subdirectory so that it is hidden, even to the user/client

All the advantages of ContentManagement will be lost ...
I just see disadvantages in relation to ContentManagement

in case you do not want ContentManagement, why not use a plain HTML-editor and upload?
Just like I did since 1993?
Back to the roots?

so, give me some enlightment, maybe there are really reasons for that and I am just blind ;=)

Cheers, Connie

Connie. Different people have different needs, and this is a need that is there,. To update you just enable the plugin and click on the sites and it gets regenerated for you. Plugins generate html content thus those content is saved , thus plugin no so much required except for its javascript and css it exposes.

And the XML gets parsed, goes via a process to get there. plain html page gets read by the server and streamed. It goes about server performance is that little less. admin area not really required, thus can hide that (except if some plugins have javascript ajax calls that calls php pages that requires admin area).

thus basically, it is something that somebody can use if they want and require it without having a effect on GS at all. Thus I dont see the problem with this ?
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#11
Connie Wrote:3)
how to update pages? Start the old story again, with editing offline and upload ?

regarding this, the system creates the static pages as you click on them in GS as per normal browsing.
can add later if needed a auto upload with page changes and also add that a alternative base url is used.
the you just need to copy your upload/themes/ and plugins if required over and these pages.

But at end of day, everything is done in GS as per normal no changes. all happens automatically in perfect world.
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#12
This is very interesting. I was playing with WPMU+ReallyStatic for mantaining small sites, just until I discovered GetSimple!
Reply
#13
This is essentially what my simplecache plugin does, except the pages are stores as hash named files that are served up.

It would be a small effort to construct those pages into a structure consistent with the pretty URLs.

-Rob A>
Reply
#14
dominionit Wrote:Just a note, to generate the pages you must click on each page. for each page you click on, it will generate the static page for you

Would it be possible to generate the static page when you save it in Page Management? (And having a "Refresh All Pages" link)
Reply
#15
Carlos Wrote:
dominionit Wrote:Just a note, to generate the pages you must click on each page. for each page you click on, it will generate the static page for you

Would it be possible to generate the static page when you save it in Page Management? (And having a "Refresh All Pages" link)

to be honest, I just quickly did this between taken the children too school just to give something that the person might use.

To generate the page, I must basically run index.php for that page and save the output, I can try, have not done it before but think I have a idea how to do it.

thanks

johannes
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#16
Carlos Wrote:
dominionit Wrote:Just a note, to generate the pages you must click on each page. for each page you click on, it will generate the static page for you

Would it be possible to generate the static page when you save it in Page Management? (And having a "Refresh All Pages" link)

Jip kinda certain I can do it, will do later tonight, if needed.

tx

johannes
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#17
Carlos Wrote:
dominionit Wrote:Just a note, to generate the pages you must click on each page. for each page you click on, it will generate the static page for you

Would it be possible to generate the static page when you save it in Page Management? (And having a "Refresh All Pages" link)


K updated the forum under plugins with the new file, can do both now.

http://get-simple.info/forum/topic/2273/...es-plugin/

Hope it helps
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#18
@dominionit

Hey, it was just an idea... :-) No hurry...

Just in case this helps (you or anyone interested): a year ago I experimented with something similar. I started a very basic plugin (but like you, my children don't let me develop everything I'd like) verysimplestatic.php:
Code:
<?php

$thisfile = basename(__FILE__, ".php");
register_plugin(
    $thisfile,
    'VerySimpleStatic',
    '0.1 beta',
    'Carlos',
    '#',
    'Save copies of GS pages as static html (permalink structure in Setup should also be edited)'
);

// CHANGE NEXT LINE TO SET YOUR PREFERRED FILE EXTENSION:
define(VERYSIMPLESTATIC_EXT,'html'); // .htm, .html ... anything but 'php'
define(VERYSIMPLESTATIC_RELPATH,'staticfolder/'); // RELative path, ending in a slash

add_action('edit-content', 'verysimplestatic');

function verysimplestatic() {
    global $url;
    global $update;
    
    if ($update == 'edit-success'){ verysimplestatic_writepage(@$url); }
}

function verysimplestatic_writepage($slug) {
    global $SITEURL;
    
    $s=file_get_contents($SITEURL.'/index.php?id='.$slug);
    $filename=GSROOTPATH.VERYSIMPLESTATIC_RELPATH.$slug.'.'.VERYSIMPLESTATIC_EXT;
    $fich=fopen($filename,'w');
    if( fwrite($fich, $s) ) {
        echo 'File '.$filename.' created/updated.';
    } else {
        echo "ERROR writing static page! ($filename)<br>";
    }
    fclose($fich);
}

You have to set Custom permalink structure to:
Code:
staticfolder/%slug%.html

It's a different approach, only for generating local copies. (note it's very half-made)
Reply
#19
dominionit Wrote:updated the forum under plugins with the new file, can do both now.

Wow! Hadn't read this last post. Will test it soon...
Reply
#20
Just a note to all, basically fancy URL's or cURL wont be supported, reason being the site that is going to
be exported to will be in html files, the .htaccess is setup in fancy mode to set the id param to the slug. this wont work with html, thus is not a way to go as far as I can see, thus the system will require fancy urls to be setup to generate the url's correctly.

will look if i have time to do a ftp update (not auto might have connection problems and slow system down on it). and custom base urls.

tx

johannes
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#21
K.. not gona do ftp updates. Have other method todo this. posting the file to a script on the target server
and the target server can then save the file at the correct spot,also validate its contents and make sure it has
not <?php scripts in it, just incase somebody find it and want to get onto the server.

if this is maybe seen as to dangerous I can try ftp. more test of idea.
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#22
Carlos Wrote:
dominionit Wrote:updated the forum under plugins with the new file, can do both now.

Wow! Hadn't read this last post. Will test it soon...


hi there. K, updated plugin. can do uploads now.

http://get-simple.info/forum/topic/2273/...es-plugin/


hope it helps

cheers
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#23
Carlos Wrote:
Code:
function verysimplestatic_writepage($slug) {
    global $SITEURL;
    
    $s=file_get_contents($SITEURL.'/index.php?id='.$slug);
    $filename=GSROOTPATH.VERYSIMPLESTATIC_RELPATH.$slug.'.'.VERYSIMPLESTATIC_EXT;
    $fich=fopen($filename,'w');
    if( fwrite($fich, $s) ) {
        echo 'File '.$filename.' created/updated.';
    } else {
        echo "ERROR writing static page! ($filename)<br>";
    }
    fclose($fich);
}

Hie hie,. now that I look at your code, I realize how much easier I could have done it, forgot you can use file_get_contents to pull the webpage if urll passhru is on.
tx.. will remember that in future Big Grin
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#24
Hi there, I updated the forum entry for the plugin.

http://get-simple.info/forum/topic/2273/...es-plugin/

It has base /target url now that is used in links . and css, js etc that is based on the GS site url

It can do auto upload of pages to target site with page saves
it can recreate all pages for you with button press and upload all pages with button press.

Hope it helps

Johannes
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#25
Johannes,

Thank you very much for your hard work and kind contribution to the internet! :-)

I hope to try this later today.

OK, I wrote a big post explaining why this is important (for those asking questions) but when I posted it, I had been logged out automatically somehow and now it's all gone. 1 hour of my life gone... :-(

Briefly:

1. PHP and GS could have undiscovered security risks - they've had them in the past, why not again? Why take risks if they are totally unnecessary for your usage case / situation? If your business depends on a site, why add risks of hacking?

2. Speed of PHP vs. HTML, particularly, PHP without a clever caching arrangement. Look here:
http://www.martinsikora.com/load-time-of...-php-pages
http://www.webhostingtalk.com/showthread.php?t=619396
http://forum.gwan.com/index.php?p=/discu...ighttpd/p1
http://stackoverflow.com/questions/14971...html-speed (first answer suggests a 10-1 difference between the simplest possible HTML and PHP scripts maximum responses per second. I've also seen a 50% reduction in serve time referred to for the same experiment, elsewhere).

3. Avoiding PHP means a simpler server like nginx or G-Wan can be used. Potentially you can be talking 200kB rather than 200MB depending on OS, httpd and PHP setup, 6x less memory under high load, and 2x more requests/second just from this factor alone. Look here:
http://nbonvin.wordpress.com/2011/03/24/...er-to-use/

4. Faster pages = higher Google pagerank, happier viewers. Every millisecond counts (for some websites).

5. Avoiding PHP/apache means much less memory usage - cheaper VPS/Amazon costs. Or, it means you can cache absolutely everything in physical RAM for ultra-fast speeds, vs hitting the disk filesystem or virtual memory on your VPS slice.

6. Continually watching out for security updates is a drain on my 'attention' as a sysadmin. I'd rather avoid it.

7. Just for fun: http://www.amazon.com/dp/0596529309/?tag...verfl08-20

Also check out http://load-impact.com - lets you stress test your site.
Example here: http://www.webandblog.com/reviews/apache...eavy-load/
Reply




Users browsing this thread: 1 Guest(s)