Repository navigation
#3: add a script to create users and run it automatically - #7
Conversation
|
|
||
|
|
||
| # initialize the db (pwd: admin) and create users | ||
| sleep 5 # wait for PG to start... |
There was a problem hiding this comment.
This is not the best solution, but the other solutions I found (e.g. http://stackoverflow.com/questions/35069027/docker-wait-for-postgresql-to-be-running ) seem a bit overkill.
There was a problem hiding this comment.
I'd still add a check if this is actually up after 5sec. so I'd go with this proposed solution:
while ! curl http://$POSTGRES_PORT_5432_TCP_ADDR:$POSTGRES_PORT_5432_TCP_PORT/ 2>&1 | grep '52'
do
sleep 1
doneit's not big overkill and will give you confidence it's up at this point.
|
|
||
| for user in users: | ||
| roles.append(user.capitalize()) | ||
| r = ','.join(roles) |
There was a problem hiding this comment.
It would be nice adding a comment here, that developer has at each point user needs to have his role and all previous ones.
| r = ','.join(roles) | ||
| ic = 1 if user == 'coordinator' else 0 # only coord is committer | ||
| args = ('create user username={u} address={u}@bugs.python.org ' | ||
| 'password=pass realname={u} github={u} roles={r} ' |
There was a problem hiding this comment.
I wouldn't fill in github, it's not required, and might confuse. If one will be needing it, he can always set it.
|
|
||
|
|
||
| # initialize the db (pwd: admin) and create users | ||
| sleep 5 # wait for PG to start... |
There was a problem hiding this comment.
I'd still add a check if this is actually up after 5sec. so I'd go with this proposed solution:
while ! curl http://$POSTGRES_PORT_5432_TCP_ADDR:$POSTGRES_PORT_5432_TCP_PORT/ 2>&1 | grep '52'
do
sleep 1
doneit's not big overkill and will give you confidence it's up at this point.
e167c9c to
c7aabf9
Compare
This PR includes 2 changesets:
rd-admin initare added toinit.shThe final result is that now, when the container is started, it will have an initialized db with 3 default users.