Skip to content

Commit

Permalink
fix postgres config
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Dec 16, 2023
1 parent 10eba8e commit 23bf3e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions docker/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get -y -q update && \
psmisc \
python \
ntpdate \
iproute2 \
iptables

ADD ./init.sh /init.sh
Expand Down
14 changes: 11 additions & 3 deletions scalardb/src/scalardb/db/postgres.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
(str "deb http://apt.postgresql.org/pub/repos/apt/ "
release "-pgdg main")))
(debian/install [postgre client])
(c/su (c/exec :sed :-i
(c/lit "\"s/#listen_addresses = 'localhost'/listen_addresses = '*'/g\"")
(str "/etc/postgresql/" version "/main/postgresql.conf")))
(c/su (c/exec :echo
(c/lit "host all all 0.0.0.0/0 trust")
c/| :tee :-a
(str "/etc/postgresql/" version "/main/pg_hba.conf")
:> "/dev/null"))
(c/su (meh (c/exec :service :postgresql :stop)))
(c/exec "update-rc.d" :postgresql :disable))))

Expand All @@ -39,9 +47,9 @@

(defn- configure!
[{:keys [version] :or {version DEFAULT_VERSION}}]
(c/sudo "postgres"
(c/exec (str (get-bin-dir version) "/initdb")
:-D (get-main-dir version))))
(c/sudo "postgres"
(c/exec (str (get-bin-dir version) "/initdb")
:-D (get-main-dir version))))

(defn- get-log-path
[{:keys [version] :or {version DEFAULT_VERSION}}]
Expand Down
7 changes: 4 additions & 3 deletions scalardb/src/scalardb/db_extend.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@
(create-table-opts [_ _] {})
(create-properties
[this test]
(let [nodes (live-nodes this test)]
(when (nil? nodes)
(let [node (first (live-nodes this test))]
(when (nil? node)
(throw (ex-info "No living node" {:test test})))
(doto (Properties.)
(.setProperty "scalar.db.storage" "jdbc")
(.setProperty "scalar.db.contact_points" (string/join "," nodes))
(.setProperty "scalar.db.contact_points"
(str "jdbc:postgresql://" node ":5432/"))
(.setProperty "scalar.db.username" "postgres")
(.setProperty "scalar.db.password" "postgres")
(.setProperty "scalar.db.consensus_commit.isolation_level"
Expand Down

0 comments on commit 23bf3e5

Please sign in to comment.