datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
aaroncoding 2021-02-06T05:30:30.147800Z

Hey if I'm using the client api in my pedestal app, how expensive is it to run d/connect and d/db? In other words, should I try to ONLY get a conn and db once at startup? Or is it acceptable to do it more ad hoc?

eraad 2021-02-06T10:04:42.147900Z

The pattern I have seen in examples and adopted is getting a conn and a db in an interceptor and reuse it across the chain.

👍 1
eraad 2021-02-06T10:05:34.148100Z

They should not be expensive

aaroncoding 2021-02-06T12:44:52.148600Z

Thanks!

Joe Lane 2021-02-06T16:09:43.157600Z

@coding.aaronp getting a db is cheap, getting a connection is a bit more expensive. You can memoize the creation of a connection and reuse it because it is thread-safe. Like @eraad said, You probably want to get the conn and db in an interceptor. You can also look here for a vanilla pedestal + ions approach. https://github.com/pedestal/pedestal.ions You definitely want to get a new db on every request, otherwise your application will have old data.

👍 1
2021-02-06T13:29:14.149900Z

I set up a datomic cloudformation template, then following the ion tutorial, tried to split the stack. I deleted the master stack, but when I went to recreate, I received the following error on step 2 (Specify Template)

The following resource types are not supported for resource import: AWS::IAM::Policy,AWS::IAM::Policy,AWS::IAM::Policy,AWS::IAM::Policy,AWS::IAM::Policy,Custom::ResourceName,AWS::EC2::DHCPOptions,Custom::ResourceCheck,Custom::ResourceQuery,Custom::ResourceQuery,Custom::ResourceQuery,Custom::ResourceQuery,Custom::Resource,AWS::EC2::VPCGatewayAttachment,AWS::EC2::VPCDHCPOptionsAssociation,AWS::EC2::VPCEndpoint,AWS::EC2::VPCEndpoint,AWS::EC2::SubnetRouteTableAssociation,AWS::EC2::SubnetRouteTableAssociation,AWS::EC2::Route,AWS::EC2::SubnetRouteTableAssociation,Custom::ResourceCheck,AWS::EFS::MountTarget,AWS::EFS::MountTarget,AWS::EFS::MountTarget,AWS::ApplicationAutoScaling::ScalableTarget,AWS::ApplicationAutoScaling::ScalableTarget,AWS::ApplicationAutoScaling::ScalingPolicy,AWS::ApplicationAutoScaling::ScalingPolicy,Custom::Resource

2021-02-06T13:29:34.150400Z

Does anyone know what could have gone wrong? I followed the docs to the best of my ability, I have not done anything custom.

2021-02-06T13:31:43.151400Z

Interestingly there are two create stack buttons in the cloudformation console. The one in the top right is giving me the above error. Clicking the create button in the middle of the screen allowed me to successfully create from the template

2021-02-06T13:32:34.151500Z

2021-02-06T13:48:27.152400Z

Ah upon further investigation I seem to have selected the wrong option from the top right dropdown. I thought I had tried both the options - only With new resources works

2021-02-06T20:27:29.162300Z

After a long day of configuration, I finally got datomic cloud configured and the cloud formation stack split. I wrote a small function, added it to my domaitn/ion-config.edn, pushed it successfully, but when I try to deploy it it fails immediately on the DownloadBundle event. In order to get the CLI I did have to add a bunch of permissions manually to my user in IAM (even so far as temporarily granting administrator access just to download com.datomic/ion), so I'm inclined to think it's a permission issue. I can't find anything in the troubleshooting area of the docs. Does anyone have any suggestions on what might be the issue? I'm not even sure where to look in AWS to get more info as to what is going on/failing