Moving Rails app to 2.0, psql does not exist error



I am trying to migrate a Rails app from 1.0 to 2.0. After so many trials and errors builds, I was able to create the database, but when it tries to load the structure, I get an error:

#!/bin/bash -eo pipefail
bundle exec rake db:create db:structure:load --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:create
Database 'db_test' already exists
** Invoke db:structure:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config 
** Invoke db:check_protected_environments (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:check_protected_environments
** Invoke strong_migrations:safety_assured (first_time)
** Invoke environment 
** Execute strong_migrations:safety_assured
** Execute db:structure:load
rake aborted!
failed to execute:
psql -q -f /home/circleci/myapp/db/structure.sql db_test

Please check the output above for any errors and make sure that `psql` is installed in your PATH and has proper permissions.

so far, my config.yml is like this:

version: 2
    working_directory: ~/myapp
      - image: circleci/ruby:2.4.1-node
          RAILS_ENV: test
          RACK_ENV: test
          PGHOST: localhost
          PGUSER: postgres
      - image: circleci/postgres:9.6.2-alpine
          POSTGRES_USER: postgres
          POSTGRES_DB: db_test

      - checkout

      # Restore bundle cache
      - type: cache-restore
        key: myapp-{{ checksum "Gemfile.lock" }}

      # Bundle install dependencies
      - run: bundle install --path vendor/bundle

      # Store bundle cache
      - type: cache-save
        key: myapp-{{ checksum "Gemfile.lock" }}
          - vendor/bundle

      - run: bundle exec rake assets:precompile

      # Database setup
      - run: bundle exec rake db:create db:structure:load --trace

      - type: shell
        command: bundle exec rake spec

      - type: shell
        command: bundle exec rake teaspoon

Am I missing something or the postgres image is just wrong?


Here is the answer of my problem: Psql is not installed on ruby:2.4.1-node


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.