Where exactly is "Public"?

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

Where exactly is "Public"?

Bèrto ëd Sèra
Hi all,

it's surely a stupid question, but I cannot seem to answer myself. I
have a copy of my demo working fine on my laptop (served by swazoo)
but the apache proxy on the official site for some reason now cannot
serve files anymore (it will serve "everything packed in Iliad" fine,
though). The page is duly made and served (so gst is definitely up and
running) but without images, css etc. I made a find throughout the
server to see where the few things it gets were coming from, the
results are quite puzzling.

ks305671 ambaradan # find / -name "arrow_down.png"
/home/apache/ambaradan/More/UI/images/arrow_down.png
/home/apache/ambaradan/Public/images/arrow_down.png
/home/apache/iliad/More/UI/Public/images/arrow_down.png
/home/mercurial/ambaradan/More/UI/images/arrow_down.png
/home/mercurial/ambaradan/Public/images/arrow_down.png
/home/ambaradan/ambaradan/More/UI/images/arrow_down.png
/home/ambaradan/ambaradan/Public/images/arrow_down.png

this is all my stuff plus:

/root/.st/cache/git__github.com__%2FNicolasPetton%2Filiad.git/More/UI/Public/images/arrow_down.png

I can change *any* of these and it doesn't affect the output. So it
must come from somewhere else. Hmmm where?

Bèrto

--
==============================
Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
viole les droits du peuple, l'insurrection est, pour le peuple et pour
chaque portion du peuple, le plus sacré des droits et le plus
indispensable des devoirs.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Bèrto ëd Sèra
To add some spice, there seem to be something REALLY weird around, as
a grep finds
/home/apache/ambaradan/Ambaradan-Application/Application/AmbaradanApplication.st:
     aPage head javascript src: '/javascripts/layermagik.js'.
/home/apache/ambaradan/Ambaradan-Application/Application/AmbaradanApplication.st:
     aPage head javascript src:
'/javascripts/jquery-ui-1.7.2.custom.min.js'.

All these files get a 404 not found msg, BUT

/home/apache/iliad/Core/Buildables/ILApplication.st:    aPage head
javascript src: '/javascripts/jquery132min.js'.
/home/apache/iliad/Core/Buildables/ILApplication.st:    aPage head
javascript src: '/javascripts/no_conflict.js'.

This are loaded as expected.

Weird, huh?

Bèrto
--
==============================
Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
viole les droits du peuple, l'insurrection est, pour le peuple et pour
chaque portion du peuple, le plus sacré des droits et le plus
indispensable des devoirs.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Paolo Bonzini-2
In reply to this post by Bèrto ëd Sèra
> ks305671 ambaradan # find / -name "arrow_down.png"
> /home/apache/ambaradan/More/UI/images/arrow_down.png
> /home/apache/ambaradan/Public/images/arrow_down.png
> /home/apache/iliad/More/UI/Public/images/arrow_down.png
> /home/mercurial/ambaradan/More/UI/images/arrow_down.png
> /home/mercurial/ambaradan/Public/images/arrow_down.png
> /home/ambaradan/ambaradan/More/UI/images/arrow_down.png
> /home/ambaradan/ambaradan/Public/images/arrow_down.png
>
> this is all my stuff plus:
>
> /root/.st/cache/git__github.com__%2FNicolasPetton%2Filiad.git/More/UI/Public/images/arrow_down.png

I think Public comes straight from the .star file that you loaded
Iliad from.  Make sure it is there also on the server and not only on
the development machine (it is needed even if Iliad is in the GST
image).

Paolo
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Stefan Schmiedl
In reply to this post by Bèrto ëd Sèra
On Fri, 7 May 2010 06:52:45 +0300
Bèrto ëd Sèra <[hidden email]> wrote:

> but the apache proxy on the official site for some reason now cannot

If it's related to a proxy server, the proxy configuration (for the vhost)
would be quite helpful in debugging this.

s.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Bèrto ëd Sèra
This is the .conf file for the site. It worked okay until I upgraded
Iliad and gst.
======================================

# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

<IfDefine DEFAULT_VHOST>
# see bug #178966 why this is in here

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
#Listen 80

