Wednesday, 2020-05-06

*** ara-slack has joined #ara01:56
*** ChanServ sets mode: +v ara-slack01:56
dmsimardI think I've fixed the slack bridge02:04
ara-slackdmsimard: I think I've fixed the IRC bridge02:05
dmsimard\o/02:05
dmsimardsorry it took so long :D02:06
*** openstack has joined #ara04:21
*** ChanServ sets mode: +o openstack04:21
*** evrardjp has quit IRC04:35
*** evrardjp has joined #ara04:36
*** TKersten has joined #ara05:27
*** openstackstatus has quit IRC07:46
*** openstackstatus has joined #ara07:46
*** ChanServ sets mode: +v openstackstatus07:46
*** openstack has joined #ara07:48
*** ChanServ sets mode: +o openstack07:48
ara-slackhritz220: @hritz220 has joined the channel08:59
ara-slackdmsimard: @hritz220 wild guess but are the ownership/mode permissions sufficient for the wsgi application to read/write in that directory ? Selinux ?11:55
ara-slackhritz220: @dmsimard but when I'm keeping sqlite db in /var/www/logs/ara-report , it is working.11:59
ara-slackdmsimard: Looking through the CI, it should work, for example:12:03
ara-slackdmsimard: 1) https://c8afe9d55866697fe029-34d5a3d9e2a9ca67eb62c8365f7602e7.ssl.cf2.rackcdn.com/725656/1/check/ara-api-distributed-sqlite/231832e/ara-report/result/4d28b5b1-cc23-4c1a-860a-2e8bc1ebbca8/12:04
ara-slackdmsimard: 2) https://c8afe9d55866697fe029-34d5a3d9e2a9ca67eb62c8365f7602e7.ssl.cf2.rackcdn.com/725656/1/check/ara-api-distributed-sqlite/231832e/ara-report/result/a2787baf-e474-44b5-a4e6-e11ccc26e13a/12:04
ara-slackdmsimard: 3) https://c8afe9d55866697fe029-34d5a3d9e2a9ca67eb62c8365f7602e7.ssl.cf2.rackcdn.com/725656/1/check/ara-api-distributed-sqlite/231832e/ara-report/result/07d4699e-f4c9-48cb-91b4-909ef7b4f6df/12:05
ara-slackdmsimard: With those settings: https://c8afe9d55866697fe029-34d5a3d9e2a9ca67eb62c8365f7602e7.ssl.cf2.rackcdn.com/725656/1/check/ara-api-distributed-sqlite/231832e/fedora-31/server/settings.yaml12:05
ara-slackhritz220: @dmsimard thanks for the links but actually I'm not using it for CI job, I'm using it in my local machine(ubuntu), My use case is to store the db in the different directories and accessing the data by changing the url in ara web console, is it possible to do that?12:16
ara-slackdmsimard: Yeah, that's the intent -- the links I posted were just from a CI job that tests the distributed sqlite feature demonstrating it works12:17
ara-slackdmsimard: So if it doesn't work for you, well, there's an issue :p12:18
ara-slackdmsimard: How are you running the wsgi app ?12:19
ara-slackhritz220: @dmsimard In the settings file I've changed the variable  DISTRIBUTED_SQLITE: false to  DISTRIBUTED_SQLITE: true, the wsgi app running automatically.12:23
ara-slackdmsimard: The wsgi app, are you running "ara.server.wsgi:distributed_sqlite" specifically or just "ara.server.wsgi" ?12:24
ara-slackhritz220: I think it is just ara.server.wsgi, here's the output when starting the server:12:26
ara-slackWARNING ara.server.wsgi: Ignoring request: database directory not found (/var/www/logs/ara-report)12:27
ara-slack[06/May/2020 15:18:55] "GET /ara-report1/ara-report HTTP/1.1" 404 7712:27
ara-slackdmsimard: The wsgi app needs to be loaded with :distributed_sqlite, that's where the magic happens12:28
ara-slackhritz220: how will I do that?12:29
ara-slackdmsimard: What is running the wsgi app ? gunicorn ? apache ?12:29
ara-slackhritz220: I don't know about that ,I installed ARA directly12:31
ara-slackdmsimard: Where are you seeing those warning logs ?12:32
ara-slackhritz220: when I start the server in terminal12:32
ara-slackdmsimard: And how do you do that ?12:32
ara-slackhritz220: ara-manage runserver, this command12:33
ara-slackdmsimard: Ok, so that's the default embedded web development server12:33
ara-slackhritz220: yes ara-web12:33
ara-slackdmsimard: ara-web is something different that is unrelated :p12:34
ara-slackdmsimard: Ok, so12:34
ara-slackdmsimard: Try installing gunicorn (pip3 install gunicorn) and then try to run: gunicorn --workers=4 --access-logfile - --bind 127.0.0.1:8000 ara.server.wsgi:distributed_sqlite12:36
ara-slackdmsimard: Yep, that's the default wsgi application, you need to load the distributed_sqlite one with gunicorn like I mentioned12:39
ara-slackdmsimard: I realize that this part is missing from the docs https://ara.readthedocs.io/en/latest/distributed-sqlite-backend.html12:40
ara-slackdmsimard: I'll create an issue so we can improve docs12:40
ara-slackhritz220: sure I'll try that, Thank you so much for help, I'll update you accordingly.12:41
dmsimardCreated https://github.com/ansible-community/ara/issues/129 for it12:43
dmsimardI'll be busy for a while but let me know how it works out12:44
*** dbpiv has joined #ara12:52
*** k4ch0 has joined #ara13:43
*** k4ch0 has quit IRC13:52
ara-slackdmsimard: @hritz220 if the database is in /var/www/logs/ara-report1/ara-report/ansible.sqlite, what URL are you trying to access it ? http://127.0.0.1/ara-report1/ara-report ? <-- also, can you try a different name than ara-report1 just for the sake of testing that two "ara-report" strings aren't confusing the application ?14:35
ara-slackdmsimard: We can at least tell that the right middleware is loaded because that error is specific to the distributed_sqlite backend: https://github.com/ansible-community/ara/blob/3fa950f5e60aa194e61f8d72ec52e2c619008d9a/ara/server/wsgi.py#L7114:37
*** TKersten has left #ara15:10
ara-slackhritz220: @dmsimard you are right ,the problem was ara-report1, it was confusing the application,when I renamed it, everything is working perfect,and I checked with default middleware, that is also working fine....thank you so much for help.15:27
ara-slackhritz220: @dmsimard but I didn't understood why you told me to use ara.server.wsgi:distributed_sqlite  while the default middleware is working fine, I mean to say, what is the difference between the default middleware and ara.server.wsgi:distributed_sqlite16:06
ara-slackdmsimard: @hritz220 I felt like that was what you were trying to achieve ? You initially mentioned turning on DISTRIBUTED_SQLITE and such16:10
ara-slackdmsimard: the difference with the distributed_sqlite middleware is that it is read only (no writes allowed due to the nature of the backend) and it allows to hosts multiple databases in different locations, all being served from a single instance of the API server16:11
ara-slackdmsimard: it makes sense in the context of CI where you might have jobs running in self-contained sqlite databases and then you upload/host these databases on an API server where they can be served from "dynamic" endpoints16:12
ara-slackdmsimard: if you don't expect to need/want multiple databases, then the distributed_sqlite options and backend aren't necessary16:12
ara-slackdmsimard: the default wsgi application with the default sqlite database backend would work just fine and you'd end up with the database in ~/.ara/server/ansible.sqlite by default16:16
ara-slackdmsimard: the database doesn't need to live in /var/www, so long as the application has access to it it can be anywhere16:16
*** evrardjp has quit IRC16:36
*** evrardjp has joined #ara16:36
*** k4ch0 has joined #ara16:44
*** etienne has joined #ara16:47
ara-slackhritz220: @dmsimard I'm using multiple databases ,one db is in /var/www/logs/some1/ara-report other is in /var/www/logs/some2/ara-report.I'm able to access both db using http://localhost/some1/ara-report and http://localhost/some2/ara-report , Please note that I'm able to do that with default middleware, how is it possible ?16:52
ara-slackdmsimard: I'm not sure :)16:56
ara-slackdmsimard: What is your use case for multiple databases ?17:01
ara-slackhritz220: @dmsimard I'm running different playbooks, one playbook is running at a time but I need to access the data by changing the url.17:13
ara-slackdmsimard: And it wouldn't work if everything would be in a single database ?17:14
ara-slackhritz220: @dmsimard no, one playbook one data.17:14
ara-slackdmsimard: Right but I'm curious for the "why"17:15
ara-slackdmsimard: There are means to differentiate playbook runs in a single database, with labels for example17:15
*** irclogbot_0 has quit IRC17:20
*** irclogbot_1 has joined #ara17:22
*** sshnaidm is now known as sshnaidm|afk17:26
ara-slackhritz220: @dmsimard The task is to link ara server (which is running in ec2 instance) to the jenkins server, and data should be available per job in the ec2 instance, so my plan is to copy the db from jenkins server to ec2 instance , where I should be able to access different db according to  job ID in the ec2 (via loadbalancer, by changing the url).17:27
ara-slackdmsimard: Ah, right, this use case is appropriate17:28
ara-slackdmsimard: You mentioned it wasn't CI related but there's jenkins involved, sorry :p17:29
ara-slackhritz220: @dmsimard actually I was testing on local, but later I've to use it.But honestly I didn't understood the use case of ara.server.wsgi:distributed_sqlite17:32
ara-slackdmsimard: The use case is explained in the docs17:32
ara-slackhritz220: @dmsimard please share the link, it will be helpful17:34
dmsimardI shared it earlier, https://ara.readthedocs.io/en/latest/distributed-sqlite-backend.html17:37
ara-slackhritz220: However, since write concurrency does not scale very well with sqlite, it might not be a good fit if you plan on having a single API server handle data for multiple ansible-playbook commands running at the same time.17:43
ara-slackThe distributed sqlite database backend and WSGI middleware provide an alternative to work around this limitation.17:43
ara-slack@dmsimard so the middleware mentioned in doc(default) and ara.server.wsgi:distributed_sqlite  are same?17:43
ara-slackdmsimard: The default sqlite backend and distributed sqlite are different17:44
ara-slackdmsimard: With your use case in mind, you'd run playbooks from your jenkins jobs (with ansible and ara saving to a local sqlite database) and then at the end of the job you upload that database (scp/rsync) to a server running the distributed sqlite backend and then this will allow you to query that particular database17:46
ara-slackdmsimard: The default sqlite backend is both read/write and isn't designed to be dealing with multiple databases simultaneously17:47
ara-slackdmsimard: so you'd use the default sqlite backend in your jenkins jobs and upload the resulting databases17:47
ara-slackdmsimard: ah, wait -- I misread that a bit17:48
ara-slackdmsimard: there are two components required for it to work -- the database backend ( ara.server.db.backends.distributed_sqlite ) which is automatically selected if DISTRIBUTED_SQLITE is true17:50
ara-slackdmsimard: but you also need the wsgi middleware layer (ara.server.wsgi:distributed_sqlite) to allow the web application to read multiple databases dynamically17:50
ara-slackdmsimard: hope that makes sense17:51
ara-slackhritz220: @dmsimard if DISTRIBUTED_SQLITE is true, does it also  mean ara.server.wsgi:distributed_sqlite  is selected automatically because according to you ,it is not possible with default middleware to read db dynamically.17:57
ara-slackdmsimard: @hritz220 oh, you're right, actually: https://github.com/ansible-community/ara/blob/3fa950f5e60aa194e61f8d72ec52e2c619008d9a/ara/server/settings.py#L104-L10617:59
ara-slackdmsimard: sorry, it's been a bit since I've written this but yeah, it turns out it's made to select the right application automatically18:00
ara-slackdmsimard: good job past me, that was a good idea18:00
ara-slackdmsimard: so I was right that it shouldn't work with the default middleware but it turns out you were using the right middleware all along -- we were both right :tada:18:03
ara-slackhritz220: @dmsimard correct....btw interesting conversation.18:04
ara-slackthanks alot.18:04
*** etienne has quit IRC18:47
*** gvincent has quit IRC20:04

Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!