Skip to content

Strange Loop 2019 Set Up

Marshall Thompson edited this page Sep 12, 2019 · 4 revisions

set up your AWS Config

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

NOTE: these are not your own AWS credentials

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

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

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

Now unset all of your AWS_XXX env vars and set the AWS_PROFILE (do this in every terminal window you use):

for v in $(env | grep AWS | awk -F'=' '{print $1}');do unset $v; done;
export AWS_PROFILE=day-of-datomic-sl-2019

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, follow https://docs.datomic.com/cloud/getting-started/connecting.html with the following exceptions/considerations:

  • 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-sl-2019"
 :endpoint "http://entry.day-of-datomic-sl-2019.us-east-1.datomic.net:8182/"
 :creds-profile "day-of-datomic-sl-2019"
 :proxy-port 8182}
  • Use a unique name like "<your-firstname-your-last-initial>-movies" instead of "movies" for the database name.
  • use this command to start the SOCKS proxy:
datomic-socks-proxy -p "day-of-datomic-sl-2019" -r "us-east-1" "day-of-datomic-sl-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 ....

If your environment (or habits) tend toward automatically defaulting to evaluating the entire file, you may want to wrap the entire contents of the .repl files in a (comment ... )

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 as a deps.edn project
  • rename the files to use underscores and .clj as above