Skip to content

Commit b6f927c

Browse files
authored
Merge pull request supabase#28 from supabase/updates-and-fixes
Updates and fixes
2 parents a99c539 + 0332b87 commit b6f927c

13 files changed

+273
-105
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Unmodified Postgres with some useful plugins. Our goal with this repo is not to
55
## Features
66

77
- ✅ Postgres [12](https://www.postgresql.org/about/news/1976/). Includes [generated columns](https://www.postgresql.org/docs/12/ddl-generated-columns.html) and [JSON path](https://www.postgresql.org/docs/12/functions-json.html#FUNCTIONS-SQLJSON-PATH) support.
8-
- ✅ Ubuntu 18.04 (Bionic).
8+
- ✅ Ubuntu 18.04 (Bionic).
99
-[pg-contrib-12](https://www.postgresql.org/docs/12/contrib.html). Because everyone should enable `pg_stat_statements`.
1010
-[wal_level](https://www.postgresql.org/docs/current/runtime-config-wal.html) = logical and [max_replication_slots](https://www.postgresql.org/docs/current/runtime-config-replication.html) = 5. Ready for replication.
1111
-[PostGIS](https://postgis.net/). Postgres' most popular extension - support for geographic objects.
@@ -28,11 +28,11 @@ See all installation instructions in the [repo wiki](https://github.com/supabase
2828

2929
## Motivation
3030

31-
After talking to a lot of techies, we've found that most believe Postgres is the best (operational) database but they *still* choose other databases. This is overwhelmingly because "the other one was quicker/easier". Our goal is to make it fast and simple to get started with Postgres, so that we never hear that excuse again.
31+
After talking to a lot of techies, we've found that most believe Postgres is the best (operational) database but they _still_ choose other databases. This is overwhelmingly because "the other one was quicker/easier". Our goal is to make it fast and simple to get started with Postgres, so that we never hear that excuse again.
3232

3333
Our secondary goal is to show off a few of Postgres' most exciting features. This is to convince new developers to choose it over other database (a decision we hope they'll appreciate once they start scaling).
3434

35-
Finally, this is the same build we offer at [Supabase](https://supabase.io), and everything we do is opensource. This repo makes it easy to *install* Postgres, Supabase makes it easy to *use* Postgres.
35+
Finally, this is the same build we offer at [Supabase](https://supabase.io), and everything we do is opensource. This repo makes it easy to _install_ Postgres, Supabase makes it easy to _use_ Postgres.
3636

3737
## Roadmap
3838

@@ -50,4 +50,3 @@ We are building the features of Firebase using enterprise-grade, open source pro
5050

5151
[![Worklife VC](https://user-images.githubusercontent.com/10214025/90451355-34d71200-e11e-11ea-81f9-1592fd1e9146.png)](https://www.worklife.vc)
5252
[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)
53-

amazon-arm.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"variables": {
3+
"aws_access_key": "",
4+
"aws_secret_key": "",
5+
"region": "ap-northeast-1",
6+
"ami_regions": "ap-northeast-1",
7+
"ami": "ami-034efdc866e4b4fd7",
8+
"ami_name": "supabase-postgres-0.14.0",
9+
"environment": "testing",
10+
"ansible_arguments": "--skip-tags,update-only -v"
11+
},
12+
"builders": [
13+
{
14+
"type": "amazon-ebs",
15+
"access_key": "{{user `aws_access_key`}}",
16+
"secret_key": "{{user `aws_secret_key`}}",
17+
"region": "{{user `region`}}",
18+
"ami_regions": "{{user `ami_regions`}}",
19+
"source_ami": "{{user `ami`}}",
20+
"instance_type": "c6g.2xlarge",
21+
"ssh_username": "ubuntu",
22+
"ami_name": "{{user `ami_name`}}",
23+
"tags": {
24+
"environment": "{{user `environment`}}",
25+
"appType": "postgres"
26+
},
27+
"launch_block_device_mappings": [
28+
{
29+
"device_name": "/dev/sda1",
30+
"volume_size": 16,
31+
"volume_type": "gp2",
32+
"delete_on_termination": true
33+
}
34+
]
35+
}
36+
],
37+
"provisioners": [
38+
{
39+
"type": "shell",
40+
"inline": [
41+
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done"
42+
]
43+
},
44+
{
45+
"type": "ansible",
46+
"user": "ubuntu",
47+
"playbook_file": "ansible/playbook.yml",
48+
"extra_arguments": "{{user `ansible_arguments`}}"
49+
},
50+
{
51+
"execute_command": "echo 'packer' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'",
52+
"type": "shell",
53+
"scripts": [
54+
"scripts/01-test",
55+
"scripts/02-credentials_cleanup.sh",
56+
"scripts/90-cleanup.sh",
57+
"scripts/91-log_cleanup.sh"
58+
]
59+
}
60+
]
61+
}

amazon.json

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,42 @@
55
"region": "ap-southeast-1",
66
"ami_regions": "ap-southeast-1",
77
"ami": "ami-0f7719e8b7ba25c61",
8+
"ami_name": "supabase-postgres-0.14.0",
89
"environment": "testing",
910
"ansible_arguments": "--skip-tags,update-only"
1011
},
11-
"builders": [{
12-
"type": "amazon-ebs",
13-
"access_key": "{{user `aws_access_key`}}",
14-
"secret_key": "{{user `aws_secret_key`}}",
15-
"region": "{{user `region`}}",
16-
"ami_regions": "{{user `ami_regions`}}",
17-
"source_ami": "{{user `ami`}}",
18-
"instance_type": "m5.2xlarge",
19-
"ssh_username": "ubuntu",
20-
"ami_name": "supabase-postgres-0.13.0",
21-
"tags":{
22-
"environment":"{{user `environment`}}",
23-
"appType":"postgres"
24-
},
25-
"launch_block_device_mappings": [
26-
{
27-
"device_name": "/dev/sda1",
28-
"volume_size": 16,
29-
"volume_type": "gp2",
30-
"delete_on_termination": true
31-
}
32-
]
33-
}],
12+
"builders": [
13+
{
14+
"type": "amazon-ebs",
15+
"access_key": "{{user `aws_access_key`}}",
16+
"secret_key": "{{user `aws_secret_key`}}",
17+
"region": "{{user `region`}}",
18+
"ami_regions": "{{user `ami_regions`}}",
19+
"source_ami": "{{user `ami`}}",
20+
"instance_type": "m5.2xlarge",
21+
"ssh_username": "ubuntu",
22+
"ami_name": "{{user `ami_name`}}",
23+
"tags": {
24+
"environment": "{{user `environment`}}",
25+
"appType": "postgres"
26+
},
27+
"launch_block_device_mappings": [
28+
{
29+
"device_name": "/dev/sda1",
30+
"volume_size": 16,
31+
"volume_type": "gp2",
32+
"delete_on_termination": true
33+
}
34+
]
35+
}
36+
],
3437
"provisioners": [
38+
{
39+
"type": "shell",
40+
"inline": [
41+
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done"
42+
]
43+
},
3544
{
3645
"type": "ansible",
3746
"user": "ubuntu",
@@ -42,11 +51,9 @@
4251
"execute_command": "echo 'packer' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'",
4352
"type": "shell",
4453
"scripts": [
45-
"scripts/01-test",
4654
"scripts/02-credentials_cleanup.sh",
4755
"scripts/90-cleanup.sh",
48-
"scripts/91-log_cleanup.sh",
49-
"scripts/99-img_check.sh"
56+
"scripts/91-log_cleanup.sh"
5057
]
5158
}
5259
]

ansible/install_roles.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
32
- name: anxs.postgresql
43
src: https://github.com/anxs/postgresql
5-
version: v1.12.0
4+
version: v1.12.0

ansible/playbook.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
pre_tasks:
55
- import_tasks: tasks/setup-system.yml
6-
6+
77
vars_files:
88
- ./vars.yml
9-
9+
1010
roles:
1111
- role: anxs.postgresql
1212

@@ -18,7 +18,7 @@
1818
import_tasks: tasks/setup-extensions.yml
1919

2020
- name: Adjust APT update intervals
21-
copy:
21+
copy:
2222
src: files/apt_periodic
2323
dest: /etc/apt/apt.conf.d/10periodic
2424

@@ -30,10 +30,10 @@
3030
- name: UFW - Allow connections to postgreSQL (5432)
3131
ufw:
3232
rule: allow
33-
port: '5432'
33+
port: "5432"
3434

3535
- name: UFW - Deny all other incoming traffix by default
36-
ufw:
36+
ufw:
3737
state: enabled
3838
policy: deny
39-
direction: incoming
39+
direction: incoming

ansible/tasks/setup-extensions.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
- name: Install postgis for postgreSQL versions < 10
33
apt:
44
pkg:
5-
- libgeos-c1v5
6-
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}"
7-
- "postgresql-{{ postgresql_version }}-postgis-scripts"
5+
- libgeos-c1v5
6+
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}"
7+
- "postgresql-{{ postgresql_version }}-postgis-scripts"
88
update_cache: yes
99
cache_valid_time: 3600
1010
when: postgresql_version < 10
1111

1212
- name: Install postgis for postgreSQL versions >= 10
1313
apt:
1414
pkg:
15-
- libgeos-c1v5
16-
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}"
17-
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}-scripts"
15+
- libgeos-c1v5
16+
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}"
17+
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}-scripts"
1818
update_cache: yes
1919
cache_valid_time: 3600
2020
when: postgresql_version >= 10
@@ -46,6 +46,13 @@
4646
update_cache: yes
4747
cache_valid_time: 3600
4848

