> Is it possible to deploy an Erlyweb application only as a set of  
> compiled .beam files? Currently Erlyweb requires a recompile every  
> time YAWS is restarted, which leads me to the next question:

Yes. It only requires a re-compile because it doesn't default to  
having the .beams in the code-path, and a re-compile forces a load of  
the .beam regardless of its location. If you just pass "-pa  
$BEAM_PATH" to yaws or erl, you won't need the source.

That said, it doesn't hurt to include the source anyway, in case you  
need to make a last minute "NOW NOW NOW!" security fix in shorter time  
than would be required to mess with your source control system.

> How do you handle Server/YAWS/MySQL restarts? Currently you need to  
> call an erlydb:start and then an erlyweb:compile when Yaws is  
> restarted. How do you automate this? How would you handle MySQL  
> connect failures?

I have a wrotit.app file with all of my configuration, and I do an  
"application:start(wrotit)" (which can also be done from the command  
line).

  11 start() -> start([],[]).
  12 start(_Type, _Args) ->
  13   %% compile first (if nothing else, this at least loads in my
  14   %% modules)
  15   compile(),
  16
  17   %% bring up yaws (doesn't appear in my supervisor hierarchy)
  18   wrotit_init:start_yaws(),
  19
  20   %% bring up psql, required by erlydb_psql
  21   start_psql_driver(),
  22
  23   %% my main supervisor will be returned
  24   wrotit_supervisor:start_link().

Of course, the reverse is done in 'stop'. I start wrotit from 'erl',  
not from 'yaws', and then I bring up yaws in "embedded mode". All of  
the connect failures, etc, can be handled right here, like "if I  
couldn't connect, throw a 'Oh noes!' exception", or whatever your  
application can do in lieu of a database connection. In my  
application, if I can't get a database connection, I'm totally  
screwed, so I just throw an exception.

> I want to make a crazy setup on my site. I want to make all URLs as  
> memorable as possible. So, instead of a http://site/article/article_title 
>  I want to have http://site/article_title. This is easy - just  
> return an ewc tuple from hook/1.
> However, there's the backend, user profiles and so on. I want to  
> move them off to subdomains. For instance, I want http://profile.site.com/ 
>  to call the index method of the profile controller. That is, make 
> http://site.com/profile/user_id 
>  work as http://profile.site.com/user_id.
> How would you set up such a thing?

You'll have to take a look at what's passed in the yaws_arg (the  
argument to hook/1) and see if you can parse out the domain that's  
been requested, and return the {ewc} as appropriate. Basically, you're  
re-implementing the logic in erlyweb:get_initial_ewc, which some  
frameworks like Pylons and Rails call "routing".


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to