DC in local network
This commit is contained in:
65
docker-compose-local.yml
Normal file
65
docker-compose-local.yml
Normal file
@ -0,0 +1,65 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
db:
|
||||
build:
|
||||
context: ./database
|
||||
dockerfile: Dockerfile
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
command: -p 55432
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -p 55432"]
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
machines-app:
|
||||
build:
|
||||
context: ./machines
|
||||
dockerfile: Dockerfile
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- APPPORT=4000
|
||||
- DBHOST=localhost
|
||||
- DBPORT=55432
|
||||
- DBNAME=komponiranje
|
||||
- DBUSER=pero
|
||||
- DBPASSWORD=pero.000
|
||||
- PRODUCTSAPPURL=http://localhost:10000
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
products-app:
|
||||
build:
|
||||
context: ./products
|
||||
dockerfile: Dockerfile
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- APPPORT=4001
|
||||
- DBHOST=localhost
|
||||
- DBPORT=55432
|
||||
- DBNAME=komponiranje
|
||||
- DBUSER=pero
|
||||
- DBPASSWORD=pero.000
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
proxy:
|
||||
image: envoyproxy/envoy:v1.28-latest
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- ./proxy/envoy-local.yaml:/etc/envoy/envoy.yaml
|
||||
depends_on:
|
||||
- machines-app
|
||||
- products-app
|
||||
frontend-app:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- REACT_APP_BACKEND_API_URL="http://localhost:10000"
|
||||
depends_on:
|
||||
- proxy
|
||||
@ -7,7 +7,6 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="Web site created using create-react-app" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
{
|
||||
"short_name": "Komponiranje",
|
||||
"name": "Komponiranje frontend demo",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,10 @@ func handleGetProducts(dbConn *gorm.DB) gin.HandlerFunc {
|
||||
|
||||
products := db.GetProducts(dbConn, machineId)
|
||||
|
||||
// for i := 0; i < len(*products); i++ {
|
||||
// (*products)[i].Name = fmt.Sprintf("[local] %s", (*products)[i].Name)
|
||||
// }
|
||||
|
||||
c.JSON(
|
||||
http.StatusOK,
|
||||
GetProductsResponse{
|
||||
|
||||
59
proxy/envoy-local.yaml
Normal file
59
proxy/envoy-local.yaml
Normal file
@ -0,0 +1,59 @@
|
||||
static_resources:
|
||||
listeners:
|
||||
- address:
|
||||
socket_address:
|
||||
address: 127.0.0.1
|
||||
port_value: 10000
|
||||
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
|
||||
codec_type: auto
|
||||
stat_prefix: ingress_http
|
||||
route_config:
|
||||
name: local_route
|
||||
virtual_hosts:
|
||||
- name: backend
|
||||
domains:
|
||||
- "*"
|
||||
routes:
|
||||
- match:
|
||||
prefix: "/machines"
|
||||
route:
|
||||
cluster: machines-app
|
||||
- match:
|
||||
prefix: "/products"
|
||||
route:
|
||||
cluster: products-app
|
||||
http_filters:
|
||||
- name: envoy.filters.http.router
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||
clusters:
|
||||
- name: machines-app
|
||||
connect_timeout: 0.25s
|
||||
type: strict_dns
|
||||
lb_policy: round_robin
|
||||
load_assignment:
|
||||
cluster_name: machines-app
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: 127.0.0.1
|
||||
port_value: 4000
|
||||
- name: products-app
|
||||
connect_timeout: 0.25s
|
||||
type: strict_dns
|
||||
lb_policy: round_robin
|
||||
load_assignment:
|
||||
cluster_name: products-app
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: 127.0.0.1
|
||||
port_value: 4001
|
||||
@ -57,9 +57,3 @@ static_resources:
|
||||
socket_address:
|
||||
address: products-app
|
||||
port_value: 4001
|
||||
admin:
|
||||
access_log_path: "/dev/null"
|
||||
address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 800
|
||||
|
||||
Reference in New Issue
Block a user