49+
# pgcron
50+
- name: Install pgcron
51+
apt:
52+
pkg: postgresql-12-cron
53+
update_cache: yes
54+
cache_valid_time: 3600
55+
4956
# pgAudit
5057
- name: pgAudit - download & install dependencies
5158
apt:
@@ -70,7 +77,7 @@
7077
become: yes
7178

7279
- name: pgAudit - build
73-
make:
80+
make:
7481
chdir: /tmp/pgaudit-{{ pgaudit_release }}
7582
target: check
7683
params:
@@ -100,7 +107,7 @@
100107

101108
- name: Remove libcurl4 package
102109
apt:
103-
pkg:
110+
pkg:
104111
- libcurl4
105112
state: absent
106113

@@ -126,7 +133,7 @@
126133
become: yes
127134

128135
- name: pgsql-http - build
129-
make:
136+
make:
130137
chdir: /tmp/pgsql-http-{{ pgsql_http_release }}
131138
become: yes
132139

@@ -158,7 +165,7 @@
158165
become: yes
159166

160167
- name: plpgsql_check - clean
161-
make:
168+
make:
162169
chdir: /tmp/plpgsql_check-{{ plpgsql_check_release }}
163170
target: clean
164171
become: yes
@@ -188,20 +195,20 @@
188195
- name: pljava - unpack archive
189196
unarchive:
190197
remote_src: yes
191-
src: /tmp/pljava-{{ pljava_release }}.tar.gz
198+
src: /tmp/pljava-{{ pljava_release }}.tar.gz
192199
dest: /tmp
193200
become: yes
194201

