[Seaside] /files application

Esteban Maringolo emaringolo at gmail.com
Tue Nov 27 19:40:52 UTC 2018


If you need to accomplish that with Seaside and the default web server
(Zinc in Pharo) then do nothing, serve the files from the
FileLibraries directly.

Esteban A. Maringolo

El mar., 27 nov. 2018 a las 16:39, Bernhard Pieber
(<bernhard at pieber.com>) escribió:
>
> Hi J,
>
> Thanks for the tip. In my case I have no control over the Apache configuration. Therefore I am looking for a way to accomplish that in Seaside.
>
> Bernhard
>
> > Am 27.11.2018 um 05:33 schrieb Jupiter Jones <jupiter.jones at mail.com>:
> >
> > Hiya,
> >
> > Yeah Timothy is right - this is something that would be handled by the the front-end server protecting your web application.
> >
> > In my case I have an upstream server that handles SSL/TLS and only passes legitimate urls to the configuration below.
> >
> > You can limit what is accessible from the client with “location” directives in Nginx so for library files I think you could use something like:
> >
> > Location ~ /files/ {}
> >
> > The trailing slash should mean that a request for “/files” only won’t match. Would need to test that.
> >
> > With the configuration that Timothy posted, everything is passed to seaside, so you may want to specifically disallow /files with something like:
> >
> > Location = /files {
> >       deny all;
> > }
> >
> > Also, I leave the FileLibraries in the image as they are. There’s no need to change them at all. Just use FileLibrary-#deployFiles and make sure the deploy location is accessible from the front-end server at "/files" and everything should work well. In your seaside application you can use the FileLibrary to construct url’s and Nginx will server the files.
> >
> > I’m no expert either :) I find myself learning it all again each time I need to deploy a new application. It would be nice to collect all these snippets and put together some generic configurations that work “out of the box” for development and production environments. I’m happy to help with that.
> >
> > Maybe they could become part of the SeasideSt GitHub repo. I’ve copied Johan on this email - though I’m sure he’ll see it on the list :) Johan, would you mind if we add a new repo to SeasideSt - say Seaside-deployment where we could collect and contribute to various ways of putting Seaside into production?
> >
> > J
> >
> >> On 27 Nov 2018, at 10:29 am, gettimothy <gettimothy at zoho.com> wrote:
> >>
> >>
> >> Hi,
> >>
> >> Here is a copy-n-paste of what Jupiter Jone's submitted in a previous thread here:
> >>
> >>
> >> Hi Timothy,
> >>
> >> Maybe I’m late to the party here, but this is how I deal with it. The following is a dedicated seaside application server so the location is simply “/“
> >>
> >> My FileLibrary deployFiles end up at the path /opt/git/projectName/www_root/files
> >>
> >> I also added the the limits which seem to help keep things working when I get a heap of requests trying to break things or test for php things.
> >>
> >> The end result is that file library resources are served from the image unless deployed, and then they are served by Nginx.
> >>
> >> The key is the try_files directive that looks for files in the file system and if that fails passes it to the backend. Seems to work well.
> >>
> >> Maybe there’s something here that will help.
> >>
> >> Cheers,
> >>
> >> J
> >>
> >>
> >> # Seaside NGINX Configuration
> >> server_tokens off;
> >> limit_req_zone $binary_remote_addr zone=seasideRequestLimit:10m rate=30r/m;
> >> limit_conn_zone $binary_remote_addr zone=seasideConnectionLimit:10m;
> >>
> >> upstream gsDevKit_seaside_fastcgi {
> >>     least_conn;
> >>     server localhost:13301;
> >>     server localhost:13302;
> >>     server localhost:13303;
> >> }
> >>
> >> server {
> >>     listen 80;
> >>     root /opt/git/projectName/www_root;
> >>     client_max_body_size 10M;
> >>     client_body_timeout 5s;
> >>     client_header_timeout 5s;
> >>
> >>     server_name projectname.com.au;
> >>
> >>     location @gsDevKit {
> >>         limit_req zone=seasideRequestLimit;
> >>         limit_conn seasideConnectionLimit 10;
> >>
> >>         include /usr/local/etc/nginx/fastcgi_params;
> >>         fastcgi_pass gsDevKit_seaside_fastcgi;
> >>     }
> >>
> >>     location /config {
> >>         allow 10.0.0.1/24;
> >>         allow 192.168.0.1/24;
> >>         deny all;
> >>     }
> >>
> >>     location / {
> >>         try_files $uri $uri/ @gsDevKit;
> >>     }
> >>
> >> #    if ($uri = /) {
> >> #        rewrite ^(.*)$ /ProjectName$1 break;
> >> #    }
> >> }
> >>
> >>
> >> Or...
> >>
> >> I am not an expert, but on the FileLibrary, run "deployFiles" command and this will output the stuff contained within the FileLibrary to the file system wherever your Squeak is running.
> >> Then put those deployed files where your Apache/Nginx/Webserver can find them.
> >> Then , in your application's configuration, replace the existing Library with a custom one that returns paths/filenames to where your files are.
> >>
> >>
> >>
> >>
> >> ---- On Mon, 26 Nov 2018 12:13:03 -0500 Bernhard Pieber <bernhard at pieber.com> wrote ----
> >>
> >> Hi,
> >>
> >> I am using a file library (JQDeploymentLibrary) in a deployed image. If I enter /files I get a listing of all flle libraries under the heading of "Index of /files". I would like to remove that functionality in the deployed application. It seems I cannot just remove the /files application itself because if I do JQuery stops working. I'd appreciate any tips on how to solve that.
> >>
> >> Bernhard
> >> _______________________________________________
> >> seaside mailing list
> >> seaside at lists.squeakfoundation.org
> >> 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
> >
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > 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


More information about the seaside mailing list