5 ms·
Which translates to: I basically don't want to use it. At least not for development. Not as a means to abstract away the setup of something like Postgres; Docke
by hasenj 9y ago
Which translates to: I basically don't want to use it. At least not for development. Not as a means to abstract away the setup of something like Postgres; Docker has its own complications when it comes to setting things up, which I must learn _in addition_ to learning everything related to setting up Postgres.
- bschwindHN 9y agoRunning Postgres in a container for development environments is one of the best features of Docker in my opinion. It's really not hard to set up at all. Install docker and docker-compose, write a simple docker-compose.yml file, and then `docker-compose up -d` in the same directory as the docker-compose.yml file. You now have a full Postgres instance running on your machine at localhost:5432. Stop it with `docker compose down` DB files are stored in the `pg` folder in the same directory as docker-compose.yml. You can specify this on the `volumes` property. docker-compose.yml: version: '2' services: pg: image: postgres:9.4.10 ports: - "5432:5432" volumes: - $PWD/pg:/var/lib/postgresql/data/pgdata environment: - PGDATA=/var/lib/postgresql/data/pgdata - POSTGRES_DB=YOUR_DB_NAME_HERE - POSTGRES_USER=YOUR_DB_USER_NAME_HERE - POSTGRES_PASSWORD=YOUR_DB_PASSWORD_HERE
- nh2 9y agoInstead of doing all of that, you could also do it without docker. Simply install postgres via your Linux distro and run e.g.: /usr/lib/postgresql/9.5/bin/postgres -D .mydatadir
- bschwindHN 9y agoSure you can do that, but if your app needs to use other services (Redis, for example) you can easily throw that in the compose file as well, and then it's easy to maintain versions and have every developer be on the same page. This is especially helpful if some developers use OS X or Windows. I don't understand the "all of that" phrasing, as if what I just described was a large amount of work.
- hasenj 9y agoWhy would I want to use redis? My whole point is that I want to simplify my setup, so that I don't need tons of third party servers.
- bschwindHN 9y agoDo you reimplement caching and data storage on every new project? Redis is just one example. Surely in any major project you've made use of a third party server? Maybe not, but tons of projects do and I'm simply describing an easy way to manage those services in a development environment. What's so hard to understand about this?
- ComputerGuru 9y agoHow many people run webwpps with changing version requirements for their _database_? Docker is useful for running components of your own code or for isolation, not for managing versions of core applications like a database or a mail server for most people deploying ready-made apps.
- bschwindHN 9y agoDifferent web apps may use differing DB versions, it happens. I'm merely suggesting docker compose is a fairly simple way to handle this without managing global installations on a dev machine. Keep in mind this is for local development only, I wouldn't use a docker hosted DB in production though you certainly could if you wanted to. I've tried several different dev environment setups and this approach yields the fewest frustrations and inconsistencies. Production is a different story but that's not what I'm discussing here.
- ComputerGuru 9y agoI'm not trying to beat a dead horse here, but what kind of app runs on a database version 5 but not version 6 (for example)? I can see an app relying on features not available in older releases, but databases - of all software - have rock-solid backwards compatibility.