Skip to content

ClojureConjTrainingSetUp

David Chelimsky edited this page Nov 17, 2019 · 4 revisions

set up your AWS Config

Trainees will work with a Datomic Cloud system that has already been set up by Cognitect. Credentials will be provided to you in the training Slack channel.

Using the credentials provided to you in Slack, add this to your ~/.aws/credentials

[day-of-datomic-2019]
aws_access_key_id=<access-key-id-provided-in-slack>
aws_secret_access_key=<secret-access-key-provided-in-slack>

... and this in ~/.aws/config

[profile day-of-datomic-2019]
region = us-east-1
output = json

Set up the repo for the labs

git clone [email protected]:cognitect-labs/day-of-datomic-cloud.git
cd day-of-datomic-cloud
cp config.edn.example config.edn
clj

This should download any additional dependencies and start a repl with them loaded.

Follow the getting started guide

Next, with the following exceptions/considerations, follow https://docs.datomic.com/cloud/getting-started/connecting.html.

  • you've already configured your AWS access keys (above)
  • Use this for your client config:
{:server-type :cloud
 :region "us-east-1"
 :system "day-of-datomic-2019"
 :endpoint "http://entry.day-of-datomic-2019.us-east-1.datomic.net:8182/"
 :creds-profile "day-of-datomic-2019"
 :proxy-port 8182}
  • Use a unique name like "<the-local-part-email-address>-movies" instead of "movies" for the database name.
  • use this command to start the SOCKS proxy:
datomic-socks-proxy -p "day-of-datomic-2019" -r "us-east-1" "day-of-datomic-2019"

Access a REPL from your editor/dev env

  • open up your editor and connect to a REPL running in the root directory however you're used to doing that
  • go to doc-examples/getting-started-connecting.repl
  • evaluate forms in the REPL
    • these are the same forms you may have already evaluated earlier, but we're making sure that you can connect from your editor vs a REPL running in a terminal

Troubleshooting

.repl files

The files for the labs are sometimes named using dashes with a file-type of .repl. These files contain a series of expressions to be evaluated one at a time at the REPL. They are not namespaces, nor should they be evaluated all at once (e.g. eval-buffer). We've learned that some editors are fine with this, and others are not, so ....

emacs + cider

Either run M-x clojure-mode in each file, or configure your emacs to use clojure-mode for all .repl files by adding this to your init.el:

(add-to-list 'auto-mode-alist '("\\.repl\\'" . clojure-mode))

Vim Fireplace

  • rename the files to use underscores and .clj, e.g.
cp doc-examples/getting-started-connecting.repl \
   doc-examples/getting_started_connecting.clj
  • add a namespace declaration to the top of each file, e.g.
(ns getting-started-connecting)

Intellij with Cursive

  • import the day-of-datomic-2019 as a deps.edn project
  • rename the files to use underscores and .clj as above