В виртуальной машине Vagant Compose не может реализовать сохранение данных postgres - PullRequest
0 голосов
/ 08 октября 2019

Мне потребовалась автоматизация vagrant и compose для развертывания моего проекта, но возникла ошибка running bootstrap script FATAL: data directory "/var/lib/postgresql/data" has wrong ownership при составлении сохраненных данных postgres

Неясный раздел выглядит следующим образом

config.vm.define :"vm1" do |node_conf|
    node_conf.vm.synced_folder ".", "/home/vagrant/code" ,mount_options:["dmode=777","fmode=777"]
    node_conf.vm.box = "chaifeng/ubuntu-16.04-docker-18.09"
    node_conf.vm.box_version = "201812.27.0"
    node_conf.vm.box_check_update = false

Права доступа к файламполностью включены из-за ошибки, сообщенной ранее initdb: could not create directory "/var/lib/postgresql/data/pg_wal": Permission denied

vagrant*, ошибка контейнера postgres:

Postgres    | The files belonging to this database system will be owned by user "postgres".
Postgres    | This user must also own the server process.
Postgres    | 
Postgres    | The database cluster will be initialized with locale "en_US.utf8".
Postgres    | The default database encoding has accordingly been set to "UTF8".
Postgres    | The default text search configuration will be set to "english".
Postgres    | 
Postgres    | Data page checksums are disabled.
Postgres    | 
Postgres    | fixing permissions on existing directory /var/lib/postgresql/data ... ok
Postgres    | creating subdirectories ... ok
Postgres    | selecting default max_connections ... 20
Postgres    | selecting default shared_buffers ... 400kB
Postgres    | selecting default timezone ... Etc/UTC
Postgres    | selecting dynamic shared memory implementation ... posix
Postgres    | creating configuration files ... ok
Postgres    | running bootstrap script ... 2019-10-08 09:05:21.290 UTC [78] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
Postgres    | 2019-10-08 09:05:21.290 UTC [78] HINT:  The server must be started by the user that owns the data directory.
Postgres    | child process exited with exit code 1
Postgres    | initdb: removing contents of data directory "/var/lib/postgresql/data"
Postgres exited with code 1

Я посмотрел на проблемы, и все они были связаны с Windows, но я использовал Ubuntu Box. Я не знаю, почему произошла эта ошибка.

Буду очень признателен, если вы, ребята, расскажете мне, почему возникла эта ошибка и как ее решить.

...