pgadmin działa

master
Michał 'rysiek' Woźniak 2015-01-06 20:05:56 +01:00
parent 4ec43500aa
commit c1fe3b7b24
3 changed files with 38 additions and 6 deletions

View File

@ -28,7 +28,7 @@ ADD start.sh /var/lib/start
EXPOSE 5432
# Add VOLUMEs to allow backup of config, logs and databases
VOLUME ["/var/lib/postgresql/"]
VOLUME ["/var/lib/postgresql/", "/var/log/postgresql"]
# Set the default command to run when starting the container
CMD ["/var/lib/start"]

View File

@ -9,7 +9,13 @@ if [[ `whoami` != 'root' ]]; then
exit 1
fi
# work the directory
# work the directories
# - log
mkdir -p /var/log/postgresql
chown -R postgres:postgres /var/log/postgresql
chmod -R 0700 /var/log/postgresql
# - data
mkdir -p /var/lib/postgresql
cd /var/lib/postgresql
chown -R postgres:postgres ./
chmod -R 0700 ./
@ -21,9 +27,23 @@ if [ ! -e /var/lib/postgresql/9.3/main ]; then
su -c '/usr/lib/postgresql/9.3/bin/initdb /var/lib/postgresql/9.3/main' postgres
# config
echo "
listen_addresses='*'
log_destination = 'stderr'
logging_collector = on
log_directory = '/var/log/postgresql'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_file_mode = 0600
log_rotation_age = 1d
log_rotation_size = 10MB
log_connections = on
log_hostname = on
log_timezone = 'UTC'
" >> /var/lib/postgresql/9.3/main/postgresql.conf
# auth
# TODO: this needs to be much mroe specific for production!
echo "host all any `hostname -I | sed 's/ //g'`/16 trust" >> /var/lib/postgresql/9.3/main/pg_hba.conf
echo "listen_addresses='*'" >> /var/lib/postgresql/9.3/main/postgresql.conf
echo "host all all `hostname -I | sed 's/ //g'`/16 trust" >> /var/lib/postgresql/9.3/main/pg_hba.conf
# create the needed databases
/etc/init.d/postgresql start

View File

@ -143,10 +143,10 @@ cnt_cron="$prefix-cron"
#
# czyścimy
# stopujemy (w tym zawsze przy domyslnej akcji)
#
if [[ "$mode" == "" || "$mode" == "--kill" ]]; then
if [[ "$mode" == "" || "$mode" == "--stop" ]]; then
docker stop $cnt_postgres $cnt_nginx_public $cnt_nginx_internal $cnt_phpfpm_frontend $cnt_phpfpm_rest $cnt_pgadmin $cnt_phpfpm_ldapadmin $cnt_cron
docker kill $cnt_postgres $cnt_nginx_public $cnt_nginx_internal $cnt_phpfpm_frontend $cnt_phpfpm_rest $cnt_pgadmin $cnt_phpfpm_ldapadmin $cnt_cron
@ -154,6 +154,17 @@ if [[ "$mode" == "" || "$mode" == "--kill" ]]; then
fi
#
# killujemy
#
if [[ "$mode" == "--kill" ]]; then
docker kill $cnt_postgres $cnt_nginx_public $cnt_nginx_internal $cnt_phpfpm_frontend $cnt_phpfpm_rest $cnt_pgadmin $cnt_phpfpm_ldapadmin $cnt_cron
docker rm -v $cnt_postgres $cnt_nginx_public $cnt_nginx_internal $cnt_phpfpm_frontend $cnt_phpfpm_rest $cnt_pgadmin $cnt_phpfpm_ldapadmin $cnt_cron
fi
#
# odpalamy kolejno dockery
#
@ -165,6 +176,7 @@ if [[ "$mode" == "" || "$mode" == "--run" ]]; then
# postgres wpierw, inne się doń łączą
docker run -d \
-v "$static_data_dir/data/postgres":/var/lib/postgresql/ \
-v "$static_data_dir/logs/postgres":/var/log/postgresql/ \
--name $cnt_postgres \
$img_postgres