Tag: postgresql

Docker for ruby on rails app

I have a ruby on rails application in my local machine which has Nginx, Phusion passenger, PostgreSQL, Redis as its associated components.How can I create a docker container with all these software/images? Is it possible to run a Cron job in Docker container? I am a starter in docker. Thanks in advance.

Postgresql Docker run retain database

I docker pull from docker pull mdillon/postgis and use a data only volume container for Postgis. When I create another Postgis container with the same database name and credentials and link the data only volume container –volumes-from to that image, all databases within that container get dropped. Is there a way / parameter to retain […]

Can't import own python module in Postgresql plpython function

I created my own python module and packaged it with distutils. Now I installed it on a new system (python setup.py install) and I’m trying to call it from a plpython3u function, but I get an error saying the module does not exist. It was working on a previous Ubuntu instalation, and I’m not sure […]

Rails and docker Postgress Too many connections

Hi I have been writing the cucumber tests for the rails app and when I submit the form I see below error in sneakers-production.log. p-218 t-oxb8ghw04 ERROR: [worker-server.build:1:8xy5vt][#<Thread:0x007fe7f4dfb888>][server.build][#<Sneakers::Configuration:0x007fe7f4e00770>] unexpected error [Exception error=”FATAL: sorry, too many clients already\n” error_class=PG::ConnectionBad backtrace=/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout’,/usr/local/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout’,/usr/local/bundle/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in […]

Schema created in Docker by postgres user does not exist

I am building a Docker container for my PostgresSQL 9.4.5 database and I’d like to create the table structures when the container starts. In the script included in my /docker-entrypoint-initdb.d/ directory is this series of commands: #!/usr/bin/env bash export PGUSER=postgres echo “***CREATING DATABASE, USERS, AND ROLES***” psql <<-EOSQL CREATE USER vpager WITH PASSWORD ‘<pass>’; CREATE […]

postgres $HOME directory unproperly set in Docker container created from official postgres Dockerfile

I’ve created a PostgreSQL 9.1 Docker container using this official Dockerfile. To create my container, I’ve done this: Step 1: create a volume for permanent postgres data docker volume create –name postgres_data Step 2: Start the postgres instance docker run –name my_postgres_container -e POSTGRES_PASSWORD=my_password -v postgres_data:/var/lib/postgresql/data -d postgres:9.1 My instance starts correctly, and I can […]

How to use docker to spin up postgres database

I’m trying to have my app code communicate with my postgres db, each of which is running in separate container. However, whenever I attempt to access my db, I keep getting “dial tcp getsockopt: connection refused” which I understand to mean that there is nothing listening on port 5432. But I don’t understand how […]

slow pg_restore on docker container startup

I have dockerized my PostgreSQL DB (about 4GB of data). It is working fine on my notebook (linux, 2core CPU, SSD, 8GB RAM). I am trying to move it using docker hub to free AWS EC2 t2.micro. On startup of container, there are executed some scripts, that set up structure of schema and tables and […]

Connecting a Play! application to a postgres (with Postgis) database with Docker-compose

I’m trying to start my Play! 2.4 application using a Postgres database with Docker-compose. I manage to start my Play! application alone (but it doesn’t work since it can’t connect to the database). And I also manage to start my postgis database using the image mdillon/postgis:9.4. My Dockerfile is: FROM mdillon/postgis:9.4 ADD init.sql /docker-entrypoint-initdb.d/ Here […]

Postgres DB Password not being set in Kubernetes script

For some reason, the postgres instance isn’t being locked down with a password using the following kubernetes script. apiVersion: v1 kind: ReplicationController metadata: name: postgres labels: name: postgres spec: replicas: 1 template: metadata: labels: name: postgres spec: containers: – resources: image: postgres:9.4 name: postgres env: – name: DB_PASS value: password – name: PGDATA value: /var/lib/postgresql/data/pgdata […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.