There is a basic database example in the docs, https://circleci.com/docs/2.0/postgres-config/, but it’s all ruby, and while I can kind of infer what’s going on, I’m not sure how to translate to a more generic set up.
I’m trying to instantiate a postgres database to use with a Symfony app. I have a schema that I want to import and to connect to the symfony app.
But, psql isn’t in the path, and docker doesn’t run, so I can’t connect using the docker network. Any more basic v2.0 examples?
Oh, Also, I keep running into problems installing the postgres client.
dpkg: dependency problems prevent configuration of postgresql-client:
postgresql-client depends on postgresql-client-9.6; however:
Package postgresql-client-9.6 is not configured yet.
I’m starting to wonder if this is an issue with the php image I’m pulling down. Using the circleci/python:3.6.2-stretch-browsers image and I can connect to the postgres db, but using circleci/php:7.1-cli-node-browsers the same connection doesn’t work.
I’m not sure how these would be different
Did you try installing postgresql-client-9.6 first? I don’t have a whole lot of experience with Symfony so i’m in the boat with a single paddle here. Searching around on GitHub I did see some example projects I think. This project here looks like a Symfony boilerplate that’s already configured to run on CircleCI 2.0. You might be able to draw some insights from it.
Use a primary build container and a secondary PostgreSQL container (your current approach)
Install PostgreSQL server in your build container from the distro repo
Either is good really, and what you’ll prefer probably comes down to what is fastest. I’d wager there is not much in it.
If you are happy to go for the second option, then installing the database server on the build container will give you everything you need to connect. You then just need to install php-pgsql. I have shown how to do something similar with MySQL here.
thanks halfer. I was looking at both these approaches. The “just install php-pgsql”(that’s what I thought too), turns out to be a lot harder than expected, for one the php postgres module needs to be installed and enabled.
In general, the extension should not need manual enablement in an ini file - installing pdo_pgsql should write a child ini file automatically to turn it on, at least in Ubuntu. You can always put a php -i in your build process after the installation, to see if it was successful.
It looks like there’s a configuration error that’s coming all the way from Debian. I don’t know when it will come down to ubuntu, so I needed to find another solution.
Wrapping the command in a shell script turned out to work. The client tools are available, and the config error dies a quiet death. Run all test steps even if one fails Run all test steps even if one fails