This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-19
Channels
- # arachne (1)
- # beginners (108)
- # boot (50)
- # cljs-dev (7)
- # clojure (76)
- # clojure-ireland (1)
- # clojure-romania (1)
- # clojure-russia (7)
- # clojure-spec (33)
- # clojure-taiwan (1)
- # clojure-uk (36)
- # clojurescript (46)
- # core-async (13)
- # datomic (146)
- # defnpodcast (1)
- # editors (1)
- # garden (2)
- # hoplon (1)
- # jobs (1)
- # lumo (7)
- # off-topic (21)
- # om (9)
- # pedestal (1)
- # re-frame (25)
- # reagent (5)
- # specter (2)
- # testing (3)
- # unrepl (3)
- # untangled (9)
- # vim (1)
@riadvargas What about using clojure.string/lower-case
instead of regex?
@val_waeselynck thanks val, I think I have a timestamp attrib on my data, that will come in handy.
why datomic client query does not support bindings? eg:
[find .... :where [(quot ?time 60) ?minute]]
got this error:
{:cognitect.anomalies/category :cognitect.anomalies/incorrect, :cognitect.anomalies/message "The following forms do not name predicates or fns: (quot?)", :dbs [{:database-id "58ce6a9d-287a-434a-b282-0107\
237fc4f9", :t 1003, :next-t 1008, :history false}]}
@isaac Error message is about quot not binding. Try fully qualifying it: clojure.core/quot
yeah,
{:cognitect.anomalies/category :cognitect.anomalies/incorrect, :cognitect.anomalies/message "The following forms do not name predicates or fns: (clojure.core/quot?)", :dbs [{:database-id "58ce6a9d-287a-434a-b282-0107\
237fc4f9", :t 1003, :next-t 1008, :history false}]}
Could you have copy+pasted a control character or something? The question mark is still suspicious.
(<!!
(client/q conn {:query '[:find ?e ?tx
:where
[?e :db/txInstant]
[(quot ?e 2) ?tx]]
:args [(client/db conn)]}))
i've played with it but haven't fully productionalized yet. HA would simply be a Deployment with 2 replicas, right?
Im a real beginner with all this kubernetes stuff so I have no clue. I think for starters I will put the transactor and AWS directly and only deploy the peers in the kubernetes. That should be easy.
Putting everything into the cluster seems hard, all the stateful stuff in kubernetes is confusing as hell.
the transactor isn't actually very stateful (besides caches i assume) - mainly just the storage
I will use whats native to the cloud right now, but I think it would be much cooler to have setup that is all in kubernetes and can be moved to different places.
i'm running a postgress + transactor + peers all in a k8s cluster but like i said, not productionalized. been a few months since i played with it.
i used https://github.com/pointslope/docker-datomic to build a datomic docker image
my Dockerfile:
FROM pointslope/datomic-pro-starter:0.9.5390
ADD restore-db.sh /usr/local/bin/restore-db
ENV MYSQL_CONNECTOR_URL
# from
# download mysql connector ()
# and put it in datomic's lib dir
RUN \
wget $MYSQL_CONNECTOR_URL -O mysql-connector-java-5.1.24.zip \
&& unzip mysql-connector-java-5.1.24.zip \
&& mv mysql-connector-java-5.1.24/mysql-connector-java-5.1.24-bin.jar $DATOMIC_HOME/lib \
&& rm -fr mysql-connector-java-5.1.24 mysql-connector-java-5.1.24.zip
ENTRYPOINT ["bin/transactor", "-Xmx4g", "-Xms4g"]
if you want to get into K8S you should check out Helm Charts for canonical ways of running standard open src projects https://helm.sh/
Cool. I have tried that docker img, but I had some problems with it. Maybe I did something wrong. I guess I will try again.
basically you can helm install postgres
or helm install zookeeper
(those aren't the exact commands)
What I would like is a oneclick deployment thing that gives me storge with datomic and all I have to put in is my clojure program.
it packages up the deployment(s), service(s), ingress, persistent disks, etc into a single logical unit
Nice. I need to get into that. There are just so many different new developments in this space.
Thats why I am jumping on the bandwagon as well. Im trying to set up a cluster in AWS and doing my own projects inside of it.
here's the site for all the stable Helm charts https://kubeapps.com/
source for the postgres chart includes https://github.com/kubernetes/charts/blob/master/stable/postgresql/templates/pvc.yaml
I was considering this: https://github.com/sorintlab/stolon
I thought if everything is so awesome and automatic, why can't I get a full setup for my 5 line clojure ring web server π
Yeah, I have started with that as well. But I also wanted to explore doing more low level stuff myself.
i haven't tried setting up my own cluster but there's a lot automation i've seen around it
A friend of mini is hosting DNS for me, but I cant continue until he makes some changes. So in the meantime I am looking into deploying datomic once I have it running.
@devth Another question. In the transctor file, there is the holt and alt-host. How did you configure those while running in kubernetes.
@devth So that is the kubernetes service name? Is that configured in the kubernetes yaml file?
e.g.
apiVersion: v1
kind: Service
metadata:
name: datomic
namespace: {{.Values.global.namespace}}
labels:
app: datomic
tier: db
release: {{ .Release.Name | quote }}
spec:
ports:
- port: {{.Values.datomic_port_1}}
name: datomic1
- port: {{.Values.datomic_port_2}}
name: datomic2
- port: {{.Values.datomic_port_3}}
name: datomic3
selector:
app: datomic
tier: db
(the template syntax is because i'm doing it as a Helm Chart template - replace with real values)basically:
Chart.yaml with some metadata
values.yaml with any vars you want
templates/k8s-yaml-files-here.yaml
depends on your conventions. i was using env
as my namespaces, e.g. dev
, prod
, staging
...
in my values.yaml
i'm defining them as:
datomic_port_1: 4334
datomic_port_2: 4335
datomic_port_3: 4336
# The dev: and free: protocols typically use three ports
# starting with the selected :port, but you can specify the
# other ports explicitly, e.g. for virtualization environs
# that do not issue contiguous ports.
# h2-port=4335
# h2-web-port=4336
key to understanding clj on k8s is really just docker. you need to understand two mostly-orthogonal pieces: 1. how to containerize a clojure app 2. how to run containers on k8s there's nothing really clojure-specific about #2
dockerizing clojure resources. - http://www.rkn.io/2014/09/13/clojure-docker/ - https://hub.docker.com/_/clojure/
Sure. Datomic was more of a question for me. Clojure itself should be straight forward (I might try with OSv but that is besides the point)
that repo is what produces the official image i linked (https://hub.docker.com/_/clojure/)
I really want to have a kubernetes and datomic setup, so that I can have quick devlopment process where I can automatically deploy the apps into that cluster.
you can also develop locally against a remote transactor in a k8s cluster, if you choose
I am sort of betting on the CoreOS stuff and I am using Quay, but I have only just registered.
With this repo: https://github.com/nickik/blackjack
With the Quay thing its just strange because there is little you can do wrong "create new repo" -> "add github hook" done.
Yeah, I was thinking about contacting support, but I did not want to seem like a idiot. So I will just wait until tomorrow and try again.
Also I sort of like how CoreOS approches a lot of stuff, so if I really like quay I would not mind paying for it.
Here is a datomic tutorial I worked on... Aimed at the beginner... Feedback appreciated: https://www.reddit.com/r/Clojure/comments/5zu1oc/my_datomic_tutorial_feedback_sought/