Skip to content

Commit 03821f9

Browse files
committed
made some more changes
1 parent dfda21b commit 03821f9

File tree

5 files changed

+121
-18
lines changed

5 files changed

+121
-18
lines changed

ansible/files/envoy_config/envoy.conf.j2

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
[Unit]
2-
Description=Kong server
1+
Description=Envoy Proxy Server
32
After=postgrest.service gotrue.service adminapi.service
43
Wants=postgrest.service gotrue.service adminapi.service
54

65
[Service]
7-
Type=forking
8-
ExecStart=/usr/local/bin/kong start -c /etc/kong/kong.conf
9-
ExecReload=/usr/local/bin/kong reload -c /etc/kong/kong.conf
10-
ExecStop=/usr/local/bin/kong stop
11-
User=kong
12-
EnvironmentFile=/etc/kong/kong.env
6+
Type=simple
7+
#ExecStart=/opt/envoy/envoy --config-path /opt/envoy/envoy.yml
8+
ExecStart=/usr/bin/bash -c '/opt/envoy/envoy --config-path /opt/envoy/envoy.yml'
9+
User=envoy
10+
1311
Slice=services.slice
1412
Restart=always
1513
RestartSec=3
1614
LimitNOFILE=100000
1715

18-
# The kong user is unpriviledged and thus not permited to bind on ports < 1024
16+
# The envoy user is unpriviledged and thus not permited to bind on ports < 1024
1917
# Via systemd we grant the process a set of priviledges to bind to 80/443
2018
# See http://archive.vn/36zJU
2119
AmbientCapabilities=CAP_NET_BIND_SERVICE
2220

2321
[Install]
24-
WantedBy=multi-user.target
22+
WantedBy=multi-user.target

ansible/files/envoy_config/envoy.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
static_resources:
2+
listeners:
3+
- name: listener_0
4+
address:
5+
socket_address: { address: 0.0.0.0, port_value: 443 }
6+
filter_chains:
7+
- filters:
8+
- name: envoy.filters.network.http_connection_manager
9+
typed_config:
10+
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
11+
stat_prefix: ingress_http
12+
codec_type: AUTO
13+
route_config:
14+
name: local_route
15+
virtual_hosts:
16+
- name: local_service
17+
domains: ["*"]
18+
routes:
19+
- match:
20+
prefix: "/health"
21+
direct_response:
22+
status: 200
23+
body:
24+
inline_string: "Healthy"
25+
- match:
26+
prefix: "/rest/v1/"
27+
headers:
28+
- name: apikey
29+
string_match:
30+
exact: '{{ supabase-api-key-2020-07-28 }}'
31+
route:
32+
cluster: rest
33+
prefix_rewrite: "/"
34+
- match:
35+
prefix: "/auth/v1/admin/"
36+
headers:
37+
- name: apikey
38+
string_match:
39+
exact: '{{ supabase-api-key-2020-07-28 }}'
40+
route:
41+
cluster: gotrue
42+
prefix_rewrite: "/"
43+
- match:
44+
prefix: "/auth/v1/"
45+
route:
46+
cluster: gotrue
47+
prefix_rewrite: "/"
48+
- match:
49+
prefix: "/pg/"
50+
headers:
51+
- name: apikey
52+
string_match:
53+
exact: '{{ supabase-api-key-2020-07-28 }}'
54+
route:
55+
cluster: pg-v1
56+
prefix_rewrite: "/"
57+
http_filters:
58+
- name: envoy.filters.http.router
59+
typed_config:
60+
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
61+
62+
clusters:
63+
- name: gotrue
64+
connect_timeout: 0.25s
65+
type: STATIC
66+
lb_policy: ROUND_ROBIN
67+
load_assignment:
68+
cluster_name: gotrue
69+
endpoints:
70+
- lb_endpoints:
71+
- endpoint:
72+
address:
73+
socket_address:
74+
address: 127.0.0.1
75+
port_value: 9998
76+
77+
- name: rest
78+
connect_timeout: 0.25s
79+
type: STATIC
80+
lb_policy: ROUND_ROBIN
81+
load_assignment:
82+
cluster_name: rest
83+
endpoints:
84+
- lb_endpoints:
85+
- endpoint:
86+
address:
87+
socket_address:
88+
address: 127.0.0.1
89+
port_value: 3000
90+
91+
- name: pg-v1
92+
connect_timeout: 0.25s
93+
type: STATIC
94+
lb_policy: ROUND_ROBIN
95+
load_assignment:
96+
cluster_name: pg-v1
97+
endpoints:
98+
- lb_endpoints:
99+
- endpoint:
100+
address:
101+
socket_address:
102+
address: 127.0.0.1
103+
port_value: 1337

ansible/tasks/setup-envoy.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
dest: /opt/envoy/envoy
1515
checksum: "{{ envoy_release_checksum }}"
1616

17+
- name: Envoy - add execution bit to binary
18+
file:
19+
dest: /opt/envoy/envoy mode=a+x
20+
21+
- name: Envoy - copy basic conf
22+
copy:
23+
src: files/envoy/envoy.yml
24+
dest: /opt/envoy/envoy.yml
25+
1726
# [warn] ulimit is currently set to "1024". For better performance set it to at least
1827
# "4096" using "ulimit -n"
1928
- name: Envoy - bump up ulimit

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.115-envoy-rc2"
1+
postgres-version = "15.1.0.115-envoy-rc4"

0 commit comments

Comments
 (0)