Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait until server is fully started #7

Open
MarkKremer opened this issue Feb 1, 2020 · 6 comments
Open

Wait until server is fully started #7

MarkKremer opened this issue Feb 1, 2020 · 6 comments

Comments

@MarkKremer
Copy link

I had some trouble connecting to the database immediately after this action. This resulted in a "connection reset by peer" error. Adding a sleep action between the actions solved it. However, it would be better if the postgresql action could wait the appropriate amount of time itself by pinging itself or something similar.

I think this would also solve #6 but I'm not sure so therefor this separate issue.

@ihorost
Copy link

ihorost commented Feb 18, 2020

@MarkKremer As a temporary solution, I've changed the CI steps sequence: DB Setup - install dependencies - a step that uses DB.

@pashagolub
Copy link

Guys, can you help me? I cannot make this to work. No way. I've tried a lot already and came with this, but no luck at all:

jobs:

  ubuntu-marketplace:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    steps:
    - name: Setup PostgreSQL
      uses: Harmon758/[email protected]
      with:
        postgresql version: '11'
        postgresql db: 'postgres'
        postgresql user: 'postgres'
    - name: Check Postgres running
      run: |
        sleep 1m
        psql -U postgres -d postgres -h localhost -c "SELECT version()"

Output:

Check Postgres running
1m 1s
##[error]Process completed with exit code 2.
Run sleep 1m
  sleep 1m
  psql -U postgres -d postgres -h localhost -c "SELECT version()"
  shell: /bin/bash -e {0}
psql: could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?
##[error]Process completed with exit code 2.

What've I missed, @MarkKremer, @ihorost?

@MarkKremer
Copy link
Author

I don't see anything wrong with that. This is what I used to debug my problem:

    - name: Wait / Sleep
      uses: jakejarvis/[email protected]
      with:
        time: '10s'
   
    - name: Collect Docker Logs
      uses: jwalton/[email protected]
   
    - name: Check running containers
      run: docker ps -a

(put it after the postgres action)

@pashagolub
Copy link

Thanks @MarkKremer! Docker logs collecter is something I didn' knew. Thanks for that as well! :)

@andrewDoing
Copy link

@pashagolub Did you figure this out? I'm having a similar issue.

@pashagolub
Copy link

@andrewDoing I did it differently since the worker's OS has PostgreSQL preinstalled. Check here: https://github.com/cybertec-postgresql/.github/blob/main/workflow-templates/postgresql-ubuntu.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants