/files application

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
bpi
Reply | Threaded
Open this post in threaded view
|

/files application

bpi
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
tty
Reply | Threaded
Open this post in threaded view
|

Re: /files application

tty

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 <[hidden email]> 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 mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: /files application

JupiterJones
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 <[hidden email]> 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 <[hidden email]> 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 mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: /files application

Mariano Martinez Peck
In reply to this post by bpi


On Mon, Nov 26, 2018 at 2:13 PM Bernhard Pieber <[hidden email]> 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.


Usually, when I am deploying in production and I serve static files from an external web server what I do is:

WAAdmin disableDevelopmentTools.
WAAdmin clearAll.
self registerMyApps.

There, just change "self registerMyApps." to whatever code you use to register your own apps....so basically I unregister everything and then just register my apps...


-- 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
bpi
Reply | Threaded
Open this post in threaded view
|

Re: /files application

bpi
Hi Mariano,

Thanks for the tip. I will give that a try. I assume that WAAdmin clearAll removes the /files application as well, and that I would have to serve JQuery statically as well for it to work, right?

Cheers,
Bernhard

> Am 27.11.2018 um 13:40 schrieb Mariano Martinez Peck <[hidden email]>:
>
>
>
> On Mon, Nov 26, 2018 at 2:13 PM Bernhard Pieber <[hidden email]> 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.
>
>
> Usually, when I am deploying in production and I serve static files from an external web server what I do is:
>
> WAAdmin disableDevelopmentTools.
> WAAdmin clearAll.
> self registerMyApps.
>
> There, just change "self registerMyApps." to whatever code you use to register your own apps....so basically I unregister everything and then just register my apps...
>
>
> --
> Mariano
> https://twitter.com/MartinezPeck
> http://marianopeck.wordpress.com
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: /files application

Mariano Martinez Peck


On Tue, Nov 27, 2018 at 4:29 PM Bernhard Pieber <[hidden email]> wrote:
Hi Mariano,

Thanks for the tip. I will give that a try. I assume that WAAdmin clearAll removes the /files application as well, and that I would have to serve JQuery statically as well for it to work, right?

Yes. You can use #deployFiles to export all your file libraries into .js or .css that then server via external webserver
 

Cheers,
Bernhard

> Am 27.11.2018 um 13:40 schrieb Mariano Martinez Peck <[hidden email]>:
>
>
>
> On Mon, Nov 26, 2018 at 2:13 PM Bernhard Pieber <[hidden email]> 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.
>
>
> Usually, when I am deploying in production and I serve static files from an external web server what I do is:
>
> WAAdmin disableDevelopmentTools.
> WAAdmin clearAll.
> self registerMyApps.
>
> There, just change "self registerMyApps." to whatever code you use to register your own apps....so basically I unregister everything and then just register my apps...
>
>
> --
> Mariano
> https://twitter.com/MartinezPeck
> http://marianopeck.wordpress.com
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


--

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
bpi
Reply | Threaded
Open this post in threaded view
|

Re: /files application

bpi
In reply to this post by JupiterJones
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 <[hidden email]>:
>
> 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 <[hidden email]> 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 <[hidden email]> 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
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: /files application

Esteban A. Maringolo
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
(<[hidden email]>) 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 <[hidden email]>:
> >
> > 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 <[hidden email]> 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 <[hidden email]> 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
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >>
> >>
> >> _______________________________________________
> >> seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside