nextgenhealthcare / connect-docker

Official Dockerfiles for Connect https://hub.docker.com/r/nextgenhealthcare/connect
Mozilla Public License 2.0
78 stars 51 forks source link

How to start a connect container with pre-configured channels? #9

Closed bluepuma77 closed 2 years ago

bluepuma77 commented 4 years ago

nextgenhealthcare/connect works great so far, I have started the container with some open TCP-Ports, changed the password and deployed some channels to receive HL7v2 messages over MLLP.

docker run \
  --name hl7-connect \
  --link hl7-postgres:postgres\
  --restart=unless-stopped \
  -p 8080:8080 \
  -p 8443:8443 \
  -p 7000-7100:7000-7100 \
  --env DATABASE=postgres \
  --env DATABASE_URL=jdbc:postgresql://hl7-postgres:5432/db \
  --env DATABASE_MAX_CONNECTIONS=20 \
  --env DATABASE_USERNAME=db \
  --env DATABASE_PASSWORD=db \
  --env VMOPTIONS=-Xmx512m \
  -d nextgenhealthcare/connect

Now with everything stable, I would like to automate the full configuration and start of connect and the channels. What's the best practice to do this programatically when starting a new container?

  1. Change user/pass used to connect with the GUI
  2. Import channels from XML file
  3. Deploy and start the channels
bluepuma77 commented 4 years ago

It would be great to be able to set the NextGen Connect admin user/pass with Docker variables like the ones for database access

--env CONNECT_USERNAME=username
--env CONNECT_PASSWORD=secret

Can I just write user/pass into the database or is there a command line tool I can use?

bluepuma77 commented 4 years ago

After further research I found in the User Guide the instructions on page 460 to set the password to the default "admin".

UPDATE PERSON_PASSWORD SET PASSWORD = 'YzKZIAnbQ5m+3llggrZvNtf5fg69yX7pAplfYg0Dngn /fESH93OktQ==' WHERE PERSON_ID = ?;

Is there no method to set a new password from CLI?

cturczynskyj commented 4 years ago

If the CLI is proving inadequate, you could try switching over to the rest API (https://:8443/api/). The rest API is guaranteed to support all functionality since that is what the Administrator UI uses to configure Connect servers.

aristotelos commented 10 months ago

@cturczynskyj I have the same wish as @bluepuma77:

I am aware that the most stable way of getting this functionality is changing the mcserver executable so that it allows this parametrization on startup. What do you think, would that be an option?

tonygermano commented 10 months ago

@aristotelos I think it would be worth making the second request in the main repo, as it is not specific to docker and could be useful with other install methods.

I mentioned the problems with the first request on this issue https://github.com/nextgenhealthcare/connect-docker/issues/5

Since then, there has been some discussion in Slack, and probably the best way to achieve what you want is with a custom plugin that will activate after the mirth server has completed configuring the new database and started up. It can then acquire the channel definitions and import them automatically.

This is also not docker specific, but it works well with the docker container because the plugin loading mechanism allows you to have them installed on first run rather than installing them after the server is running and rebooting.

aristotelos commented 10 months ago

@tonygermano Thank you, created https://github.com/nextgenhealthcare/connect/issues/6037.