195202
- name: pljava - build
196203
become: yes
197-
shell:
204+
shell:
198205
cmd: mvn clean install
199206
chdir: /tmp/pljava-{{ pljava_release }}
200207

201208
- name: pljava - install
202209
become: yes
203-
shell:
204-
cmd: java -jar pljava-packaging/target/pljava-pg12.3-amd64-Linux-gpp.jar
210+
shell:
211+
cmd: java -jar pljava-packaging/target/pljava-pg12.jar
205212
chdir: /tmp/pljava-{{ pljava_release }}
206213

207214
- name: pljava - remove build dependencies
@@ -221,15 +228,14 @@
221228

222229
- name: pljava - set pljava.libjvm_location
223230
become: yes
224-
shell:
231+
shell:
225232
cmd: echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so'" >> /etc/postgresql/12/main/postgresql.conf
226233

227234
- name: pljava - remove ~/.m2 directory
228235
become: yes
229236
file:
230237
path: ~/.m2
231238
state: absent
232-
233239
# plv8
234240
- name: plv8 - download & install dependencies
235241
apt:
@@ -249,6 +255,7 @@
249255
- libc++1
250256
- libtinfo5
251257
- libc++abi1
258+
- ninja-build
252259
update_cache: yes
253260
install_recommends: no
254261

@@ -260,7 +267,7 @@
260267
become: yes
261268

262269
- name: plv8 - build
263-
make:
270+
make:
264271
chdir: /tmp/plv8
265272
become: yes
266273

0 commit comments

Comments
 (0)