Skip to content

Commit

Permalink
Revert "remove envoy and update docker-compose"
Browse files Browse the repository at this point in the history
This reverts commit 7f01b51.

# Conflicts:
#	docker/docker-compose-ci.yml
#	docker/docker-compose.yml
  • Loading branch information
skhugh committed Apr 11, 2024
1 parent 7887bae commit 16e8f0a
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 6 deletions.
23 changes: 20 additions & 3 deletions docker/docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
version: '3.3'

services:
envoy:
build:
context: ./
dockerfile: ./envoy.Dockerfile
image: 'grpcweb:envoy'
container_name: 'envoy'
restart: always
ports:
- '8080:8080'
- '9901:9901'
command: ['/etc/envoy/envoy-ci.yaml']
depends_on:
- yorkie
yorkie:
image: 'yorkieteam/yorkie:0.4.10'
container_name: 'yorkie'
command: ['server', '--mongo-connection-uri', 'mongodb://mongo:27017']
command: [
'server',
'--mongo-connection-uri',
'mongodb://mongo:27017',
]
restart: always
ports:
- '8080:8080'
- '8081:8081'
- '11101:11101'
- '11102:11102'
depends_on:
- mongo
mongo:
Expand Down
29 changes: 26 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
version: '3.3'

services:
envoy:
build:
context: ./
dockerfile: ./envoy.Dockerfile
image: 'grpcweb:envoy'
container_name: 'envoy'
restart: always
ports:
- '8080:8080'
- '9901:9901'
command: ['/etc/envoy/envoy.yaml']
depends_on:
- yorkie
# If you're using Mac or Windows, this special domain name("host.docker.internal" which makes containers able to connect to the host)
# is supported by default.
# But if you're using Linux and want an envoy container to communicate with the host,
# it may help to define "host.docker.internal" in extra_hosts.
# (Actually, other hostnames are available, but in that case you should update clusters[].host configurations of envoy.yaml)
extra_hosts:
- "host.docker.internal:host-gateway"
yorkie:
image: 'yorkieteam/yorkie:0.4.10'
container_name: 'yorkie'
command: ['server', '--enable-pprof']
command: [
'server',
'--enable-pprof',
]
restart: always
ports:
- '8080:8080'
- '8081:8081'
- '11101:11101'
- '11102:11102'
54 changes: 54 additions & 0 deletions docker/envoy-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }

static_resources:
listeners:
- name: yorkie_rpc_listener
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route:
cluster: yorkie_rpc_service
# https://github.com/grpc/grpc-web/issues/361
max_stream_duration:
grpc_timeout_header_max: 0s
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-api-key,x-shard-key,x-user-agent,x-grpc-web,grpc-timeout,authorization,x-yorkie-user-agent
max_age: "1728000"
expose_headers: custom-header-1,grpc-status,grpc-message
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.cors
- name: envoy.filters.http.router
clusters:
- name: yorkie_rpc_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
load_assignment:
cluster_name: yorkie_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: yorkie
port_value: 11101
8 changes: 8 additions & 0 deletions docker/envoy.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM envoyproxy/envoy:v1.19.0

COPY ./envoy.yaml /etc/envoy/envoy.yaml
COPY ./envoy-ci.yaml /etc/envoy/envoy-ci.yaml

ENTRYPOINT ["/usr/local/bin/envoy", "-c"]

CMD /etc/envoy/envoy.yaml
59 changes: 59 additions & 0 deletions docker/envoy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }

static_resources:
listeners:
- name: yorkie_rpc_listener
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route:
cluster: yorkie_rpc_service
# https://github.com/grpc/grpc-web/issues/361
max_stream_duration:
grpc_timeout_header_max: 0s
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-api-key,x-shard-key,x-user-agent,x-grpc-web,grpc-timeout,authorization,x-yorkie-user-agent
max_age: "1728000"
expose_headers: custom-header-1,grpc-status,grpc-message
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.cors
- name: envoy.filters.http.router
clusters:
- name: yorkie_rpc_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
# Input the address which envoy can connect to as a yorkie server.
# When you want envoy container to communicate with your host machine, you should set as the following
# - Windows/Mac: Input host.docker.internal
# - Linux: an IP address of the host machine or docker-0 interface or some addresses defined in extra hosts of docker-compose.yml
# you can simply use the yorkie container name(e.g. yorkie) in docker-compose whatever your OS is.
load_assignment:
cluster_name: yorkie_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: host.docker.internal
port_value: 11101

0 comments on commit 16e8f0a

Please sign in to comment.