Fork me on GitHub
#datomic
<
2021-02-06
>
aaroncoding05:02:30

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?

eraad10:02:42

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.

👍 3
eraad10:02:34

They should not be expensive

Joe Lane16:02:43

@UE1747L7J 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 @U061BSX36 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.

👍 3
bendy13:02:14

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

bendy13:02:34

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

bendy13:02:43

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

bendy13:02:27

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

bendy20:02:29

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