Skip to content

Commit 1aaded1

Browse files
authored
Merge pull request #37 from fetchq/refactor-v3-logs
Refactor v3
2 parents 5bf3da5 + c814fab commit 1aaded1

File tree

114 files changed

+1683
-1591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1683
-1591
lines changed

Dockerfile-10.11

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM postgres:10.11
22
ADD ./extension /usr/share/postgresql/10/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-10.4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM postgres:10.4
22
ADD ./extension /usr/share/postgresql/10/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-11.6

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM postgres:11.6
22
ADD ./extension /usr/share/postgresql/11/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-12.0

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM postgres:12.0
22
ADD ./extension /usr/share/postgresql/12/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-12.1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM postgres:12.1
22
ADD ./extension /usr/share/postgresql/12/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-12.4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM postgres:12.4
2+
ADD ./extension /usr/share/postgresql/12/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-13.0

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM postgres:13.0
2+
ADD ./extension /usr/share/postgresql/13/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Dockerfile-9.6

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM postgres:9.6
22
ADD ./extension /usr/share/postgresql/9.6/extension/
3+
ADD ./docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

Makefile

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11

22
registry ?= fetchq
33
name ?= fetchq
4-
version ?= 2.2.0
4+
version ?= 3.0.0
55

66
## Testing with Postgres Versions
77
## It's a good idea to always test with all the versions
88
## it's manual and it sucks, we'll see about that in the future
99

10-
# 9.6 10.11 11.6 12.1
11-
pg_version ?= 9.6
12-
# 9.6 10 11.6 12
13-
pg_extension_folder ?= 9.6
10+
# 9.6 10.11 11.6 12.1 12.4 13.0
11+
pg_version ?= 13.0
12+
# 9.6 10 11.6 12 13
13+
pg_extension_folder ?= 13
1414

1515
reset:
16+
# Cleanup current db
17+
docker stop fetchq || true
18+
docker rm -f fetchq || true
19+
20+
# Cleanup data folders
1621
rm -rf $(CURDIR)/data
1722
rm -rf $(CURDIR)/extension
1823
mkdir $(CURDIR)/data
@@ -67,10 +72,10 @@ build:
6772
$(CURDIR)/src/queue-drop.sql \
6873
$(CURDIR)/src/queue-set-max-attempts.sql \
6974
$(CURDIR)/src/queue-set-current-version.sql \
70-
$(CURDIR)/src/queue-set-errors-retention.sql \
75+
$(CURDIR)/src/queue-set-logs-retention.sql \
7176
$(CURDIR)/src/queue-set-metrics-retention.sql \
7277
$(CURDIR)/src/queue-drop-version.sql \
73-
$(CURDIR)/src/queue-drop-errors.sql \
78+
$(CURDIR)/src/queue-drop-logs.sql \
7479
$(CURDIR)/src/queue-drop-metrics.sql \
7580
$(CURDIR)/src/queue-drop-indexes.sql \
7681
$(CURDIR)/src/queue-top.sql \
@@ -138,6 +143,8 @@ build-image: reset build
138143
docker build --no-cache -t ${name}:11.6-${version} -f Dockerfile-11.6 .
139144
docker build --no-cache -t ${name}:12.0-${version} -f Dockerfile-12.0 .
140145
docker build --no-cache -t ${name}:12.1-${version} -f Dockerfile-12.1 .
146+
docker build --no-cache -t ${name}:12.4-${version} -f Dockerfile-12.4 .
147+
docker build --no-cache -t ${name}:13.0-${version} -f Dockerfile-13.0 .
141148

142149
publish: build-image
143150
# 9.6
@@ -170,29 +177,42 @@ publish: build-image
170177
docker tag ${name}:12.1-${version} ${registry}/${name}:12.1-latest
171178
docker push ${registry}/${name}:12.1-${version}
172179
docker push ${registry}/${name}:12.1-latest
180+
# 12.4
181+
docker tag ${name}:12.4-${version} ${registry}/${name}:12.4-${version}
182+
docker tag ${name}:12.4-${version} ${registry}/${name}:12.4-latest
183+
docker push ${registry}/${name}:12.4-${version}
184+
docker push ${registry}/${name}:12.4-latest
185+
# 13.0
186+
docker tag ${name}:13.0-${version} ${registry}/${name}:13.0-${version}
187+
docker tag ${name}:13.0-${version} ${registry}/${name}:13.0-latest
188+
docker push ${registry}/${name}:13.0-${version}
189+
docker push ${registry}/${name}:13.0-latest
173190
# latest
174-
docker tag ${name}:12.0-${version} ${registry}/${name}:latest
191+
docker tag ${name}:13.0-${version} ${registry}/${name}:latest
175192
docker push ${registry}/${name}:latest
176193

177194
start-pg:
178195
docker run --rm -d \
179196
--name fetchq \
180197
-p 5432:5432 \
198+
-e POSTGRES_PASSWORD=postgres \
181199
-v $(CURDIR)/data/pg:/var/lib/postgresql/data \
182200
-v $(CURDIR)/extension/fetchq.control:/usr/share/postgresql/$(pg_extension_folder)/extension/fetchq.control \
183201
-v $(CURDIR)/extension/fetchq--${version}.sql:/usr/share/postgresql/$(pg_extension_folder)/extension/fetchq--${version}.sql \
184202
-v $(CURDIR)/data/fetchq--${version}.test.sql:/tests/fetchq--${version}.test.sql \
185203
postgres:$(pg_version)
186204

187-
start-pg-prod:
205+
production: reset build-image
188206
docker run --rm -d \
207+
-e POSTGRES_PASSWORD=postgres \
189208
--name fetchq \
190209
-p 5432:5432 \
191210
fetchq:$(pg_version)-$(version)
192211
docker logs -f fetchq
193212

194213
start-delay:
195-
sleep 20
214+
until docker exec fetchq pg_isready ; do sleep 1 ; done
215+
sleep 2
196216

197217
start: reset build build-test start-pg
198218
docker logs -f fetchq

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# FetchQ Postgres Extension
1+
# Fetchq Postgres Extension
2+
3+
Postgres extension that enables FetchQ capabilities.
24

3-
Postgres extension that enables FetchQ capabilities
45

56
## How to Work this out
67

@@ -13,6 +14,29 @@ Postgres extension that enables FetchQ capabilities
1314

1415
---
1516

17+
## Quick Start
18+
19+
You can easily run the production version of Fetchq using Docker on a Linux machine:
20+
21+
```bash
22+
make production
23+
```
24+
25+
At this point you can connect to:
26+
27+
```
28+
postgres://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/postgres
29+
```
30+
31+
This will give you an empty PostgreSQL instance with Fetchq installed as an extension and initialized as well.
32+
33+
From here, you can just start creating queues and handling documents:
34+
35+
```sql
36+
select * from fetchq.queue_create('foo');
37+
select * from fetchq.doc_append('foo', '{"a":1}', 0, 0);
38+
```
39+
1640
## Management Tables
1741

1842
fetchq_sys_queues

0 commit comments

Comments
 (0)