Make uploaded files survive to re-deploy

View: New views
9 Messages — Rating Filter:   Alert me  

Make uploaded files survive to re-deploy

by Paolo Niccolò Giubelli-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi! I'm very enthusiastic about tomcat, but I have a problem. I deployed
several web applications into an apache tomcat 5.5 webserver instance,
and most of them get images from the clients via file upload. Sometimes
I need to change something or correct bugs, and obviously I need to
redeploy the applications. How can I make uploaded files survive to this
task, without using backup copies and/or using the database to store
them(a lot of people told me that this could kill sql performances)? If
I use an external directory, it would be difficult to make those files
accessible to the webpages...
Any help appreciated.
Thank you in advance!

Paolo

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Make uploaded files survive to re-deploy

by Johnny Kewl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


----- Original Message -----
From: "Paolo Niccolò Giubelli" <paoloniccolo.giubelli@...>
To: <users@...>
Sent: Friday, July 04, 2008 4:25 PM
Subject: Make uploaded files survive to re-deploy


> Hi! I'm very enthusiastic about tomcat, but I have a problem. I deployed
> several web applications into an apache tomcat 5.5 webserver instance, and
> most of them get images from the clients via file upload. Sometimes I need
> to change something or correct bugs, and obviously I need to redeploy the
> applications. How can I make uploaded files survive to this task, without
> using backup copies and/or using the database to store them(a lot of
> people told me that this could kill sql performances)? If I use an
> external directory, it would be difficult to make those files accessible
> to the webpages...
> Any help appreciated.
> Thank you in advance!
>
> Paolo

This is what we do, theres probably many ways...
We us the Apache web server as well, and we dump image files to that.... we
do use a dB but only to store file locations (URIs), not files.
 It will kill most dB's if you store huge blobs.... then how it works is
that the JSP pages or servlets simply use the link to the Apache server
image in the page.
So JSP goes to browser... browser sucks image from Apache... TC is free ;)
Why we did it like this but it never got big enuf to test it fully... is
that if the images got huge, the idea is we can dump images to other SP's on
cheap static sites, and TC still controls them.... I thought it was neat
anyway ;)

I've seen other guys do deployment tricks like deploy unpacked wars to TC,
but in general they are not worth the pain.
Then in a similar idea to our Apache idea.... some guys use a dedicated
web-app to store images, and linux guys just laugh at us MS guys and use
symlinks.

Why Apache is nice... is because TC can run behind it... so its all port 80.
Anyway if you jjust realize that a browser comes back for images and IFrames
and script files.... etc... you'll see it doesnt really matter what server
they on.

Have Fun...

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------


---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Make uploaded files survive to re-deploy

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Johnny Kewl [mailto:john@...]
> Subject: Re: Make uploaded files survive to re-deploy
>
> We us the Apache web server as well, and we dump image
> files to that....

That adds unnecessary complexity and impacts performance for dynamic content.

> > If I use an external directory, it would be difficult
> > to make those files accessible to the webpages...

It's not really difficult.  Define a <Context> element for an additional webapp that targets the external directory via a docBase attribute, and place that <Context> element in conf/Catalina/[host]/[newAppName].xml; use something like "images" (without the quotes) for [newAppName].  Tomcat's DefaultServlet will happily retrieve and display images or other static content from there when referenced via http://[host]/[newAppName]/[file].[type].

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Make uploaded files survive to re-deploy

by Johnny Kewl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


----- Original Message -----
From: "Caldarale, Charles R" <Chuck.Caldarale@...>
To: "Tomcat Users List" <users@...>
Sent: Friday, July 04, 2008 5:39 PM
Subject: RE: Make uploaded files survive to re-deploy


> From: Johnny Kewl [mailto:john@...]
> Subject: Re: Make uploaded files survive to re-deploy
>
> We us the Apache web server as well, and we dump image
> files to that....

That adds unnecessary complexity and impacts performance for dynamic
content.

> > If I use an external directory, it would be difficult
> > to make those files accessible to the webpages...

It's not really difficult.  Define a <Context> element for an additional
webapp that targets the external directory via a docBase attribute, and
place that <Context> element in conf/Catalina/[host]/[newAppName].xml; use
something like "images" (without the quotes) for [newAppName].  Tomcat's
DefaultServlet will happily retrieve and display images or other static
content from there when referenced via
http://[host]/[newAppName]/[file].[type].

 - Chuck


