Skip to content

Commit 260838c

Browse files
committedSep 11, 2020
envoy app
1 parent b56c0a5 commit 260838c

File tree

7 files changed

+114
-0
lines changed

7 files changed

+114
-0
lines changed
 

‎envoy/http/app/.bundle/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
BUNDLE_PATH: "vendor/bundle"

‎envoy/http/app/Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM rubylang/ruby:2.6.5-bionic
2+
3+
RUN mkdir -p /app
4+
5+
# bundle install
6+
COPY Gemfile Gemfile.lock /tmp/
7+
RUN cd /tmp && bundle install -j4 --deployment --without 'development test'
8+
9+
WORKDIR /app
10+
COPY . /app
11+
12+
CMD ["bundle", "exec", "ruby", "app.rb"]

‎envoy/http/app/Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Gemfile
2+
source "https://rubygems.org"
3+
4+
gem "sinatra"

‎envoy/http/app/Gemfile.lock

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
mustermann (1.0.2)
5+
rack (2.0.4)
6+
rack-protection (2.0.1)
7+
rack
8+
sinatra (2.0.1)
9+
mustermann (~> 1.0)
10+
rack (~> 2.0)
11+
rack-protection (= 2.0.1)
12+
tilt (~> 2.0)
13+
tilt (2.0.8)
14+
15+
PLATFORMS
16+
ruby
17+
18+
DEPENDENCIES
19+
sinatra
20+
21+
BUNDLED WITH
22+
1.14.6

‎envoy/http/app/app.rb

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# app.rb
2+
require "sinatra"
3+
4+
set :bind, '0.0.0.0'
5+
set :port, 3000
6+
7+
get "/" do
8+
9+
puts request.env
10+
p request.env
11+
# status 500
12+
status 200
13+
# "Hello World!"
14+
end

‎envoy/http/docker-compose.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '2.4'
2+
services:
3+
front-envoy:
4+
image: envoyproxy/envoy:v1.15.0
5+
container_name: proxy
6+
volumes:
7+
- ./envoy.yaml:/etc/envoy/envoy.yaml
8+
ports:
9+
- "80:8080"
10+
- "9901:9901"
11+
app:
12+
build: ./app
13+
container_name: app
14+
ports:
15+
- 8080:8080

‎envoy/http/envoy.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
admin:
2+
access_log_path: /dev/stdout
3+
address:
4+
socket_address: { address: 0.0.0.0, port_value: 9901 }
5+
static_resources:
6+
listeners:
7+
- name: app
8+
address:
9+
socket_address: { address: 0.0.0.0, port_value: 8080 }
10+
filter_chains:
11+
- filters:
12+
- name: envoy.filters.network.http_connection_manager
13+
typed_config:
14+
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
15+
stat_prefix: ingress_http
16+
access_log:
17+
- name: envoy.access_loggers.file
18+
typed_config:
19+
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
20+
path: '/dev/stdout'
21+
route_config:
22+
name: local_route
23+
virtual_hosts:
24+
- name: local_service
25+
domains: ["*"]
26+
routes:
27+
- match:
28+
prefix: "/"
29+
route:
30+
cluster: backend_cluster
31+
http_filters:
32+
- name: envoy.filters.http.router
33+
clusters:
34+
- name: backend_cluster
35+
connect_timeout: 0.25s
36+
type: LOGICAL_DNS
37+
dns_lookup_family: V4_ONLY
38+
lb_policy: ROUND_ROBIN
39+
load_assignment:
40+
cluster_name: app
41+
endpoints:
42+
- lb_endpoints:
43+
- endpoint:
44+
address:
45+
socket_address: { address: app, port_value: 3000 }

0 commit comments

Comments
 (0)
Please sign in to comment.