Bienvenue sur IndexError.

Ici vous pouvez poser des questions sur Python et le Framework Django.

Mais aussi sur les technos front comme React, Angular, Typescript et Javascript en général.

Consultez la FAQ pour améliorer vos chances d'avoir des réponses à vos questions.

recuperation de logs et resultats d'execution d'ansible dans une page web avec WAMP/CROSSBAR

0 votes

Au boulot j'administre des environnements jEE et du coup on a produit un soft qui permet d'automatiser leurs installations.
Là, j'ai eu l'occasion de réécrire ce soft (en java avec extjs à l'origine) avec Python et Django.
J'arrive parfaitement à faire mes installations avec donc Django => Celery => Ansible :P
Le truc qui me manque c'est de remonter les logs et resultats d'ansible dans la page web.
Du coup je me suis dit que c'était le cas idéal pour coller Crossbar & Autobahn dans l'affaire.
Mais je sêche complètement sur ce sujet.
Des petites suggestions ?

demandé 11-Sep-2015 par foxmask (2,854 points)

Au boulot j'administre des environnements jEE et du coup on a produit
un soft qui permet d'automatiser leurs installations.

Plutôt que de réinventer la roue, n'y aurait-il pas déjà des outils pour ça ? Du genre Maven(wiki)

Ces outils sont les consoles web mais vu l'ergonomie et la lenteur on va 100x plus vite avec n'importe quoi d'autre

et aussi un point important, les utilisateurs potentiels ne pigent RIEN à l'installation d'applications jEE alors la console web des serveurs d'applications ca leur ferait peur :D Là on a une archive targz structurée et l'outil se charge d'extraire son contenu et l'installer et hop.

1 Réponse

+2 votes
 
Meilleure réponse

Une reponse par maître CROSSBAR/WAMP lui même :

14:16 < foxmask> hi
14:16 < foxmask> I have a question :)
14:17 < foxmask> I made a webapp that permits to deploy what I want where I want ; typcally I deploy EAR & WAR & config file in an applications server
14:17 -!- oberstet [~quassel@ppp-88-217-52-82.dynamic.mnet-online.de] has joined #autobahn
14:18 < foxmask> I made a webapp that permits to deploy what I want where I want ; typcally I deploy EAR & WAR & config file in an applications server
14:18 < oberstet_> foxmask: yes?
14:18 < foxmask> I made it with django + celery (for the async part) ; and when I trigger a deployment from the webpage ; i'd like to get the result in that webpage but
         currently the log stay in the console
14:19 < foxmask> I thought that could be the perfect use case for using autobahn/crossbar
14:19 < foxmask> but I dont see how to :)
14:20 < oberstet_> not sure if I get it yet .. let me reread for a moment
14:21 < foxmask> I read the exemple about django and the admin console that display the cpu/memory usage ; may be that could be the same path in a less complicated way
14:21 < oberstet_> so the goal is to press a button in a Web UI, and then this triggers the deployment of a Java WAR onto some appserver, and you want to get the deployment
           log in the Web UI?
14:22 < foxmask> yes
14:22 < foxmask> exactly
14:22 < foxmask> currently
14:22 < foxmask> I use django + celery + ansible that do that
14:22 < oberstet_> here is how I'd approach that given a clean slate:
14:22 < oberstet_> the Web UI is a single-page Web app .. means: static HTML, and everything else comes via WAMP
14:23 < oberstet_> the button press will issue a WAMP call
14:23 < oberstet_> the procedure that receives the WAMP call (com.myapp.deploy_war) would be implemented by a backend WAMP component
14:24 < oberstet_> eg you could have a AutobahnPython/Twisted WAMP backend component implementing com.myapp.deploy_war() .. and then use Twisted awesome process spawning
           support to spawn your WAR deployment tool
14:25 < oberstet_> the WAMP backend component would spawn the WAR deployment tool, and receive it's output (what it writes to stdout), and then ..
14:25 < oberstet_> 3 options: a) it accumulates all output from the WAR tool and only returns if the tool has completely finished
14:26 < oberstet_> b) the com.myapp.deploy_war uses progressive results, and then can already provide the output of the WAR tool to the caller (the Web UI thing) "as it comes"
14:26 < oberstet_> c) mix that with pubsub and let the WAMP backend thing publish "per-line" events for each line from stdout from the WAR tool
14:26 < oberstet_> still with me?
14:27 < foxmask> yes yes I read :)
14:27 < oberstet_> so this is easy to do, all real-time and bla bla, and you don't need to fuss with django, celery, etc at all
14:28 < oberstet_> unless you have other requirements that make you use django, I'd approach it roughly like above
14:28 < oberstet_> the WAMP backend component that spawns the actual WAR deployment tool can again run somewhere (does not have to run where CB runs .. but it can of course ..
           and then you can have it started by CB automatically)
14:29 < foxmask> the requirement is my ability to use the SPA vs Django :)
14:29 < oberstet_> right;)
14:30 < foxmask> and I try to avoid Javascript the most possible :)
14:30 < oberstet_> JS is your friend;) nowerdays, and at least at the frontend (browser) ..
14:30 < foxmask> yes
14:30 < foxmask> I know :(
14:32 < oberstet_> there is a small, initial learning curve to get beyond the "server generates HTML" mindset and cramp everything into that model
14:33 < foxmask> I know but I dont know if we give me the time to learn that as my primary job is not to code but to admin application server
14:33 < oberstet_> there are a lot of upsides. e.g. think about testability. and and .. but granted, SPA vs dynamic server-generated HTML is a decision you must make first
14:34 < foxmask> In any case, I thank you for all your advice
14:35 < oberstet_> np;) come again. if you don't want/can use SPA, we can talk about doing it the "old way". we can make that work too, but it'll be more wheels, feel less
           natural, etc .. cu!
14:35 < foxmask> thanks:)
répondu 14-Sep-2015 par foxmask (2,854 points)

Un petit résumé en français tenant sur une phrase ou deux aurait été le bienvenu, pour ceux qui auraient la flemme de tout lire, et se croller à chaque fois =P

...