Hey Everyone, I've been head down working on the m2sh-c stuff and travels. Tonight I finished up the last of the commands you need to actually use m2sh-c for working with mongrel2. I'd like people to try it and shoot feedback. It basically works the same as the Python version except I simplified some use cases. First, to build it go get the fossil source and from the mongrel2 source root do: make clean release cd tools/m2sh make Now you have ./build/m2sh to play with. Do ./build/m2sh help to see what commands are there. Here's what's different: 1. It's faster, so there's no init step needed to speed things up. Just use ./build/m2sh init -db config.sqlite -config tests/sample.conf and done. 2. It assumes config.sqlite and mongrel2.conf for most commands. So the above can also be done: ./build/m2sh init -config tests/sample.conf 3. The shell works, and works better than the pyrepl stuff. It uses linenoise so you get a readline similar interface. 4. It leaks ram like crazy, and is probably riddled with bugs. 5. It actually takes the same config file as what you used for Python. I took the time to write a parser by hand that would work with the original config files. Copy an existing one you have, get rid of the import at the top, and it should work. 6. The config file format is commas optional. That right, you can do all of the configuration structures without commas. Check out the tests/sample.conf to see how that works. 7. You can add your own mimetypes easily by using the mimetypes variable in the config file. 8. Instead of commit, you just set a variable "servers" to the list of servers to configure. Alright try it out and let me know what you think. I'm dying to get this thing done so that I can kill off the python one as the default and get a cleaner install process. -- Zed A. Shaw http://zedshaw.com/
On Fri, Sep 17, 2010 at 03:22:16AM -0700, Zed A. Shaw wrote: > Hey Everyone, > 1. It's faster, so there's no init step needed to speed things up. Just > use ./build/m2sh init -db config.sqlite -config tests/sample.conf and > done. Sorry, I meant, just do this: ./build/m2sh load -db config.sqlite -config tests/sample.conf Or, with defaults: ./build/m2sh load -config tests/sample.conf Or even: cp tests/sample.conf mongrel2.conf ./build/m2sh load That's better. -- Zed A. Shaw http://zedshaw.com/
It mostly works for me. One issue though.
When I try to run by -host, like this:
m2sh start -db config.sqlite -host arch
it fails with this error:
DEBUG src/config/db.c:65: [SQL] SELECT uuid FROM server where host = 'arch'
ERROR (src/config/db.c:68: errno: No such file or directory) [SQL
ERROR]: SELECT uuid FROM server where host = 'arch' : 'no such column:
host'
ERROR (src/commands.c:242: errno: Success) Didn't find a server to run.
Starting by -name or -uuid works perfectly, though.
Here is my sample.conf (I took the original config.py and tweaked it a bit)
web_app_proxy = Proxy(addr='127.0.0.1', port=8080)
chat_demo_dir = Dir(base='static/chatdemo/',
index_file='index.html',
default_ctype='text/plain')
chat_demo = Handler(send_spec='tcp://127.0.0.1:9999',
send_ident='54c6755b-9628-40a4-9a2d-cc82a816345e',
recv_spec='tcp://127.0.0.1:9998', recv_ident='')
handler_test = Handler(send_spec='tcp://127.0.0.1:9997',
send_ident='34f9ceee-cd52-4b7f-b197-88bf2f0ec378',
recv_spec='tcp://127.0.0.1:9996', recv_ident='')
# the r'' string syntax means to not interpret any \ chars, for regexes
arch = Host(name="arch", routes={
'@chat': chat_demo,
'/handlertest': handler_test,
'/chat/': web_app_proxy,
'/': web_app_proxy,
'/chatdemo/': chat_demo_dir,
'/static/': chat_demo_dir,
'/mp3stream': Handler(
send_spec='tcp://127.0.0.1:9995',
send_ident='53f9f1d1-1116-4751-b6ff-4fbe3e43d142',
recv_spec='tcp://127.0.0.1:9994', recv_ident='')
})
main = Server(
uuid="5b76efcb-bd0e-4cba-956f-4e87ddac4544",
access_log="/logs/access.log",
error_log="/logs/error.log",
chroot="/home/pasha/deployment/",
pid_file="/run/mongrel2.pid",
default_host="arch",
name="main",
port=6767,
hosts = [arch]
)
settings = {"zeromq.threads": 4}
servers = [main]
On Fri, Sep 17, 2010 at 4:24 PM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Fri, Sep 17, 2010 at 03:22:16AM -0700, Zed A. Shaw wrote:
>> Hey Everyone,
>> 1. It's faster, so there's no init step needed to speed things up. Just
>> use ./build/m2sh init -db config.sqlite -config tests/sample.conf and
>> done.
>
> Sorry, I meant, just do this:
>
> ./build/m2sh load -db config.sqlite -config tests/sample.conf
>
> Or, with defaults:
>
> ./build/m2sh load -config tests/sample.conf
>
> Or even:
>
> cp tests/sample.conf mongrel2.conf
> ./build/m2sh load
>
> That's better.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>
--
Good luck,
Pasha Bastov