# Use name-based virtual hosting.
#NameVirtualHost *:80

# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.
NameVirtualHost 91.121.221.48:80
<VirtualHost 91.121.221.48:80>
    ServerName voxhumanitatis.net
    ServerAlias www.voxhumanitatis.net
    #Include /etc/apache2/vhosts.d/default_vhost.include
    DocumentRoot /home/apache/ambaradan/Public

    <IfModule mpm_peruser_module>
        ServerEnvironment apache apache
    </IfModule>

    ProxyRequests On

    # Proxy ACL
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>

    # Proxy directives
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
    ProxyPreserveHost on

    # Logfiles
    ErrorLog  /var/log/apache2/ambaradan/error.log
    CustomLog /var/log/apache2/ambaradan/access.log combined
    ServerSignature On
</VirtualHost>
</IfDefine>

# vim: ts=4 filetype=apache


=============================

also...

ks305671 apache2 # cat /etc/conf.d/apache2
# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the APACHE2_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will have an
# <IfDefine NNN> directive where NNN is the option to enable that module.
#
# Here are the options available in the default configuration:
#
#  AUTH_DIGEST  Enables mod_auth_digest
#  AUTHNZ_LDAP  Enables authentication through mod_ldap (available if USE=ldap)
#  CACHE        Enables mod_cache
#  DAV          Enables mod_dav
#  ERRORDOCS    Enables default error documents for many languages.
#  INFO         Enables mod_info, a useful module for debugging
#  LANGUAGE     Enables content-negotiation based on language and charset.
#  LDAP         Enables mod_ldap (available if USE=ldap)
#  MANUAL       Enables /manual/ to be the apache manual (available if USE=docs)
#  MEM_CACHE    Enables default configuration mod_mem_cache
#  PROXY        Enables mod_proxy
#  SSL          Enables SSL (available if USE=ssl)
#  SUEXEC       Enables running CGI scripts (in USERDIR) through suexec.
#  USERDIR      Enables /~username mapping to /home/username/public_html
#
#
# The following two options provide the default virtual host for the HTTP and
# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
# will not listen for incomming connections on the approriate port.
#
#  DEFAULT_VHOST      Enables name-based virtual hosts, with the default
#                     virtual host being in /var/www/localhost/htdocs
#  SSL_DEFAULT_VHOST  Enables default vhost for SSL (you should enable this
#                     when you enable SSL)
#
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D
SSL_DEFAULT_VHOST -D PHP5 -D PROXY -D SUEXEC"

# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.

# PID file
#PIDFILE=/var/run/apache2.pid

# timeout for startup/shutdown checks
#TIMEOUT=10

# ServerRoot setting
#SERVERROOT=/usr/lib64/apache2

# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
#CONFIGFILE=/etc/apache2/httpd.conf

# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"

# A command that outputs a formatted text version of the HTML at the URL
# of the command line. Designed for lynx, however other programs may work.
#LYNX="lynx -dump"

# The URL to your server's mod_status status page.
# Required for status and fullstatus
#STATUSURL="http://localhost/server-status"

# Method to use when reloading the server
# Valid options are 'restart' and 'graceful'
# See http://httpd.apache.org/docs/2.2/stopping.html for information on
# what they do and how they differ.
#RELOAD_TYPE="graceful"
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Bèrto ëd Sèra
In reply to this post by Paolo Bonzini-2
> I think Public comes straight from the .star file that you loaded
> Iliad from.  Make sure it is there also on the server and not only on
> the development machine (it is needed even if Iliad is in the GST
> image).

My impression, exactly...

Iliad arrived on the server by
gst-package -t ~/.st --download iliad

Bèrto


--
==============================
Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
viole les droits du peuple, l'insurrection est, pour le peuple et pour
chaque portion du peuple, le plus sacré des droits et le plus
indispensable des devoirs.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Nicolas Petton
Hi Bèrto,

In Iliad 0.8, ILFileHandler doesn't deal with file directories directly,
this is now handled by subclasses of ILDirectory.

You can serve files from a .star, from the image or from a directory,
see the abstract ILDirectory class, and the two concrete classes
ILDiskDirectory and ILMemoryDirectory.

You can use it as follows:

