dbprepare: create panel tabels + refactor

This commit is contained in:
boyska 2018-09-30 11:39:49 +02:00
parent b23df82c75
commit ecfa79d654

19
dodo.py
View file

@ -18,6 +18,7 @@ def task_build():
'uptodate': [up2date_anyimages],
'file_dep': ['docker-compose.yml',
'rss-bridge/Dockerfile',
'panel/Dockerfile',
] + list(scan_dir('docker')),
'actions': [COMPOSE + ' build'],
'clean': [run_task_func(task__build_rm),
@ -66,24 +67,24 @@ def stop():
def task_dbprepare():
'''applica il dump sql al container del db'''
'''applica il dump sql al container del db'''
panelcli = 'docker-compose -p feedati exec -T panel ./panelcli -db-pass panelpass -db-addr db:5432 '
psql = r'docker exec -i $(docker ps -aqf name=feedati_db) env PGPASSWORD=superpass psql -h 127.0.0.1 -f - -d feeds superadmin '
return {
'setup': ['_dbprepare_clean', 'build'],
'file_dep': list(scan_dir('docker', '*.sql')),
'actions': [
(COMPOSE + ' up -d db').split(),
(COMPOSE + ' up -d db panel').split(),
(wait_net_service, ('localhost', 5432, 300)),
(wait_pgsql_db, ('feedati_db', 'feeds', 'superadmin')),
'echo LOADING DB',
# dbconf.sql would be better put in /docker-entrypoint-initdb.d/init-user-db.sh
# (see https://hub.docker.com/r/library/postgres/ )
r'docker exec -i $(docker ps -aqf name=feedati_db) '
'env PGPASSWORD=superpass psql -h 127.0.0.1 -f - -d feeds superadmin < docker/dbconf.sql',
r'docker exec -i $(docker ps -aqf name=feedati_db) '
'env PGPASSWORD=ttpass psql -h 127.0.0.1 -f - -d feeds ttrss < docker/ttrss.sql',
'docker run feedati/feedspanel -db-pass panelpass -db-addr db:5432 batch',
r'env PGPASSWORD=ttpass psql -h 127.0.0.1 -f - -d feeds ttrss <<< '
'"GRANT SELECT ON TABLE users.users TO \'apache\'"',
psql + ' < docker/dbconf.sql',
psql + ' < docker/ttrss.sql',
panelcli + 'setup',
panelcli + 'adduser -password password admin ad@m.in',
psql + ' <<< "GRANT SELECT ON TABLE users.users TO \'apache\'"',
'echo DB RESTORED',
],
'teardown': [(stop, [])],