Fork me on GitHub
#datomic
<
2018-07-25
>
Oliver George00:07:30

AWS CloudFormation newbie question. I'm experimenting with setting up a apigateway via a cloudstack template. There's one magic number... the CodeDeployDeploymentGroup. I think I could use Fn::ImportValue to read this from the datomic cloud cloudstack if it included an Export for the associated Output.

"CodeDeployDeploymentGroup": {
			"Description": "CodeDeploy Deployment Group",
			"Value": {
				"Fn::GetAtt": [
					"Compute",
					"Outputs.CodeDeployDeploymentGroup"
				]
			}
		},
Could become
"CodeDeployDeploymentGroup": {
            "Description": "CodeDeploy Deployment Group",
            "Value": {
                "Fn::GetAtt": [
                    "Compute",
                    "Outputs.CodeDeployDeploymentGroup"
                ]
            },
            "Export": {
				"Name": {
					"Fn::Sub": "${SystemName}-CodeDeployDeploymentGroup"
				}
			},
        },
(or similar, from that template i think you'd use "Ref": "AWS::StackName" as the system name component) The alternative seems to be modifying the root stack to reference my app specific apigateway stack. Not sure if that's normal or recommended and how that might interplay with datomic cloud updates. Question really is: am I missing something?

steveb8n02:07:40

Not answering your question but you might consider using Crucible instead to generate your templates. Even just having functions available makes it a lot easier. Here’s an example https://github.com/hlprmnky/ion-appsync-example/blob/master/src-pages/cf/node_pages.clj

Oliver George02:07:46

Thanks @U0510KXTU I thought I'd aim for zero helpers/libs/tooling first to get familiar with what's underlying things. Presume it's something I'd outgrow. Look forward to checking out your code and understanding how it's helpful.

steveb8n02:07:15

that makes sense. there are examples of refs in there, in Crucible it’s the xref fn

steveb8n02:07:04

and they can be parameters from the command line or CF “env” values e.g. region

steveb8n02:07:51

maybe looking at how those CF value/fns are built will get you closer to how to infer/import the group you are trying to access

Oliver George02:07:31

Here's the simple template I came up with. Effectively what would be generated from following the ion-tutorial (but not using {proxy+} so slightly simpler) https://gist.github.com/olivergeorge/c3918c52b89278a9c1807c9d47a9860e

Oliver George02:07:31

I used a Parameter since the datomic stack doesn't export the compute group name... if they did the ImportValue thing should do the trick .

Oliver George02:07:20

@U0510KXTU that json feels very similar to your code doesn't it.

steveb8n02:07:21

yep. the only downside I’ve noticed is refs are string joins which are a bit more complex

Oliver George02:07:14

In your experience, what approach would you use for setting up an apigateway to complement a datomic cloud app (with ions)? I'm largely guessing but the options seem like: (1) a "nested stack" approach provides access to the compute group name and connects the datomic stack lifecycle events to the apigateway stack. (2) treat as stand alone cloudformation and refer to the compute stack by the known group name (3) other.. (aka I need to learn more about cloudformations and devops practices on AWS)

steveb8n02:07:15

I’ve already done this 🙂 I used Crucible to generate the APIGW and passed in the name of the compute stack as a parameter so that my fns can generate the AWS ARNS using string joins

Oliver George03:07:36

Gotcha thanks (and cool!)

eoliphant04:07:39

Hi, I’m getting a weird error when I try to retract a unique constraint on an attribute

(d/transact conn {:tx-data [[:db/retract :otu-seq/otuid :db/unique :db.unique/identity]]})
ExceptionInfo nth not supported on this type: Db  clojure.core/ex-info (core.clj:4739)

eoliphant04:07:37

nvm just saw the other comments about it

henrik10:07:51

I just added ring as a dependency to my Datomic/Ions project, and now I get this:

Refresh Warning: Reflection warning, cognitect/hmac_authn.clj:80:12 - call to static method encodeHex on org.apache.commons.codec.binary.Hex can't be resolved (argument types: unknown, java.lang.Boolean).
Refresh Warning: Reflection warning, cognitect/hmac_authn.clj:80:3 - call to java.lang.String ctor can't be resolved.
Removing ring from deps.edn removes the error. Has anyone else seen this?

rhansen12:07:34

It's just a reflection warning though. No biggie

👍 4
ninja13:07:40

Hi, rather short question: is it possible to transact multiple values for a :db.cardinality/many attribute using the list form? Something along those lines:

[[:db/add "my-ident" :foo/bar-refs [ref-ident-1 ref-ident-2]]]

eraserhd13:07:37

I think you can't do that here, but you can in map form. If you think about it, this is ambiguous. ref-ident-1 could be a keyword and ref-ident-2 could be a value, making the inner vector an entity reference.

marshall13:07:19

try [[:db/add "my-ident" :foo/bar-refs [[ref-ident-1 ref-ident-2]]]] @atwrdik

ninja14:07:51

@marshall following this example i got an invalid list form error (the same happens using my example above)

marshall14:07:49

erm. right; the list form is one datom per vector I believe

marshall14:07:00

you can transact multiple vals in map form

marshall14:07:12

or you can use multiple individual vectors in list form

ninja14:07:53

The explanation from @eraserhd makes sense to me. But I'm still curious how to add multiple refs without using the map form. Would one just write something like this:

[[:db/add "my-ident" :foo/bar-refs ref-ident-1]
 [:db/add "my-ident" :foo/bar-refs ref-ident-2]]

ninja14:07:18

great, thx guys

curtosis16:07:18

are Tim Ewald’s code examples for his reified transactions talk from DoD 2015 still available anywhere? The gist has understandably evaporated.