Skip to content

Commit

Permalink
Remove metrics endpoint
Browse files Browse the repository at this point in the history
The endpoint it no longer used, as we are now running the OCS
gateway in the cloud.
  • Loading branch information
mpeterss committed Oct 3, 2019
1 parent 24ba2be commit dd0a9c3
Show file tree
Hide file tree
Showing 14 changed files with 5 additions and 255 deletions.
12 changes: 2 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ jobs:
command: |
scripts/generate-selfsigned-ssl-certs.sh ocs.dev.ostelco.org
cp certs/ocs.dev.ostelco.org/nginx.crt ocsgw/cert/ocs.crt
scripts/generate-selfsigned-ssl-certs.sh metrics.dev.ostelco.org
cp certs/metrics.dev.ostelco.org/nginx.crt ocsgw/cert/metrics.crt
- run:
name: Acceptance Tests
command: docker-compose up --build --abort-on-container-exit
Expand Down Expand Up @@ -255,13 +253,10 @@ jobs:
echo $GOOGLE_DEV_ENDPOINTS_CREDENTIALS > ${HOME}/gcloud-service-key.json
gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
sed -i 's/GCP_PROJECT_ID/'${DEV_PROJECT}'/g' prime/infra/dev/ocs-api.yaml
sed -i 's/GCP_PROJECT_ID/'${DEV_PROJECT}'/g' prime/infra/dev/metrics-api.yaml
sed -i 's/GCP_PROJECT_ID/'${DEV_PROJECT}'/g' prime/infra/dev/ocs-api.yaml
python -m grpc_tools.protoc --include_imports --include_source_info --proto_path=ocs-grpc-api/src/main/proto --descriptor_set_out=ocs_descriptor.pb ocs.proto
python -m grpc_tools.protoc --include_imports --include_source_info --proto_path=analytics-grpc-api/src/main/proto --descriptor_set_out=metrics_descriptor.pb prime_metrics.proto
gcloud endpoints services deploy ocs_descriptor.pb prime/infra/dev/ocs-api.yaml
gcloud endpoints services deploy metrics_descriptor.pb prime/infra/dev/metrics-api.yaml
gcloud endpoints services deploy prime/infra/dev/prime-customer-api.yaml
gcloud endpoints services deploy prime/infra/dev/prime-webhooks.yaml
gcloud endpoints services deploy prime/infra/dev/prime-houston-api.yaml
Expand Down Expand Up @@ -322,13 +317,10 @@ jobs:
echo $GOOGLE_PROD_ENDPOINTS_CREDENTIALS > ${HOME}/gcloud-service-key.json
gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
sed -i 's/GCP_PROJECT_ID/'${PROD_PROJECT}'/g' prime/infra/prod/ocs-api.yaml
sed -i 's/GCP_PROJECT_ID/'${PROD_PROJECT}'/g' prime/infra/prod/metrics-api.yaml
sed -i 's/GCP_PROJECT_ID/'${PROD_PROJECT}'/g' prime/infra/prod/ocs-api.yaml
python -m grpc_tools.protoc --include_imports --include_source_info --proto_path=ocs-grpc-api/src/main/proto --descriptor_set_out=ocs_descriptor.pb ocs.proto
python -m grpc_tools.protoc --include_imports --include_source_info --proto_path=analytics-grpc-api/src/main/proto --descriptor_set_out=metrics_descriptor.pb prime_metrics.proto
gcloud endpoints services deploy ocs_descriptor.pb prime/infra/prod/ocs-api.yaml
gcloud endpoints services deploy metrics_descriptor.pb prime/infra/prod/metrics-api.yaml
gcloud endpoints services deploy prime/infra/prod/prime-customer-api.yaml
gcloud endpoints services deploy prime/infra/prod/prime-webhooks.yaml
gcloud endpoints services deploy prime/infra/prod/prime-houston-api.yaml
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ class AnalyticsModule : PrimeModule {

CustomMetricsRegistry.init(env.metrics())

val server = AnalyticsGrpcServer(8083, AnalyticsGrpcService())

env.lifecycle().manage(server)

// dropwizard starts Analytics events publisher
env.lifecycle().manage(ActiveUsersPublisher)
env.lifecycle().manage(DataConsumptionInfoPublisher)
env.lifecycle().manage(PurchasePublisher)
env.lifecycle().manage(RefundPublisher)
Expand All @@ -47,10 +42,6 @@ data class AnalyticsConfig(
@JsonProperty("purchaseInfoTopicId")
val purchaseInfoTopicId: String,

@NotBlank
@JsonProperty("activeUsersTopicId")
val activeUsersTopicId: String,

@NotBlank
@JsonProperty("simProvisioningTopicId")
val simProvisioningTopicId: String,
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions dataflow-pipelines/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ plugins {
dependencies {
implementation(kotlin("stdlib-jdk8"))

implementation(project(":analytics-grpc-api"))

implementation("com.google.cloud:google-cloud-pubsub:${Version.googleCloudPubSub}")

implementation("org.apache.beam:beam-sdks-java-core:${Version.beam}")
Expand Down
20 changes: 0 additions & 20 deletions docker-compose.esp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,6 @@ services:
ipv4_address: 172.16.238.4
default:

metrics-esp:
container_name: metrics-esp
image: gcr.io/endpoints-release/endpoints-runtime:1
volumes:
- "./prime/config:/esp"
- "./certs/metrics.dev.ostelco.org:/etc/nginx/ssl"
command: >
--service=metrics.dev.ostelco.org
--rollout_strategy=managed
--http2_port=80
--ssl_port=443
--backend=grpc://172.16.238.5:8083
--service_account_key=/esp/prime-service-account.json
networks:
net:
aliases:
- "metrics.dev.ostelco.org"
ipv4_address: 172.16.238.6
default:

ocsgw:
container_name: ocsgw
build: ocsgw
Expand Down
11 changes: 1 addition & 10 deletions docs/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@ grep -i prime-service-account $(find . -name '.gitignore') | awk -F: '{print $1}
cd certs/ocs.dev.ostelco.org
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./nginx.key -out ./nginx.crt -subj '/CN=ocs.dev.ostelco.org'
cp nginx.crt ../../ocsgw/cert/ocs.crt
```
* Create self-signed certificate for nginx with domain as `metrics.dev.ostelco.org` and place them at following location:
* In `certs/metrics.dev.ostelco.org`, keep `nginx.key` and `nginx.cert`.
* In `ocsgw/cert`, keep `metrics.cert`.

```bash
cd certs/metrics.dev.ostelco.org
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./nginx.key -out ./nginx.crt -subj '/CN=metrics.dev.ostelco.org'
cp nginx.crt ../../ocsgw/cert/metrics.crt
```
``

* Set Stripe API key as env variable - `STRIPE_API_KEY`. Note: It is the key denoted as "Secret key" that shuld
be set in this env variable.
Expand Down
1 change: 0 additions & 1 deletion ocsgw/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
implementation(kotlin("stdlib-jdk8"))

implementation(project(":ocs-grpc-api"))
implementation(project(":analytics-grpc-api"))

implementation(project(":diameter-stack"))
implementation(project(":diameter-ha"))
Expand Down
8 changes: 0 additions & 8 deletions ocsgw/script/wait_including_esps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ done

echo "ESP launched"

echo "OCSGW waiting Metrics ESP to launch on 80..."

while ! nc -z metrics.dev.ostelco.org 80; do
sleep 0.1 # wait for 1/10 of the second before check again
done

echo "Metrics ESP launched"

# Start app for testing
exec java \
-Dfile.encoding=UTF-8 \
Expand Down
1 change: 0 additions & 1 deletion prime-modules/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ dependencies {
api("com.fasterxml.jackson.module:jackson-module-kotlin:${Version.jackson}")

api(project(":ocs-grpc-api"))
api(project(":analytics-grpc-api"))
api(project(":model"))

api("io.dropwizard:dropwizard-core:${Version.dropwizard}")
Expand Down
20 changes: 2 additions & 18 deletions prime/infra/LEGACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Reference:

## Endpoint

Generate self-contained protobuf descriptor file - `ocs_descriptor.pb` & `metrics_descriptor.pb`
Generate self-contained protobuf descriptor file - `ocs_descriptor.pb`

```bash
pyenv versions
Expand All @@ -94,19 +94,12 @@ python -m grpc_tools.protoc \
--descriptor_set_out=ocs_descriptor.pb \
ocs.proto

python -m grpc_tools.protoc \
--include_imports \
--include_source_info \
--proto_path=analytics-grpc-api/src/main/proto \
--descriptor_set_out=metrics_descriptor.pb \
prime_metrics.proto
```

Deploy endpoints

```bash
gcloud endpoints services deploy ocs_descriptor.pb prime/infra/prod/ocs-api.yaml
gcloud endpoints services deploy metrics_descriptor.pb prime/infra/prod/metrics-api.yaml
```

## Deployment & Service
Expand Down Expand Up @@ -152,7 +145,7 @@ kubectl describe service prime-service
gcloud endpoints services deploy prime/infra/prod/prime-customer-api.yaml
```

## SSL secrets for api.ostelco.org, ocs.ostelco.org & metrics.ostelco.org
## SSL secrets for api.ostelco.org, ocs.ostelco.org
The endpoints runtime expects the SSL configuration to be named
as `nginx.crt` and `nginx.key`. Sample command to create the secret:
```bash
Expand All @@ -163,7 +156,6 @@ kubectl create secret generic api-ostelco-ssl \
The secret for ...
* `api.ostelco.org` is in `api-ostelco-ssl`
* `ocs.ostelco.org` is in `ocs-ostelco-ssl`
* `metrics.ostelco.org` is in `metrics-ostelco-ssl`

# For Dev cluster

Expand Down Expand Up @@ -210,20 +202,12 @@ python -m grpc_tools.protoc \
--proto_path=ocs-grpc-api/src/main/proto \
--descriptor_set_out=ocs_descriptor.pb \
ocs.proto

python -m grpc_tools.protoc \
--include_imports \
--include_source_info \
--proto_path=analytics-grpc-api/src/main/proto \
--descriptor_set_out=metrics_descriptor.pb \
prime_metrics.proto
```

Deploy endpoints

```bash
gcloud endpoints services deploy ocs_descriptor.pb prime/infra/dev/ocs-api.yaml
gcloud endpoints services deploy metrics_descriptor.pb prime/infra/dev/metrics-api.yaml
```

* Client API HTTP endpoint
Expand Down
15 changes: 0 additions & 15 deletions run-full-regression-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ if [[ ! -f "ocsgw/cert/ocs.crt" ]] ; then
cp nginx.crt ../../ocsgw/cert/ocs.crt)
fi


#
# If necessary, Create self-signed certificate for nginx with domain
# as `metrics.dev.ostelco.org` and place them at following location:
# * In `certs/metrics.dev.ostelco.org`, keep `nginx.key` and `nginx.cert`.
# In `ocsgw/cert`, keep `metrics.cert`.
#

if [[ ! -f "ocsgw/cert/metrics.crt" ]] ; then
(cd certs/metrics.dev.ostelco.org;
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./nginx.key -out ./nginx.crt -subj '/CN=metrics.dev.ostelco.org' ;
cp nginx.crt ../../ocsgw/cert/metrics.crt)
fi


#
# Then build (or not, we're using gradle) the whole system
#
Expand Down
Loading

0 comments on commit dd0a9c3

Please sign in to comment.