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

Failure to connect to couchdb while migrating #18

Open
1yuv opened this issue Apr 29, 2024 · 5 comments
Open

Failure to connect to couchdb while migrating #18

1yuv opened this issue Apr 29, 2024 · 5 comments

Comments

@1yuv
Copy link
Member

1yuv commented Apr 29, 2024

I've occasionally seen issues while trying to run pre-index-views.

sudo docker compose -f migration_ha.yaml run couch-migration pre-index-views 4.6.0
(node:1) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
An unexpected error occurred Error: Failed to connect to CouchDb. Please verify that the COUCH_URL provided is reachable through docker network.
    at prepareCouchUrl (/app/src/utils.js:44:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.getUrl (/app/src/utils.js:72:3)
    at async dbExists (/app/src/pre-index-views.js:51:17)
    at async getStagedDdocs (/app/src/pre-index-views.js:65:10)
    at async preIndexViews (/app/src/pre-index-views.js:121:23)
    at async /app/bin/pre-index-views.js:13:5

Without changing anythin on my migration_ha.yaml file, I can connect to the COUCH_URL from medic-os docker container.

@dianabarsan
Copy link
Member

Hi @1yuv

To be clear, you're saying the error is transitory and if you try again, the command succeeds?

@1yuv
Copy link
Member Author

1yuv commented Apr 29, 2024

Hi @dianabarsan , retrying the command is not working. I was just trying to mention that the values on my migration_ha.yaml file was corret and using the right credentials.

@1yuv
Copy link
Member Author

1yuv commented Apr 29, 2024

I've found the solution for this by clearing orphan networks and containers and suggest following that for anyone having issues.

sudo docker network prune
sudo docker container prune

@1yuv
Copy link
Member Author

1yuv commented Apr 29, 2024

Hi @dianabarsan , Looks like while I was doing docker network prune, i was giving some time for process to kick off. It looks like, we need to give some time between executing two commands.

sudo docker compose -f docker-compose.yaml up -d
sudo docker compose -f migration_ha.yaml run couch-migration pre-index-views 4.6.0

This time, I didn't try anything and just ran pre-index-views after it failed for the first time.

So,

To be clear, you're saying the error is transitory and if you try again, the command succeeds?

is true.

@dianabarsan
Copy link
Member

I'm not sure why this would happen, there's no intermediary steps that happen within the container. I'm not sure why the docker network would be so flaky.
Can you share your system details?

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

2 participants