Yes, the above is also good ;)

ps...

Hi Chuck... always giving me a hard time... was actually just thinking,
where the #!# is Chuck ;)
Anyway... please have a look at this other thread as well..... Re: Tomcat
5.5.25 freezes
Guys are struggling and I dont know what the problem is.... give em some
more idea's to try.


---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Make uploaded files survive to re-deploy

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Johnny Kewl [mailto:john@...]
> Subject: Re: Make uploaded files survive to re-deploy
>
> Hi Chuck... always giving me a hard time... was actually just
> thinking, where the #!# is Chuck ;)

Supposed to be on holiday (July 4th and all that), but instead working while listening to Wimbledon Radio on the laptop.

> Anyway... please have a look at this other thread as
> well..... Re: Tomcat 5.5.25 freezes

I think your idea about it being related to the session timeout is highly likely.  Unfortunately, others have introduced complete red herrings.  (30 minute GC? Not bloody likely.)  Without real data (e.g., thread dump, Wireshark), there's not much to go on.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Make uploaded files survive to re-deploy

by Paolo Niccolò Giubelli-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Caldarale, Charles R ha scritto:
adds unnecessary complexity and impacts performance for dynamic content.
>
>>> If I use an external directory, it would be difficult
>>> to make those files accessible to the webpages...
>
> It's not really difficult.  Define a <Context> element for an additional webapp that targets the external directory via a docBase attribute, and place that <Context> element in conf/Catalina/[host]/[newAppName].xml; use something like "images" (without the quotes) for [newAppName].  Tomcat's DefaultServlet will happily retrieve and display images or other static content from there when referenced via http://[host]/[newAppName]/[file].[type].
>
>  - Chuck

Uhm, maybe I'm not understanding, but... what if [newAppName] needs to
be reloaded? I'm going to loose everything as before, aren't I? I need
  a place to put files, so to forget to save them when I need to
republish anything. Consider this situation: I'm on vacancy (ok, that's
SCI-FI) and a colleague of mine (that isn't a TC master) wants to deploy
an updated web project (let's say a .WAR file) without my help. He can't
do that now, because he doesn't know how to access via ssh to the
server, backup the files and so on..


---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Make uploaded files survive to re-deploy

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Paolo Niccolò Giubelli
> [mailto:paoloniccolo.giubelli@...]
> Subject: Re: Make uploaded files survive to re-deploy
>
> Uhm, maybe I'm not understanding, but... what if [newAppName] needs to
> be reloaded?

It never needs to be reloaded - keep only the image files there, nothing else.  There's no war here, no jars, no classes, no WEB-INF or META-INF directories - just the images.  Even if you do accidentally reload it with the manager app, Tomcat will not touch the content.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Make uploaded files survive to re-deploy

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Caldarale, Charles R
> Subject: RE: Make uploaded files survive to re-deploy
>
> It never needs to be reloaded - keep only the image files
> there, nothing else.  There's no war here, no jars, no
> classes, no WEB-INF or META-INF directories - just the
> images.  Even if you do accidentally reload it with the
> manager app, Tomcat will not touch the content.

One other point I probably didn't make clear - the images should be outside of Tomcat's directory structure; the docBase attribute of the <Context> element lets the DefaultServlet know where they are.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Make uploaded files survive to re-deploy

by Paolo Niccolò Giubelli-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It seems to work!!
What to say... THANK YOU!
You saved me years of life (my I-loose-everything nightmares are gone).
Thank you!

Caldarale, Charles R ha scritto:

>> From: Caldarale, Charles R
>> Subject: RE: Make uploaded files survive to re-deploy
>>
>> It never needs to be reloaded - keep only the image files
>> there, nothing else.  There's no war here, no jars, no
>> classes, no WEB-INF or META-INF directories - just the
>> images.  Even if you do accidentally reload it with the
>> manager app, Tomcat will not touch the content.
>
> One other point I probably didn't make clear - the images should be outside of Tomcat's directory structure; the docBase attribute of the <Context> element lets the DefaultServlet know where they are.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price!