Building medplum on EKS on Deploy medplum on EKS
# support
s
Hi guys, I am building own docker images to deploy that on my eks, the commands include same things as of Run stack in local, when i run it in eks as a docker image but its running lots of sockets and i am not able to connect to application even from localhost, below i am sharing few details, any help will be highly appreciated Dockerfile FROM node:20-slim WORKDIR /usr/src/medplum copy . . # Install dependencies, create non-root user, and set permissions in one layer RUN npm install && \ npm run build:fast EXPOSE 3000 CMD ["sh", "-c", "cd packages/server && npm start"] build command docker build --platform linux/amd64 -t medplum-server-backend . lsof output from pod grep 3000 node 20 root 18u IPv6 53048 0t0 TCP *:3000 (LISTEN) node 20 root 20u IPv6 68126 0t0 TCP localhost:3000->localhost:54654 (ESTABLISHED) and lot more like this and pod logs > @medplum/server@3.2.13 start > node --require ./dist/otel/instrumentation.js dist/index.js {"level":"INFO","timestamp":"2024-09-23T12:38:25.817Z","msg":"Starting Medplum Server...","configName":"file:medplum.config.json"} {"level":"INFO","timestamp":"2024-09-23T12:38:35.287Z","msg":"Already seeded"} {"level":"INFO","timestamp":"2024-09-23T12:38:35.386Z","msg":"Loaded 1 key(s) from the database"} {"level":"INFO","timestamp":"2024-09-23T12:38:35.407Z","msg":"Server started","port":3000} and i am getting 504 getway timeout when i run loclhost:3000/healcheck inside the pod
r
Hi @swamy_63747 , i noticed that you've mapped port :3000 to the external port. Please note that when running locally,
:3000
refers to the Medplum APP, but
:8103
refers to the server
Did you mean to expose port`:8103` for the API server?
s
Yes Rahul in the medplum.config.json file I have mentioned that port:3000 That's why I am using port 3000
Yes server also I am trying to run on port 3000
Same happened with port 8103, that I am not able to connect, getting 504 that's why I tried with 3000 port on api server
Hi @rahul1 even I tried with 8103 port it's same, I can see multiple ports are running, is there any documentation on running medplum in eks or are there any helm charts
https://github.com/medplum/medplum/blob/main/packages/server/README.md this file says under scripts/deploy-server.sh generate .tar.gz file for docker but this script is for ecs and its not generating any tar files
r
Hi @swamy_63747 , unforutnately right now we only support ECS, so we can't advise on the specificis of EKS and helm
s
Rahul but the docker image that you are providing that we can run in eks right
When we run that in eks by just changing RDS and redis host, still it's not responding back
We narrowed it down, it's something related to redis, do we have any documentation on AWS redis config required for medplum
a
Hi @swamy_63747 , I looked in couple places for you and found some information here https://www.medplum.com/docs/self-hosting/config-settings#server-config on how to point AWS deployment to Redis instance. However I noticed that you started your journey with container built for local environment and this tells me that the settings are taken from medplum.config.json that needs just host, port and secret for Redis. As for Redis setup in AWS manually I would take a look at packages/cdk/src/backend.ts that sets it up for ECS deployment. As it is external from ECS and EKS service it should not be different for your case as well. More here are some Redis cluster properties you want to configure: this.redisCluster = new elasticache.CfnReplicationGroup(this, 'RedisCluster', { engine: 'Redis', engineVersion: '6.x', cacheNodeType: config.cacheNodeType ?? 'cache.t2.medium', replicationGroupDescription: 'RedisReplicationGroup', authToken: this.redisPassword.secretValueFromJson('password').toString(), transitEncryptionEnabled: true, atRestEncryptionEnabled: true, multiAzEnabled: true, cacheSubnetGroupName: this.redisSubnetGroup.ref, numNodeGroups: 1, replicasPerNodeGroup: 1, securityGroupIds: [this.redisSecurityGroup.securityGroupId], }); and as long Redis is up running, accessible from EKS container and medplum.config.json points to it with the right address, port and secret - you should be good to go.
s
I am using redis 7 Server says it's connected and started But when hit the server I am not getting any response for it
a
You mentioned that you narrowed the problem down to Redis. Could share the details/logs where you see the problem with it?
Also if you could execute and share the results of 'curl -v http://localhost:3000/healthcheck' from the same place where you ran 'lsof' and compare it with just 'curl -v http://localhost:3000/' . The first one attempts connection to Redis and the second one doesn't. So hopefully we will see the difference.
s
Just an update again, no issue with redis, it got successfully connectef to redis when I hit curl -v http://localhost:3000/healthcheck no response from the server after certain time it's getting timed out
And I am using allowed origin as * will that accept localhost??
a
Hey @swamy_63747 , it could be smth as simple as port mapping in your setup. Could you please run ' kubectl get pod -n -o yaml' command and post the output. It will print the port that is being exposed and mapped by the pod. You will need to replace with the name of one of your pods (you can get those from running 'get all -n ') and with the name of your the namespace for Medplum deployment.
Also could you confirm that you are building your own container or using this one: https://hub.docker.com/r/medplum/medplum-server ?
s
I am using my own custom image
output of kubectl get pod -o yaml
@andrei_60331 please suggest here i have verified everything port mapping, server logs all, its up but not responding
a
Hi @swamy_63747 , I wonder if you managed to solve the issue? I was able to play with EKS setup a little bit tonight and ran into what could be the same issue as yours. In my case Redis client configuration was not using TLS while AWS Elastic Cache enforces it. By adding '"tls":{}' into Redis config I was able to connect to /healthcheck. See if it works for your this way as well?
442 Views