Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
430 views
in Technique[技术] by (71.8m points)

docker - Circle CI fails to execute psql command when running rake db:structure:load

So this is my config.yml

version: 2.1

orbs:
  queue: eddiewebb/[email protected]

executors:
  node_postgres_redis:
    docker:
      - image: circleci/ruby:2.4.10-node-browsers
        environment:
          CC_TEST_REPORTER_ID: 7ceff1524bdc09dsd3e232321cf9daa531154170d590823232eddqw2330f3570
          PGHOST: 127.0.0.1
          RAILS_ENV: test
          TEST_REPORT_PATH: "test/reports"
      - image: circleci/postgres:9.6.2-alpine
        environment:
          POSTGRES_USER: circleci
          POSTGRES_DB: circleci-jet-test
          POSTGRES_PASSWORD: ""
      - image: circleci/redis:3.2
  ubuntu:
    machine:
      image: ubuntu-1604:202004-01

commands:
  setup_and_run_test:
    steps:
      - checkout

      # Restore bundle cache
      - restore_cache:
          key: jet-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}

      # imagemagic
      - run:
          name: Setup Image Magick
          command: |
            sudo apt-get install libmagickwand-dev imagemagick imagemagick-6.q16 libmagickcore-dev
            sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16/Magick-config /usr/bin/Magick-config
  
      - run:
          name: Install Bundler
          command: |
            gem install bundler -v 1.17.3

      # Install gem dependencies
      - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle

      # Store bundle cache
      - save_cache:
          key: jet-bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle

      # Database setup
      - run:
          name: Database Setup
          command: |
            bundle exec rake db:create
            bundle exec rake db:migrate
            bundle exec rake db:structure:load

Everythings runs properly until it tries to execute

bundle exec rake db:structure:load

Then it throws this error which is a bit weird

failed to execute:

psql -q -f /home/circleci/circleci-jet/db/structure.sql *****_test

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

I cannot understand this error and what needs to be done on my side.

Anyone with examples, please can show me direction.

Thanks

question from:https://stackoverflow.com/questions/65626566/circle-ci-fails-to-execute-psql-command-when-running-rake-dbstructureload

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...