Hi all. I had the idea that I'd try to set up a Vagrant-box (virtualization thingy) that replicates the WF environment as closely as possible, to use as a staging server of sorts for my Django project (+ Gunicorn + Redis + Celery + Supervisor etc...). Basically the goal is to learn how all of these things fit together in an environment that is at least somewhat close to the final WF environment. Now, I'm out of my depth here, being mostly a frontend-guy who dabbles, but I've come this far and damned if I should give up now. But fair warning: fuzzy questions ahead. I'm provisioning the box with the stuff I need via a bash-script that Vagrant runs as root for me upon creating the virtual CentOS 6.4 machine, installing Python2.7 and all the other dependencies I might need, creating folder structure that replicates the home folder structure I have on WF etc. So far so good, after much sweating/swearing. Now, the last piece of the puzzle is getting PostgreSQL up and running - which I have done, installation-wise, but I'm having issues with grasping how to programmatically create and set password for the DB user I'd like to use for connecting from django. I've got the thing down to having Postgres + Psycopg2 working as far as I can tell, so it's just the step where I create the actual db. It's only for testing/staging purposes, so security is not important. Stuff that confuses me:
So, as you can see, I'm out of my depth, but soo close to having this thing work, and then I can be done with it. Frantic googling gives me a host of articles that give hints, but they all skip various parts of the process (and almost always rely on being done in an interactive shell), which makes it insanely hard to piece it together. So a gentle nudge or snippet to push me in the right direction would be much appreciated. Thanks. asked 08 Aug '13, 04:59 thatemil |
Our setup doesn't do anything fancy with PostgreSQL users and roles. In general, you have a single DB user who is the owner of a single DB (although you can have additional users if you need to). Each user is set up in
If you want to script the creation of the user and database in bash without prompting for user input, then you can do it like this: First, create a
Then, as that user, you can execute the following commands from bash to create the user and database:
Finally, be sure to reload or restart your PostgreSQL service to pick up the changes to Hope that helps! answered 08 Aug '13, 11:45 seanf Sorry for the late accept & thanks! I forgot about asking this question and assumed that I'd get an email notification (which I didn't, or it got caught in a spam filter or something...)
(28 Mar '14, 09:14)
thatemil
|