Iliad.ILFileHandler addDirectory: (Iliad.ILDiskDirectory new
directory: aDirectory

This works with both star files and directories. For a .star, you can
do:

Iliad.ILFileHandler addDirectory: (Iliad.ILDiskDirectory new
        directory: (PackageLoader packageAt: 'somePackage') directory /
'Public')

Note that if there is a Public directory when you start Iliad it will be
automatically added to the served directories of the file handler, see
Core/postLoad.st:

Eval [
    (Directory image / 'Public') exists ifTrue: [
        ILFileHandler addDirectory:
           (ILDiskDirectory new
                directory: (Directory image / 'Public');
                yourself)].
    ILFileHandler addDirectory:
        (ILDiskDirectory new
    directory: (PackageLoader packageAt: 'Iliad-Core') directory /
'Public';
    yourself).
]


Even if this is nice for development, I wouldn't use it in production.
Instead I would serve all static files with a front-end web server like
Apache.


Cheers,
Nico

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Nicolas Petton
In reply to this post by Bèrto ëd Sèra
I would change the proxy directives with rewrite rules:

# Proxy to Iliad if the requested file doesn't exist
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ http://127.0.0.1:8080/$1 [proxy,last]


If you need more complex rewrite rules, also note that it's possible to
add rewrite rules on the Iliad part too:

Iliad.ILUrlBuilder addRewriteRule: [:string |
        string copyReplacingAllRegex: 'foo' with: 'bar']

You can add as many rewrite rules as you want, they will be applied in
the order you added them.

For example, if you want to serve iliad examples without the
'/examples', ie the counter example would be accessed at '/counters'
instead of '/examples/counters', you can do something like:

Iliad.ILUrlBuilder addRewriteRule: [:string |
string copyReplacingAllRegex: '^\examples' with: '']

and in the vhost config file:

RewriteRule ^/(.*)$ http://localhost:8080/examples/$1 [proxy,last]

Cheers,
Nico

Le vendredi 07 mai 2010 à 09:22 +0300, Bèrto ëd Sèra a écrit :

> NameVirtualHost 91.121.221.48:80
> <VirtualHost 91.121.221.48:80>
>     ServerName voxhumanitatis.net
>     ServerAlias www.voxhumanitatis.net
>     #Include /etc/apache2/vhosts.d/default_vhost.include
>     DocumentRoot /home/apache/ambaradan/Public
>
>     <IfModule mpm_peruser_module>
>         ServerEnvironment apache apache
>     </IfModule>
>
>     ProxyRequests On
>
>     # Proxy ACL
>     <Proxy *>
>         Order allow,deny
>         Allow from all
>     </Proxy>
>
>     # Proxy directives
>     ProxyPass / http://127.0.0.1:8080/
>     ProxyPassReverse / http://127.0.0.1:8080/
>     ProxyPreserveHost on
>
>     # Logfiles
>     ErrorLog  /var/log/apache2/ambaradan/error.log
>     CustomLog /var/log/apache2/ambaradan/access.log combined
>     ServerSignature On
> </VirtualHost>

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Bèrto ëd Sèra
In reply to this post by Nicolas Petton
Hi!

well, you opened an entire planet before my eyes :) I *love* it... it
will make browser based local apps deployment a breeze! But you are
right, much better to serve stuff with apache for a public website :)
I'll make sure I understand this stuff *very* well :)

Thanks
Berto

2010/5/7 Nicolas Petton <[hidden email]>:

