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?
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.
They should not be expensive
This is a good reference: https://github.com/cognitect-labs/vase/blob/d882bc8f28e8af2077b55c80e069aa2238f646b7/src/com/cognitect/vase/routes.clj#L37
Thanks!
@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.
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
Does anyone know what could have gone wrong? I followed the docs to the best of my ability, I have not done anything custom.
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
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
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