WAFileLibrary deployFiles then what?

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

WAFileLibrary deployFiles then what?

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

Re: WAFileLibrary deployFiles then what?

jtuchel
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:
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  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
[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
tty
Reply | Threaded
Open this post in threaded view
|

Re: WAFileLibrary deployFiles then what?

tty
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'
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'
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 <[hidden email]> 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
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  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
[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: WAFileLibrary deployFiles then what?

jtuchel
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'
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'
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 [hidden email] 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
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  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
[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: WAFileLibrary deployFiles then what?

jtuchel
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 [hidden email]:
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'
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'
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 [hidden email] 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
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  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
[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
tty
Reply | Threaded
Open this post in threaded view
|

Re: WAFileLibrary deployFiles then what?

tty
In reply to this post by jtuchel
Hi Joachim

I was unclear....

For my immediate purposes, I am fine with being able to serve the existing apps from the image using their FileLibrary.

What I was wondering/hoping for is that when running deployFiles, that 'somehow' instead of the FileLibrary serving the content it has stored in itself, would provide "pass thru" methods to access the files it deployed to the filesystem.

hth.

t





---- On Thu, 22 Nov 2018 02:41:38 -0500 <[hidden email]> wrote ----

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:


_______________________________________________
seaside mailing list
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'
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'
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 [hidden email] 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
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  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
[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
tty
Reply | Threaded
Open this post in threaded view
|

Re: WAFileLibrary deployFiles then what?

tty
In reply to this post by jtuchel
 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;
            include       mime.types;
        }
        location ~* ^/zurb {
            proxy_pass 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 <[hidden email]> 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 [hidden email]:


_______________________________________________
seaside mailing list
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'
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'
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 [hidden email] 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
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  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
[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: WAFileLibrary deployFiles then what?

Johan Brichau-2

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 <[hidden email]> 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;
            include       mime.types;
        }
        location ~* ^/zurb {
            proxy_pass 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 <[hidden email]> 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 [hidden email]:


_______________________________________________
seaside mailing list
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'
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'
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 [hidden email] 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
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  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
[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
tty
Reply | Threaded
Open this post in threaded view
|

Re: WAFileLibrary deployFiles then what?

tty

Thanks Johan

I am good to go now.

The general case of the issue is "How do I serve a mix of external css/js resources and internal css/js resources from behind NGinx"

There may be a way to do it as the NGinx could probably be modified to proxy_pass the internal resource requests.

My workaround is good enough for what I am doing.

cheers.

tty

---- On Fri, 23 Nov 2018 01:44:48 -0500 Johan Brichau <[hidden email]> wrote ----


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 <[hidden email]> 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;
            include       mime.types;
        }
        location ~* ^/zurb {
            proxy_pass 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 <[hidden email]> 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 [hidden email]:


_______________________________________________
seaside mailing list
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'
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'
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 [hidden email] 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
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  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
[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

_______________________________________________
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: WAFileLibrary deployFiles then what?

JupiterJones
In reply to this post by tty
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;
# }
}




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

Re: WAFileLibrary deployFiles then what?

tty
Nice!

Thank you. I will add this to SeasideDoc as a HOWTO and when I get time I will study this.

I am a nginx  neophyte and much of that config is new to me, yet I see so e really cool stuff already!

Thx again


---- On Sat, 24 Nov 2018 05:56:24 -0500 [hidden email] wrote ----

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;
#    }
}




_______________________________________________
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