File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,30 @@ ifndef KITE_TRANSPORT
18
18
KITE_TRANSPORT=WebSocket
19
19
endif
20
20
21
+ ifndef POSTGRES_HOST
22
+ ifdef DOCKER_HOST
23
+ POSTGRES_HOST=$(shell echo $(DOCKER_HOST) | cut -d: -f2 | cut -c 3-)
24
+ else
25
+ POSTGRES_HOST==127.0.0.1
26
+ endif
27
+ endif
21
28
22
29
all : test
23
30
31
+ postgres :
32
+ docker stop postgres && docker rm postgres || true
33
+ docker run -d -v $(PWD ) /postgres.d:/docker-entrypoint-initdb.d --name postgres -p 5432:5432 -P postgres:9.3
34
+ while ! docker logs postgres 2>&1 | grep ' ready for start up' > /dev/null; do sleep 1; done
35
+ psql -h $(POSTGRES_HOST ) postgres -f kontrol/001-schema.sql -U postgres
36
+ psql -h $(POSTGRES_HOST ) -c ' CREATE DATABASE kontrol owner kontrol;' -U postgres
37
+ psql -h $(POSTGRES_HOST ) kontrol -f kontrol/002-table.sql -U postgres
38
+ psql -h $(POSTGRES_HOST ) kontrol -f kontrol/003-migration-001-add-kite-key-table.sql -U postgres
39
+ psql -h $(POSTGRES_HOST ) kontrol -f kontrol/003-migration-002-add-key-indexes.sql -U postgres
40
+ echo " export KONTROL_POSTGRES_HOST=$( POSTGRES_HOST) KONTROL_STORAGE=postgres KONTROL_POSTGRES_USERNAME=kontrolapplication KONTROL_POSTGRES_DBNAME=kontrol KONTROL_POSTGRES_PASSWORD=somerandompassword"
41
+
42
+ postgres-logs :
43
+ docker exec -ti postgres /bin/bash -c ' tail -f /var/lib/postgresql/data/pg_log/*.log'
44
+
24
45
format :
25
46
@echo " $( OK_COLOR) ==> Formatting the code $( NO_COLOR) "
26
47
@gofmt -s -w * .go
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ cat >> /var/lib/postgresql/data/postgresql.conf << EOF
6
+ log_destination = 'stderr'
7
+ logging_collector = on
8
+ log_directory = 'pg_log'
9
+ log_statement = 'all'
10
+ EOF
11
+
12
+ mkdir -p /var/lib/postgresql/data/pg_log
13
+ chown -R postgres:postgres /var/lib/postgresql/data/pg_log
You can’t perform that action at this time.
0 commit comments