[Seaside] WAFileLibrary deployFiles then what?

Johan Brichau johan at inceptive.be
Fri Nov 23 06:44:48 UTC 2018


In our development setup, we use Zinc’s ZnZincStaticServerAdaptor to serve the external js, css, … files directly from the image. 
From what I understand, this is maybe what you are looking for?

I believe all info you need is in the Pharo books that explain Zinc. I don’t have any reusable code to share directly as our dev setup is specific.

There used to be a WAExternalFileLibrary for Seaside 3.0 that allowed to serve the files residing externally to the image but it’s use case is now covered by Zinc.

Johan

> On 23 Nov 2018, at 02:57, gettimothy <gettimothy at zoho.com> wrote:
> 
>  Hi Joachim,
> 
> I understand now....
> 
> Yes, I do have NGinx listening on port 80  with reverse proxy to Squeak for specific applications...zurb, SeasideDoc, dotiXt....
> 
> resources, such as images, css and javascript are "routed" via various location blocks...
>        location ~* .(js)$ {
> 
>           try_files /zurb/$uri  /jquery-ui/$uri /jquery-ui/external/jquery/$uri =400;
>           expires 1y;
>           sendfile   on;
>           tcp_nopush on;
>           default_type application/javascript;
>           add_header Content-Type: application/javascript;
>           add_header Access-Control-Allow-Origin *;
>         }
> 
> then, for specific applications, a proxy_pass is issued...
> 
>         location ~* ^/SeasideDoc {
>             proxy_pass http://127.0.0.1:8080 <http://127.0.0.1:8080/>;
>             include       mime.types;
>         }
>         location ~* ^/zurb {
>             proxy_pass http://127.0.0.1:8080 <http://127.0.0.1:8080/>;
>         }
> Both those applications, within Squeak have their FileLibrary accessors mapped to use the file system via the nginx rules.
> It works great.
> 
> The problem was that JQuery, bootstrap, etc examples have their javascript, css and images stored within their FileLibrary classes and the nginx rules reject the requests.
> 
> From within SeasideDoc (accessed via Nginx) I link to the JQuery,Bootstrap, etc apps using the 8080 port
> 
> So, yes, if I get pounded via port 8080, I am in trouble. Fortunately, the bots are only attacking port 80 as far as I can tell.
> 
> thanks for the heads up.
> 
> t
> 
> ---- On Thu, 22 Nov 2018 02:46:02 -0500 <jtuchel at objektfabrik.de> wrote ----
> 
> Timothy,
> 
> please keep in mind that from time to time* someone out there will flood your server with requests for .php files and other assets that are known to present security holes. Your Smalltalk image will surely break down when somebody asks for those files a couple of hundred times a second. I'd rather have nginx or Apache handle the 404 stuff for these situations...
> 
> So if you plan to deploy on a publicly reachable machine, I strongly recommend to overthink your approach.
> 
> 
> Joachim
> 
> * form time to time in this context can vary between every few days to several times a day
> 
> Am 22.11.18 um 08:41 schrieb jtuchel at objektfabrik.de <mailto:jtuchel at objektfabrik.de>:
> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> Hi Timothy, 
> 
> still not sure I understand. You want to deploy files but serve them from the image?
> Isn't the whole idea of #deployFiles not to serve them from the image and use those CPU-Cycles in the Smalltalk image for something with more value...?
> 
> Joachim
> 
> 
> Am 21.11.18 um 15:50 schrieb gettimothy:
> Hi Joachim
> 
> Thanks for the response. That what I was doing , but its a big job as I will be loading JQuery-ui, JQuery, Bootstrap, MaterialDesign, Seaside.... from the apps menu in SeasideDoc.
> 
> However!!!! I found an acceptable work-around that bypasses NGINX completely.
> 
> The base SeasideDoc files are referenced like: 
> SeasideDocLibrary baseUrl,'jquery-ui.js' ->'http://192.168.1.102/jquery-ui.js <http://192.168.1.102/jquery-ui.js>'
> and are  handled via Nginx.
> 
> 
> I figured out I could bypass NGINX completely by tacking on an :8080 to the url...
> 
> (SeasideDocLibrary alternatePort: (SeasideDocLibrary baseUrl)) ,'bootstrap' --> 'http://192.168.1.102:8080/bootstrap <http://192.168.1.102:8080/bootstrap>'
> This means the Show/Call stuff for apps will not be in the cards for the apps, but I think this is an acceptable tradeoff.
> 
> cheers,
> t
> 
> ---- On Wed, 21 Nov 2018 02:41:07 -0500 <jtuchel at objektfabrik.de> <mailto:jtuchel at objektfabrik.de> wrote ----
> 
> Timothy,
> 
> not sure I am answering the right question here, but the idea of deploying files to the file system in a production system is that requests coming in for files never reach your smalltalk image, thus keeping load off your image.
> 
> So what is needed is a definition for nginx that "catches" requests to /files/ and redirect them to files onyour filesystem, namely the path you deployed your files to.
> 
> I am using Apache, so I cannot say what exactly needs to be done in nginx, 
> 
> Here's what's in my apache conf for this purpose:
> 
>         Alias /files /var/www/app.kontolino
>         ProxyPass /files !
> 
>         Alias /favicon.ico /var/www/app.kontolino/OfBuchhaltungFileLibrary/favicon.ico
>         ProxyPass /favicon.ico !
> 
>         Alias /robots.txt /var/www/app.kontolino/OfBuchhaltungFileLibrary/robots.txt
>         ProxyPass /robots.txt !
> 
> So all you need to do is to transpile this for nginx ;-)
> 
> HTH
> 
> Joachim
> 
> 
> Am 21.11.18 um 08:32 schrieb gettimothy:
> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> After you deploy the files, does Seaside have a "pass thru" to access those files automatically? or do I have to build one by hand?
> 
> Here is the background/motivation.
> 
> At http://menmachinesmaterials.com/SeasideDoc <http://menmachinesmaterials.com/SeasideDoc>  on left menu, under "apps" you will see that the css/javascript access for 'Zurb Foundation' works and neither work for the Twitter Bootstrap or Jquery apps.
> 
> The reason is that I use NGinx locations to tell where to look for resources.
> 
> My SeasideDoc and Zurb File ibraries all access their files relative to the nginx defintions.  So, 'ZurbExamplesLibrary foundation.css' will resolve to the correct path for Nginx to handle.
> 
> The TBS and JQuery FileLibraries are 'self contained' and the css and js is not delivered via Nginx.
> 
> I am in the process of creating an additional library for TBS that uses my convention...but...
> 
> I just discovered the "deployFiles' method and it does do a nice dump of the files I need...but then what?
> 
> Does Seaside standard dev practice include "switching to another library" that automatically routes to those urls that I am missing? 
> 
> thx in advance.
> 
> t
> 
> 
> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> 
> 
> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> 
> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
> 
> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20181123/b80e1cbe/attachment-0001.html>


More information about the seaside mailing list