Using Bots in Self-hosted/Local Environment
# support
b
Has anyone been successful setting up Bots in a self-hosted environment? We're looking to make another attempt at setting up the bot framework locally. If anyone has any tips or documentation I would be greatful.
r
Hi @bnapora , we have a solution that's intended for localhost development called vm context bots.
If you set the RunTime version of a
Bot
resource to VM Context, this will run inside a local thread inside your webserver, rather than in an isolated lambda. We STRONGLY CAUTION THAT VM CONTEXT BOTS ARE MEANT FOR LOCALHOST DEVELOPMENT, NOT PRODUCTION USE. Because the code runs inside the server, not in an isolated environment like a Lambda, you should never allow untrusted actors to submit code for VM context bots
b
@rahul1 I had tried the
vmcontext
runtime setting awhile ago, but couldn't get it working, and thought it was no longer supported. Maybe I missed the documentation on this setting, but also need to make sure that
"vmContextBotsEnabled": true,
is set in server config.json. (Or change the setting permanently in config.ts) Once that is set, and Runtime is changed to
vmcontext
, I was able to get Bot running locally. Thanks for the help.
I understand risk of vmcontext bots. Is there any plan for supporting Bots as serverless functions in other platforms (eg GCP or Azure)?
r
Yes, it's a long term goal for us to provide proper support for all our functionality across cloud providers.
We have a GH Discussion on how we would accomplish this via a"plugin architecture", in case you're curious https://github.com/medplum/medplum/discussions/1424
b
Hi, I'm glad I found this thread. I'm simply following the tutorial here: https://www.medplum.com/docs/bots/bot-basics but I am unable to complete it because "Bots not enabled." Is this only a paid feature, not allowed for local development? How can I follow the tutorial? Thanks!
r
Hi @brandon , on localhost you can use vmcontext bots. On the medplum hosted instance, yes Bots are a paid feature
b
Maybe I wasn't clear or hope you can clarify further. On the official app.medplum.com, the bots feature can only be tested as a paid feature? or not at all because I am not a SuperUser on the official app.medplum.com instance?
b
@brandon @rahul1 On the "official" hosted platform, Bots are a "paid feature". If you are setting up localhost, then can use as "vmcontext" bots. To follow the "Basic Bots" documentation (on localhost) you'll need to create the Bot, then edit and change to "vmcontext". You'll also need to add the "vmContextBotsEnabled" setting to your "medplum.config.json":
b
@bnapora Thank you for the clear response. I will pivot to localhost then for continued testing.
r
Thank you for the clarification @bnapora ! Yes that's exactly right
b
@brandon I think you'll find the localhost setup fairly straight forward. The docs are clear (for first time install). There is a tremendous amount of capability in this platform. Good luck.
b
@rahul1 @bnapora I apologize if this detracts from this support topic, but should a cloned hello-world app be sufficient in local development to customize the UI to be able to write data (create patient, create questionnaire, etc) or is it meant primarily for read-only purposes? or is this https://www.medplum.com/docs/contributing/local-dev-setup what I should utilize for my use case? I am primarily trying to customize a small scale UI to test Medplum functionality. Thanks!
r
Hi @brandon , can you please ask in a new support thread? It helps the community find solutions faster 🙂
157 Views