> Hi Bèrto,
>
> In Iliad 0.8, ILFileHandler doesn't deal with file directories directly,
> this is now handled by subclasses of ILDirectory.
>
> You can serve files from a .star, from the image or from a directory,
> see the abstract ILDirectory class, and the two concrete classes
> ILDiskDirectory and ILMemoryDirectory.
>
> You can use it as follows:
>
> Iliad.ILFileHandler addDirectory: (Iliad.ILDiskDirectory new
> directory: aDirectory
>
> This works with both star files and directories. For a .star, you can
> do:
>
> Iliad.ILFileHandler addDirectory: (Iliad.ILDiskDirectory new
>        directory: (PackageLoader packageAt: 'somePackage') directory /
> 'Public')
>
> Note that if there is a Public directory when you start Iliad it will be
> automatically added to the served directories of the file handler, see
> Core/postLoad.st:
>
> Eval [
>    (Directory image / 'Public') exists ifTrue: [
>        ILFileHandler addDirectory:
>           (ILDiskDirectory new
>                directory: (Directory image / 'Public');
>                yourself)].
>    ILFileHandler addDirectory:
>        (ILDiskDirectory new
>        directory: (PackageLoader packageAt: 'Iliad-Core') directory /
> 'Public';
>        yourself).
> ]
>
>
> Even if this is nice for development, I wouldn't use it in production.
> Instead I would serve all static files with a front-end web server like
> Apache.
>
>
> Cheers,
> Nico
>



--
==============================
Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
viole les droits du peuple, l'insurrection est, pour le peuple et pour
chaque portion du peuple, le plus sacré des droits et le plus
indispensable des devoirs.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Nicolas Petton
Le vendredi 07 mai 2010 à 11:58 +0300, Bèrto ëd Sèra a écrit :
> Hi!
>
> well, you opened an entire planet before my eyes :) I *love* it... it
> will make browser based local apps deployment a breeze!

Thanks :)
I should really write some documentation...

Nico

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Bèrto ëd Sèra
Hi again,

I moved all static files to apache and it definitely loads *much*
quicker. Just one remaining problem. How do I over-ride graphic stuff
from the iliad .star package? I have made (for example) my own
ajax_loader, and I see it declared in Iliad's source in this line of
./Public/javascripts/iliad.js:

"<img src='/images/ajax_loader.gif'/></div>");

Now, I could change the line to

"<img src='http://myfileserver.org/images/ajax_loader.gif'/></div>");

and recompile but this is surely not what you had in mind... I suppose
there must be a much cleaner way to do it, right? I suppose I can
redirect all input from the .star to the fileserver, in one go, can I?

Bèrto
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Nicolas Petton
Le samedi 08 mai 2010 à 01:46 +0300, Bèrto ëd Sèra a écrit :

> Hi again,
>
> I moved all static files to apache and it definitely loads *much*
> quicker. Just one remaining problem. How do I over-ride graphic stuff
> from the iliad .star package? I have made (for example) my own
> ajax_loader, and I see it declared in Iliad's source in this line of
> ./Public/javascripts/iliad.js:
>
> "<img src='/images/ajax_loader.gif'/></div>");
>
> Now, I could change the line to
>
> "<img src='http://myfileserver.org/images/ajax_loader.gif'/></div>");
>
> and recompile but this is surely not what you had in mind... I suppose
> there must be a much cleaner way to do it, right? I suppose I can
> redirect all input from the .star to the fileserver, in one go, can I?
Yes, if you serve a directory with apache, put all static files there
(including iliad.js, and everything you need).

Then you can remove all served directories from Iliad:

Iliad.ILFileHandler directories: {}

Note to myself, I should probably add methods to ILFileHandler to make
this easier...

Nico

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

ZuLuuuuuu-2
In reply to this post by Bèrto ëd Sèra
Hello, I have a problem with images and css files not being loaded, as
well (though the problem is different as I understand).

I'm on Squeak (Iliad installed via Metacello). When I try to do, for
example:

(ILFileHandler new) fileContentsFor: '/images/iliad.png'.

This error comes:

MessageNotUnderstood: ByteString>>copyWithRegex:matchesReplacedWith:

on:

fileSelector := self convertToSelector: (self adjustPath: aString).

line of #fileContentsFor: method of ILMemoryDirectory. Is
#copyWithRegex:matchesReplacedWith: method supposed to come with
Squeak?



On May 7, 6:52 am, Bèrto ëd Sèra <[hidden email]> wrote:

