lcreid / rails-5-jade

Rails 5 with Jekyll and Node on Ubuntu 18.04
MIT License
29 stars 3 forks source link

Move Postgres data files to /vagrant directory #14

Open lcreid opened 7 years ago

lcreid commented 7 years ago

When we upgrade a box, we lose all the Postgres data files. For a development box, that's not a big problem, but it would be nicer if the Postgres data files were in /vagrant somewhere, like /vagrant/db.

lcreid commented 7 years ago

The Ubuntu install puts the data files in /var/lib/postgresql/9.5/main/, and the configuration files in /etc/postgresql/9.5/main/ (at least for version 9.5 of Postgres). The start-up file is in /etc/init.d/postgresql.

There appears to be a concept of an "environment" that I might be able to take advantage of.

lcreid commented 7 years ago

If the installation works with the directories already in place (it should as that would be the upgrade case), then I'm beginning to suspect that the best way would be to make a symbolic link for all the Postgres directories to somewhere on /vagrant (remembering that the Rails db directory won't be there yet). That would mean adding something to .gitignore as well, which also won't be there on initial install.

Maybe there's another approach. If too many things have to be done after the Vagrant box is up, perhaps I should just automate the Postgres part e.g. a rake task or something.