/srv/irclogs.ubuntu.com/2014/05/18/#juju.txt

=== vladk|offline is now known as vladk
=== vladk is now known as vladk|offline
=== vladk|offline is now known as vladk
=== vladk is now known as vladk|offline
=== vladk|offline is now known as vladk
=== CyberJacob|Away is now known as CyberJacob
=== vladk is now known as vladk|offline
=== vladk|offline is now known as vladk
nottrobinis there a standard place to store information about relations?15:15
nottrobininside juju instances?15:16
nottrobinI'm writing a charm that requires mongodb15:16
nottrobinand I have a hook called "mongodb-relation-joined"15:16
nottrobininside that hook, I need to store the hostname of the joined environment so my application can retrieve it to connect to it15:17
nottrobinhow should I do that?15:17
Tugnottrobin, I think what you are looking for are the `relation-set` and `relation-get` commands15:56
nottrobinTug: I can use relation-set and relation-get in my hook to retrieve / store the details of the relation, but what about my application? It can't be expected to know it's running in a juju environment. But it still needs to know what hostname to look for mongodb on15:58
Tugnottrobin, I guess you either have to start your app from the charm or modify a config file15:58
Tugor set environment variables15:59
nottrobinTug: right. I'm trying to make the charm as generic as possible - IE have very little knowledge of the app's structure15:59
nottrobinTug: yeah I was thinking of setting environment variable15:59
nottrobinTug: but that seems to be impossible using Python15:59
Tugnottrobin, you can do bash commands in Python16:00
bodie_does anyone know whether it's possible to use coreos fleet as a deploy target with juju somehow?  can I write an extension provider if that option doesn't yet exist?16:00
nottrobinTug: but you can't set environment variables16:01
nottrobinTug: http://stackoverflow.com/questions/1506010/how-to-use-export-with-python-on-linux16:01
Tugnoodles775, https://docs.python.org/2/library/os.html#os.environ16:02
Tugsrry16:02
Tugnottrobin, https://docs.python.org/2/library/os.html#os.environ16:02
nottrobinsetting an environment vaiable would be my perfect solution but I can't work out how to do it16:02
nottrobinTug: right, but os.putenv fails16:02
nottrobinyou can happily set the local os.environ dictionary, but it won't actually update the environment16:03
TugI personnaly don't like environment variables, it's not a clean way to pass information (imo)16:03
nottrobinit's perfect for information about the environment16:04
Tugyeah for a program16:04
nottrobinright16:04
Tuglike DEBUG=true start_my_prog16:04
Tugout of curiosity, what type of application is it ?16:05
nottrobinwsgi16:05
nottrobinthe one I'm testing it with is django, but it could be flask or werkzeug16:06
Tugmm I see, have you looked at the python-django charm to see how they did it ?16:07
nottrobingood idea, I'll have a look16:08
Tuglook like they are modifying an upstart script16:08
Tugdid look for long16:08
Tug* I did not look for long16:08
nottrobinTug: where did you see that?16:14
nottrobinTug: I can see it writes the DB settings to <app_dir>/juju_settings/20-engine-%(engine_name)s.py16:15
nottrobinTug: but I can't see how that file then gets used16:15
nottrobinTug: yeah the settings get read by some lines injected at the bottom of settings.py16:20
nottrobinTug: a very django-specific solution16:20
hazmat`bodie_, not really re coreos.. not entirely sure how that would work, you could run full os ubuntu containers inside of a coreos machine, and then basically register them as machines for a juju deployment.. i've got some simple client side plugins that do api machine provisioning for digital ocean, etc. if your going down that road.. alternatively getting charms that directly do docker (for image based deploys) else its just the container as a machine.16:21
hazmat`nottrobin, reading backlog, but typicaly way to address this issue is to have a standard way to configure your application, that the hooks can inject/render the relation config into16:22
hazmat`Tug, just about every paas uses env variables to pass config in... (heroku, dotcloud, cloudfoundry, openshift) etc.16:24
hazmat`its effectively the lowest common denominator across language runtimes.. but agreed that it has caveats (runtime manipulation etc)16:24
hazmat`nottrobin, ie. your app reads config from file, and hooks write that file, and can either restart the process, or send signal if they change it.16:25
hazmat`nottrobin, which wsgi framework out of curiosity?  pyramid and django both make this easy... flask requires some mucking about to get the plumbing right (re config from file) imo.16:26
nottrobinhazmat`: the projects I want to use it with at the moment are flask and django16:27
nottrobinhazmat`: that's why environment variables are perfect16:27
* hazmat` nods16:27
nottrobinhazmat`: if I can just say "the mongodb hostname will be in the environment variables "MONGODB_HOST"16:28
nottrobinhazmat`: than writing your app to make use of that is simple16:28
nottrobin*then16:28
hazmat`nottrobin, so i'd suggest an upstart file which sources an environment file for each then.. alot of packages do this.. ie source /etc/default/$package_name  in a pre-exec upstart script16:28
hazmat`though you might want a different location than that.. but then the hooks just write to the env variable file, and restart the service after modifying the config16:29
nottrobinhazmat`: right so charmhelpers has a helper method which saves "export ..." lines into a scriptrc file inside the charm directory16:29
nottrobinhazmat`: but I couldn't work out how that file then gets sourced16:29
nottrobinhazmat`: do you know of a link that could explain how to configure upstart scripts to me?16:30
nottrobinhazmat`: I'm relatively new to this charming stuff16:30
lazyPowernottrobin: upstart has some really complete documentation. http://upstart.ubuntu.com/cookbook/16:31
hazmat`nottrobin, so re upstart looking at the docs (cookbook) or extant ones in packages is pretty good. it might be easier to just have a wrapper script that execs  the actual startup after sourcing your env variable file.16:31
lazyPowerdont let that page intimidate you, in practice you usually only  need ~ 5 or 6 lines to build an upstart job that will do what you want it to do.16:32
lazyPowero/ hazmat`16:32
nottrobinhazmat`, lazyPower: thanks I'll get reading16:33
* hazmat` heads out to the airport16:33
lazyPowernottrobin: here's a good example upstart script for you: https://github.com/chuckbutler/starbound-charm/blob/master/contrib/starbound-universe.conf16:34
lazyPowerthe only thing i read in the feedback above it doesn't exhibit is the environment variables. which are set with an 'env' keyword.16:35
nottrobinlazyPower: presumably it could source a file which did the actual exporting of variables16:36
lazyPowerright16:37
=== vladk is now known as vladk|offline
cruisibesareshey juju guys. I just joined your mailing list the other day as im trying out this technlolgy for a proof of concept. I see that there has been a substanital amount of work on the vagrant provider recently which is great. I personally would like to use maas with virutal box so it will mirror my final deploy as close a possible. I found this blog post http://marcoceppi.com/2012/05/juju-maas-virtualbox/ and got that all set up and run19:36
cruisibesaresning. I got annoyed about having to power up all the boxes by hand durning commissioning so i built a little listener in go that basically just listens for the wake on lan packet and then look through the virutalbox boxes on the virulization host and uses the command line to power the right box on. So far it works like a charm (no pun intended) the only thing that is still kinda annoying me is that i have to use the gui to set the p19:36
cruisibesaresower type for each of the servers to wol of each server. This is more of a maas issue but is there a way that i can configure maas so that it will always use the wol power type by default?19:36
lazyPowercruisibesares: you can use KVM in leu of VirtualBox with the virsh provider to achieve non-manual powerup/powerdown19:37
lazyPowerI'm using that on a server i have here in my house with great success.19:37
lazyPoweri'm not really familiar with Virtualbox's WOL capabilities, unfortunately19:38
cruisibesaresyeah it doesn't have any by default19:47
cruisibesaresi just built a service that listens on port 9 and then calls the api19:48
cruisibesaresthe wol protocol is easy enough and i wanted to keep it on my mac19:48
cruisibesaresthat all works now somehow haha19:48
cruisibesaresonly hichup that i have at this point is the fact that after i run this maas maas nodes accept-all19:50
cruisibesaresthey all have power type set to19:50
cruisibesares--------19:50
cruisibesaresif this makes no sense at all i can write it up a little better provide some examples and push it up to the maling list19:51
cruisibesaresoops sorry network dropped out for a second19:52
lazyPowercruisibesares: it's an interesting use case, and I think others would benefit from your experience. If you have the time to post to the list, i'd love to read up on your specific testing implementation.20:00
cruisibesaresalright i20:00
cruisibesareswill fix up the read me and post what i have soon20:01
cruisibesaresi think that im going to need to tweak the enlist_userdata file but i would like to avoid messing around with files included in the package20:09
=== CyberJacob is now known as CyberJacob|Away
jokokayt ythhrt q;pk g23:28

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!