-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from jhernand/add_development_reverse_proxy_sc…
…ript Add development reverse proxy
- Loading branch information
Showing
3 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.log | ||
/__debug* | ||
/oran-o2ims |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2023 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
# This script starts the servers and the reverse proxy in the local machine. It is intended for | ||
# use in the development environment, where it is convenient to run the servers locally in order | ||
# to debug them. Stop it with Ctr+C, and it will kill the servers. | ||
|
||
# Stop the servers when finished: | ||
function clean { | ||
kill -9 ${pids} | ||
} | ||
trap clean EXIT | ||
|
||
# Start the metadata server: | ||
./oran-o2ims start metadata-server \ | ||
--log-file="servers.log" \ | ||
--log-level="debug" \ | ||
--log-field="server=metadata" \ | ||
--log-field="pid=%p" \ | ||
--api-listener-address="127.0.0.1:8000" \ | ||
--cloud-id="123" \ | ||
& | ||
pids="${pids} $!" | ||
|
||
# Start the deployment manager server: | ||
./oran-o2ims start deployment-manager-server \ | ||
--log-file="servers.log" \ | ||
--log-level="debug" \ | ||
--log-field="server=deployment-manager" \ | ||
--log-field="pid=%p" \ | ||
--api-listener-address="127.0.0.1:8001" \ | ||
--cloud-id="123" \ | ||
--backend-url="${BACKEND_URL}" \ | ||
--backend-token="${BACKEND_TOKEN}" \ | ||
& | ||
pids="${pids} $!" | ||
|
||
# Start the reverse proxy: | ||
podman run \ | ||
--rm \ | ||
--network="host" \ | ||
--volume="${PWD}/proxy.yaml:/etc/proxy.yaml:z" \ | ||
--entrypoint="/usr/local/bin/envoy" \ | ||
docker.io/envoyproxy/envoy:v1.28.0 \ | ||
--config-path "/etc/proxy.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# | ||
# Copyright (c) 2023 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
# in compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under the License | ||
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
# or implied. See the License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
# This is an example Envoy configuration that redirects requests to the servers, so that they | ||
# appear to be a single server. It is intended for use in development environments, together | ||
# with the 'proxy.sh' script. | ||
|
||
admin: | ||
access_log_path: /dev/null | ||
address: | ||
socket_address: | ||
address: 127.0.0.1 | ||
port_value: 9001 | ||
|
||
static_resources: | ||
|
||
clusters: | ||
|
||
- name: metadata-server | ||
connect_timeout: 1s | ||
type: STRICT_DNS | ||
lb_policy: ROUND_ROBIN | ||
load_assignment: | ||
cluster_name: metadata-server | ||
endpoints: | ||
- lb_endpoints: | ||
- endpoint: | ||
address: | ||
socket_address: | ||
address: 127.0.0.1 | ||
port_value: 8000 | ||
|
||
- name: deployment-manager-server | ||
connect_timeout: 1s | ||
type: STRICT_DNS | ||
lb_policy: ROUND_ROBIN | ||
load_assignment: | ||
cluster_name: deployment-manager-server | ||
endpoints: | ||
- lb_endpoints: | ||
- endpoint: | ||
address: | ||
socket_address: | ||
address: 127.0.0.1 | ||
port_value: 8001 | ||
|
||
listeners: | ||
|
||
- name: ingress | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 9000 | ||
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 | ||
access_log: | ||
- name: envoy.access_loggers.file | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/stdout | ||
stat_prefix: ingress | ||
http_filters: | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
route_config: | ||
name: ingress | ||
virtual_hosts: | ||
- name: all | ||
domains: | ||
- "*" | ||
routes: | ||
|
||
# Requests for the deployment manager server: | ||
- name: deployment-manager | ||
match: | ||
prefix: /O2ims_infrastructureInventory/v1/deploymentManagers | ||
route: | ||
cluster: deployment-manager-server | ||
timeout: 300s | ||
|
||
# Everything else goes to the metadata server, which will respond with 404 to most | ||
# requests: | ||
- name: metadata | ||
match: | ||
prefix: / | ||
route: | ||
cluster: metadata-server | ||
timeout: 300s |