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

move docker-compose to docker compose #149

Closed
wants to merge 6 commits into from
Closed

Conversation

mrjones-plip
Copy link
Contributor

No description provided.

Copy link

@paulpascal paulpascal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straight 🙌

PS: Don't we need to update the ci.yml file as well and replace docker-compose with docker compose ? (L30, L33, L36)

@mrjones-plip
Copy link
Contributor Author

Good catch on the CI! I've submitted a change (see 55069b4) and I'll try and get CI to run, but seeing some errors just now:

 9e37bf358a5d Pull complete 
 c9fb4b7db943 Extracting [==================================================>]     394B/394B
 c9fb4b7db943 Extracting [==================================================>]     394B/394B
 c9fb4b7db943 Pull complete 
 postgres Pulled 
 Network cht-net  Creating
 Network cht-net  Created
 Volume "cht-postgres-data"  Creating
 Volume "cht-postgres-data"  Created
 Container cht-couch2pg-couch-1  Creating
 Container cht-couch2pg-postgres-1  Creating
 Container cht-couch2pg-couch-1  Created
 Container cht-couch2pg-postgres-1  Created
 Container cht-couch2pg-couch-1  Starting
 Container cht-couch2pg-postgres-1  Starting
 Container cht-couch2pg-couch-1  Started
 Container cht-couch2pg-postgres-1  Started
/usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:84
  var flags = Array.from(process.allowedNodeEnvironmentFlags);
                    ^

TypeError: Cannot convert undefined or null to object
    at Function.from (native)
    at getFlags (/usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:84:21)
    at /usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:142:5
    at /usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:70:14
    at FSReqWrap.oncomplete (fs.js:135:15)
Error: Process completed with exit code 1.

@mrjones-plip
Copy link
Contributor Author

yikes, the small PR turns into a big one!!

After following Diana's advice, I dropped Node 8 in CI test matrix and pinned grunt-cli to latest which is 1.5.0. Rebuilding the image and testing locally with this call:

docker compose  -f docker-compose.test.yml build cht-couch2pg&& \
     docker compose  -f docker-compose.test.yml run cht-couch2pg grunt test

I then got a couch auth error:

====> Waiting on http://cht:cht-password@couch:5984 to appear.
{ [Error: connect ECONNREFUSED 172.20.0.2:5984
  at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)
]
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '172.20.0.2',
  port: 5984 }
====> Waiting on http://cht:cht-password@couch:5984 to appear.
****** ERROR: Unable to connect: http://cht:cht-password@couch:5984

I was unable to connect to the container externally, so I updated the compose file to expose the port and to use a modern couch version. This worked! Tests now showed:

 ✔ Container cht-couch2pg-couch-1     Running                                                                                                0.0s 
 ✔ Container cht-couch2pg-postgres-1  Running                                                                                                0.0s 
Running "eslint:src" (eslint) task

Running "mochaTest:integration" (mochaTest) task

Node Version v10.24.1
- Couch [http://cht:cht-password@couch:5984] is now available.

Now however I'm getting an auth error when connecting to postgres. I note that it's using the MedicOS Postgres image from this Dockerfile from 4 years ago.

This is the error I get:

Failed to connect to postgres server postgres://cht:cht_password@postgres:5432 { [error: password authentication failed for user "cht"
  at Connection.parseE (/app/node_modules/pg/lib/connection.js:600:48)
  at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:399:19)
  at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:115:22)
  at Socket.emit (events.js:198:13)
  at Socket.EventEmitter.emit (domain.js:448:20)
  at addChunk (_stream_readable.js:288:12)
  at readableAddChunk (_stream_readable.js:269:11)
  at Socket.Readable.push (_stream_readable.js:224:10)
  at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
]
  name: 'error',
  length: 99,
  severity: 'FATAL',
  code: '28P01',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'auth.c',
  line: '334',
  routine: 'auth_failed' }

Using postgres://cht:cht_password@postgres:5432 I am indeed unable to connect with the psql command line from my workstation.

Down the rabbit hole I go!! I suspect using modern postgres might be easier?

@mrjones-plip
Copy link
Contributor Author

mrjones-plip commented Feb 10, 2025

As an end of the day effort, I tried bumping to latest postgres docker image (per 56feb85), and I got a lot further! I'm wondering if there's some dependencies in the test scripts that are failing? However there's 12 errors all identical to the first one (same file an line number) - so I suspect Node version error vs schema errors (though schema errors may come next after I unblock node errors)

docker compose  -f docker-compose.test.yml run cht-couch2pg grunt test                 
[+] Creating 2/2
 ✔ Container cht-couch2pg-couch-1     Created                                                                                                    0.2s 
 ✔ Container cht-couch2pg-postgres-1  Created                                                                                                    0.2s 
[+] Running 2/2
 ✔ Container cht-couch2pg-postgres-1  Started                                                                                                    0.4s 
 ✔ Container cht-couch2pg-couch-1     Started                                                                                                    0.4s 
Running "eslint:src" (eslint) task


Running "mochaTest:integration" (mochaTest) task


Node Version v10.24.1
- Couch [http://cht:cht-password@couch:5984] is now available.
====> Waiting on postgres://cht:cht_password@postgres:5432 to appear.
- Postgres [postgres://cht:cht_password@postgres:5432] is now available.
  xmlforms
    1) checks migrations
    2) checks that materialized views have the required columns

  medic-logs db replication
    3) can skip replication
    4) replicates single couch record to the right table on postgres

  replication
    5) replicates different type of couch records to pg

  medic without sentinel db replication
    6) medic replication can be skipped
    7) replicates single couch record to postgres

  medic users meta db replication
    8) can skip replication
    9) replicates single couch record to the right table on postgres
    10) checks migrations

  medic _users db replication
    11) can skip replication
    12) replicates _user record without security information

  safe
    ✓ keeps initial opts and removes passwords from returned obj
    ✓ returns valid couch/pg urls for urls without passwords


  2 passing (8s)
  12 failing

  1) xmlforms
       checks migrations:
     Uncaught Error: Unknown authenticationOk message typeMessage { name: 'authenticationOk', length: 23 }
    at Connection.parseR (node_modules/couch2pg/node_modules/postgrator/node_modules/pg/lib/connection.js:426:9)
    at Connection.parseMessage (node_modules/couch2pg/node_modules/postgrator/node_modules/pg/lib/connection.js:345:17)
    at Socket.<anonymous> (node_modules/couch2pg/node_modules/postgrator/node_modules/pg/lib/connection.js:105:22)
    at Socket.EventEmitter.emit (domain.js:448:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  

@mrjones-plip
Copy link
Contributor Author

mrjones-plip commented Feb 11, 2025

OK! After many hours of trying to get this PR to get CI to a passing state, and after getting some second opinions - I'm going to close this PR. It looks like CI hasn't run in main for a release since 2021 (though I do some passing CI in Actions tab) .

My vote is that we actually hard archive this so no further changes can be made to double down on the soft archive we've already done. I'll take this idea up with the community!

@mrjones-plip mrjones-plip deleted the mrjones-plip-patch-1 branch February 11, 2025 23:21
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

Successfully merging this pull request may close these issues.

2 participants