Reloading nameko service on change

Hi! I'm working on a system that uses a bunch of different nameko services
which we run in development using docker compose and the nameko run
command. Is there a recommended way to make services auto-reload on code
changes? I've looked through the documentation and mailing list, but
haven't found an answer (which makes me think I may be missing something
obvious).

Thanks!
Jesse

Hi Jesse,

You're not missing anything obvious I'm afraid. There isn't anything
built-in at the moment for auto-reload. You might be able to pull something
together yourself using a library
like https://pypi.python.org/pypi/watchdog/ or similar.

Best,
David

···

On Saturday, 16 July 2016 23:05:56 UTC+1, je...@pollak.io wrote:

Hi! I'm working on a system that uses a bunch of different nameko services
which we run in development using docker compose and the nameko run
command. Is there a recommended way to make services auto-reload on code
changes? I've looked through the documentation and mailing list, but
haven't found an answer (which makes me think I may be missing something
obvious).

Thanks!
Jesse

Hi Jesse,

I had a go at a reloader few months back. Unfortunately I wasn't able to
figure out how to maintain Nameko's 100% test coverage with my changes.

I wasn't able to use watchdog library David is mentioning due to its
incompatibility
with eventlet: https://github.com/gorakhargosh/watchdog/issues/332

My solution is inspired by Django implementation and uses *os.stat* which
is probably not ideal. You can see the changes required here:

Hope this helps.

Jakub

···

On Sunday, 17 July 2016 18:57:09 UTC+1, David Szotten wrote:

Hi Jesse,

You're not missing anything obvious I'm afraid. There isn't anything
built-in at the moment for auto-reload. You might be able to pull something
together yourself using a library like
https://pypi.python.org/pypi/watchdog/ or similar.

Best,
David

On Saturday, 16 July 2016 23:05:56 UTC+1, je...@pollak.io wrote:

Hi! I'm working on a system that uses a bunch of different nameko
services which we run in development using docker compose and the nameko
run command. Is there a recommended way to make services auto-reload on
code changes? I've looked through the documentation and mailing list, but
haven't found an answer (which makes me think I may be missing something
obvious).

Thanks!
Jesse

To run it use --dev flag e.g:

nameko run docs.examples.http:HttpService --dev

Jakub

···

On Monday, 18 July 2016 10:11:56 UTC+1, jakub...@student.com wrote:

Hi Jesse,

I had a go at a reloader few months back. Unfortunately I wasn't able to
figure out how to maintain Nameko's 100% test coverage with my changes.

I wasn't able to use watchdog library David is mentioning due to its
incompatibility with eventlet:
https://github.com/gorakhargosh/watchdog/issues/332

My solution is inspired by Django implementation and uses *os.stat* which
is probably not ideal. You can see the changes required here:

https://github.com/onefinestay/nameko/compare/master...kooba:reloader

Hope this helps.

Jakub

On Sunday, 17 July 2016 18:57:09 UTC+1, David Szotten wrote:

Hi Jesse,

You're not missing anything obvious I'm afraid. There isn't anything
built-in at the moment for auto-reload. You might be able to pull something
together yourself using a library like
https://pypi.python.org/pypi/watchdog/ or similar.

Best,
David

On Saturday, 16 July 2016 23:05:56 UTC+1, je...@pollak.io wrote:

Hi! I'm working on a system that uses a bunch of different nameko
services which we run in development using docker compose and the nameko
run command. Is there a recommended way to make services auto-reload on
code changes? I've looked through the documentation and mailing list, but
haven't found an answer (which makes me think I may be missing something
obvious).

Thanks!
Jesse

I didn't necessarily mean integrating watchdog into nameko. It can also be
used from the outside, via the `watchmedo` command it ships.

I got something like this to work:

`watchmedo auto-restart -d $PWD -R -- nameko run helloworld`

(though note https://github.com/gorakhargosh/watchdog/issues/330 if you're
on os x)

best,
david

···

On Monday, 18 July 2016 10:11:56 UTC+1, jakub...@student.com wrote:

Hi Jesse,

I had a go at a reloader few months back. Unfortunately I wasn't able to
figure out how to maintain Nameko's 100% test coverage with my changes.

I wasn't able to use watchdog library David is mentioning due to its
incompatibility with eventlet:
https://github.com/gorakhargosh/watchdog/issues/332

My solution is inspired by Django implementation and uses *os.stat* which
is probably not ideal. You can see the changes required here:

https://github.com/onefinestay/nameko/compare/master...kooba:reloader

Hope this helps.

Jakub

On Sunday, 17 July 2016 18:57:09 UTC+1, David Szotten wrote:

Hi Jesse,

You're not missing anything obvious I'm afraid. There isn't anything
built-in at the moment for auto-reload. You might be able to pull something
together yourself using a library like
https://pypi.python.org/pypi/watchdog/ or similar.

Best,
David

On Saturday, 16 July 2016 23:05:56 UTC+1, je...@pollak.io wrote:

Hi! I'm working on a system that uses a bunch of different nameko
services which we run in development using docker compose and the nameko
run command. Is there a recommended way to make services auto-reload on
code changes? I've looked through the documentation and mailing list, but
haven't found an answer (which makes me think I may be missing something
obvious).

Thanks!
Jesse

In my search of a autoreload feature, I have found entr, which is available in most package managers, language agnostic, and works with docker without problems.

Example of use:
ls *.py | entr -r nameko run --config config.yml myservice

Nameko reloader didn’t work for me because it doesn’t laod config with environment variables.

Also, nameko extras exists, but I haven’t tested it.

Edit: Sorry for necroposting, but this was my first google result when searching nameko autoreload >:P