Skip to content

Setting up Datomic Pro

Christopher Small edited this page Apr 1, 2016 · 1 revision

Assuming you're ready to move on from the Free edition of Datomic, you'll want to go through a few steps to get things set up for your prod (and likely also dev) environment(s).

Getting Datomic

You'll probably want to start by getting the Datomic Pro Starter edition (which is $FREE; there are also paid licenses available for larger production deployments) at <http://www.datomic.com/pricing. Then go to https://my.datomic.com/account and copy the bit that looks like:

;; ~/.lein/credentials.clj.gpg (see the Leiningen deploy authentication docs)
{#"my\.datomic\.com" {:username "[email protected]"
                      :password "xxxxxxxxxxxxxxxxxxxxxxxxx"}}

Copy over the file from config/example/env.sh, and put it in config/local/env.sh. Then copy the username and password into the appropriate spots in that file, leaving something like this:

export DATOMIC_USERNAME="[email protected]"
export DATOMIC_PASSWORD="xxxxxxxxxxxxxxxxxxxxx"

You can now run source config/local/env.sh to get those env variables loaded so Leiningen can download Datomic for you. This file is in the .gitignore, so you don't have to worry about it.

Getting the transactor running

Datomic Pro assumes a separate transactor process, so you'll have to make sure you've run the transactor process prior to starting your application.

But first we need to download the transactor.

Back on that Datomic Account page, there should be a section with a wget/curl instruction set, looking something like:

wget [email protected] --http-password=xxxxxxxxxxxxxxxxxxxxxxx https://my.datomic.com/repo/com/datomic/datomic-pro/0.9.5130/datomic-pro-0.9.5130.zip -O datomic-pro-0.9.5130.zip

Run that, and stash in some directory where you have easy access to it. Maybe even put the bin directory there on your path. Whatever. The long story short is you'll be running the transactor from there. Once extracted, cd into that directory and run bin/transactor path/to/your/dev-transactor.properties. There is a config/example/dev-transactor.properties file to get you going. You can cp that into config/local.

Once there, you just have to put your License key in there (see account page to have key sent to you). Then you can run the transactor. As long as your app is properly configured to connect to the transactor url (likely in your env.sh or some edn config file; please insert more docs on this in another subsection...), when you start your system, everything should be all hooked up for you!

Alternative credential security? (not necessary)

You can also try to get your credentials secured with GPG. There are a couple extra hoops there, and I had trouble getting it to work at first. Part of that was I think a GPG bug; the other part may have been me having a bad Datomic version number in there. In any case, if you want to try, read on (and please edit this wiki page if anything seems amiss).

Put that snippet from the Datomic website in a file ~/.lein/credentials.clj. Then run

gpg --default-recipient-self -e ~/.lein/credentials.clj  > ~/.lein/credentials.clj.gpg

Note that you'll need a gpg key set up for this, which you can accomplish with gpg --gen-key. Make sure to move you're mouse around for... err... entropy... You may have to specify something like -r "<[email protected]>" if it's having trouble finding you (include the " and < in there). If you have set everything up you shouldn't get any errors when you run lein deps.

As pointed out on the Leiningen page, you may have to decrypt the gpg after running gpg --decrypt on the file. I'm actually still having trouble with this part possibly, so maybe let me know if you figure it out (or PR these docs)

https://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md#authentication