Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 480  / 3 Years ago, sat, july 24, 2021, 2:43:24

I am creating a Juju charm to encompass many Django development projects. I have the charm installing Django, wsgi, and Apache2. Django uses a separate database, user, and password for every project created. How do I provide these credentials to the charm when the mysql charm has only one set of database credentials? I would like to parse the python paths for all installed Django projects and have a mysql charm ready to use with them.
As you can see below, the user will have to set these manually and change them when a new/different Django project is deployed to the cloud.



user=`relation-get user`
password=`relation-get password`
host=`relation-get host`
database=`relation-get database`


My question: Do I need to create a bash script to auto-create mysql charms with a correlating name to the Django project?


More From » bash

 Answers
1

You can create a new mysql charm with a new interface that can allocate dbs dynamically when requested and use that from your django charm, or deploy the projects as individual services.



Effectively the new interface for mysql would have the hooks allocate new dbs as requested by the connecting service, instead of creating them when the new service is related/connected to mysql.



Another alternative, fix your django projects to use table prefixes, which I thought they already did (or maybe that's app table prefixing with project).



Edit



The best solution might be to just use an admin interface relation, which gives you the root user on mysql and then you can create additional dbs as needed (pointed out to me on irc by clint) for all the django projects installed.


[#38191] Sunday, July 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rstride

Total Points: 305
Total Questions: 112
Total Answers: 118

Location: Mali
Member since Sat, Dec 26, 2020
3 Years ago
;