Seeding Medplum when docker compose
# support
t
Hi, I want to use a real Medplum instance for automation testing purpose. In order to do so I had the following plan : Run docker-compose up Pre-seed an Admin Client Application and then run a script creating Project, and all the necessary using the Admin Client App. I'm currently stuck because I cannot login with the Admin from the script to create the Admin Client Application. In the docker file I see that there is a MEDPLUM_ADMIN_CLIENT_ID: "2a4b77f2-4d4e-43c6-9b01-330eb5ca772f" https://raw.githubusercontent.com/medplum/medplum/refs/heads/main/docker-compose.full-stack.yml Is this suppose to mean that we can somehow pre-fill the medplum app with a client Application. The reason I'm want to have a real medplum instance and not a mock is that we have some use cases where we use super admin client application to do some stuff, and other where we use a project admin client app. I don't think the mock allows to verify this ? Thank you.
s
Not sure about the adminClientId but we did something similar using a node script by logging-in as the default admin@example.com via OAuth and then creating a bunch of orgs/patients/practitioners. The problem with this is that even if you set the correct ProjectMembership for non super user objects, the
.meta.compartment
still has the super user project which causes issues, so we instead signed-up a new user and project using
.startNewUser()
and
startNewProject()
(similar to the UI flow) and then used that user for seeding. There's also the
X-Medplum-On-Behalf-Of
that can be useful for seeding for different users.
c
Hi @thomabig - the
MEDPLUM_ADMIN_CLIENT_ID
setting has been deprecated and removed for a long time. We should remove it from
docker-compose.full-stack.yml
. Apologies for that confusion. We wrote up instructions for how to programmatically setup a cluster for automated testing: https://github.com/medplum/medplum/discussions/2957 I hope that helps. Let us know if you have any questions
t
Awesome @cody ! Yes this helps a lot 🙂 I set this as solved 🙂
Thanks @simonj ! I indeed have the meta informations that are always linked to the main project ! I'm going to check what you suggest 🙂
82 Views