During startup make postgres owner of PGDATA dir if not already.

Refs #51
This commit is contained in:
Stefan Verhoeven 2018-08-06 16:34:17 +02:00
parent da676bc583
commit c9a98f6ae5
2 changed files with 7 additions and 3 deletions

View File

@ -70,9 +70,6 @@ docker create --name cartodb_pgdata sverhoeven/cartodb
# Change to directory to save the Postgresql data dir (cartodb_pgdata) of the CartoDB image # Change to directory to save the Postgresql data dir (cartodb_pgdata) of the CartoDB image
docker cp cartodb_pgdata:/var/lib/postgresql $PWD/cartodb_pgdata docker cp cartodb_pgdata:/var/lib/postgresql $PWD/cartodb_pgdata
docker rm -f cartodb_pgdata docker rm -f cartodb_pgdata
# Inside container cartodb_pgdata is owned by postgres (uid=103) user,
# it should be owned by same user on the local filesystem
sudo chown -R 103.103 $PWD/cartodb_pgdata
``` ```
After this the CartoDB container will have a database that stays filled after restarts. After this the CartoDB container will have a database that stays filled after restarts.

View File

@ -4,6 +4,13 @@ export CARTO_HOSTNAME=${CARTO_HOSTNAME:=$HOSTNAME}
perl -pi -e 's/cartodb\.localhost/$ENV{"CARTO_HOSTNAME"}/g' /etc/nginx/sites-enabled/default /cartodb/config/app_config.yml /Windshaft-cartodb/config/environments/development.js perl -pi -e 's/cartodb\.localhost/$ENV{"CARTO_HOSTNAME"}/g' /etc/nginx/sites-enabled/default /cartodb/config/app_config.yml /Windshaft-cartodb/config/environments/development.js
PGDATA=/var/lib/postgresql
if [ "$(stat -c %U $PGDATA)" != "postgres" ]; then
(>&2 echo "${PGDATA} not owned by postgres, updating permissions")
chown -R postgres $PGDATA
chmod 700 $PGDATA
fi
service postgresql start service postgresql start
service redis-server start service redis-server start
/opt/varnish/sbin/varnishd -a :6081 -T localhost:6082 -s malloc,256m -f /etc/varnish.vcl /opt/varnish/sbin/varnishd -a :6081 -T localhost:6082 -s malloc,256m -f /etc/varnish.vcl