> Hi all,
>
> it's surely a stupid question, but I cannot seem to answer myself. I
> have a copy of my demo working fine on my laptop (served by swazoo)
> but the apache proxy on the official site for some reason now cannot
> serve files anymore (it will serve "everything packed in Iliad" fine,
> though). The page is duly made and served (so gst is definitely up and
> running) but without images, css etc. I made a find throughout the
> server to see where the few things it gets were coming from, the
> results are quite puzzling.
>
> ks305671 ambaradan # find / -name "arrow_down.png"
> /home/apache/ambaradan/More/UI/images/arrow_down.png
> /home/apache/ambaradan/Public/images/arrow_down.png
> /home/apache/iliad/More/UI/Public/images/arrow_down.png
> /home/mercurial/ambaradan/More/UI/images/arrow_down.png
> /home/mercurial/ambaradan/Public/images/arrow_down.png
> /home/ambaradan/ambaradan/More/UI/images/arrow_down.png
> /home/ambaradan/ambaradan/Public/images/arrow_down.png
>
> this is all my stuff plus:
>
> /root/.st/cache/git__github.com__%2FNicolasPetton%2Filiad.git/More/UI/Public/images/arrow_down.png
>
> I can change *any* of these and it doesn't affect the output. So it
> must come from somewhere else. Hmmm where?
>
> Bèrto
>
> --
> ==============================
> Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
> viole les droits du peuple, l'insurrection est, pour le peuple et pour
> chaque portion du peuple, le plus sacré des droits et le plus
> indispensable des devoirs.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

ZuLuuuuuu-2
Ok, I got it, I needed to install the Regex package. I thought it is
installed by default :)


On May 12, 1:12 am, ZuLuuuuuu <[hidden email]> wrote:

> Hello, I have a problem with images and css files not being loaded, as
> well (though the problem is different as I understand).
>
> I'm on Squeak (Iliad installed via Metacello). When I try to do, for
> example:
>
> (ILFileHandler new) fileContentsFor: '/images/iliad.png'.
>
> This error comes:
>
> MessageNotUnderstood: ByteString>>copyWithRegex:matchesReplacedWith:
>
> on:
>
> fileSelector := self convertToSelector: (self adjustPath: aString).
>
> line of #fileContentsFor: method of ILMemoryDirectory. Is
> #copyWithRegex:matchesReplacedWith: method supposed to come with
> Squeak?
>
> On May 7, 6:52 am, Bèrto ëd Sèra <[hidden email]> wrote:
>
> > Hi all,
>
> > it's surely a stupid question, but I cannot seem to answer myself. I
> > have a copy of my demo working fine on my laptop (served by swazoo)
> > but the apache proxy on the official site for some reason now cannot
> > serve files anymore (it will serve "everything packed in Iliad" fine,
> > though). The page is duly made and served (so gst is definitely up and
> > running) but without images, css etc. I made a find throughout the
> > server to see where the few things it gets were coming from, the
> > results are quite puzzling.
>
> > ks305671 ambaradan # find / -name "arrow_down.png"
> > /home/apache/ambaradan/More/UI/images/arrow_down.png
> > /home/apache/ambaradan/Public/images/arrow_down.png
> > /home/apache/iliad/More/UI/Public/images/arrow_down.png
> > /home/mercurial/ambaradan/More/UI/images/arrow_down.png
> > /home/mercurial/ambaradan/Public/images/arrow_down.png
> > /home/ambaradan/ambaradan/More/UI/images/arrow_down.png
> > /home/ambaradan/ambaradan/Public/images/arrow_down.png
>
> > this is all my stuff plus:
>
> > /root/.st/cache/git__github.com__%2FNicolasPetton%2Filiad.git/More/UI/Public/images/arrow_down.png
>
> > I can change *any* of these and it doesn't affect the output. So it
> > must come from somewhere else. Hmmm where?
>
> > Bèrto
>
> > --
> > ==============================
> > Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
> > viole les droits du peuple, l'insurrection est, pour le peuple et pour
> > chaque portion du peuple, le plus sacré des droits et le plus
> > indispensable des devoirs.
Reply | Threaded
Open this post in threaded view
|

Re: Where exactly is "Public"?

Nicolas Petton
Le mardi 11 mai 2010 à 23:26 -0700, ZuLuuuuuu a écrit :
> Ok, I got it, I needed to install the Regex package. I thought it is
> installed by default :)

Hmm, me too. I guess it's installed in Pharo-dev images, but not in
Pharo-core.

Nico

signature.asc (205 bytes) Download Attachment