API Portal db-restore removes all running containers

book

Article ID: 198903

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

the db-restore script removes all running containers from the machine.
I noticed the same which is under 4.5.
This is a bug in my opinion, since it is not necessary and should not affect other processes and containers running on the sever that are not related to the portal.

The script removes anything apart from the portaldb containers:
man grep 
   -v, --invert-match
              Invert the sense of matching, to select non-matching lines.  (-v is specified by POSIX.)

Therefore 
docker ps --format "{{.Names}}" -> just  returns the names of the  docker containers.
grep  -v portaldb -> excludes the portaldb from the selected containers

Example docker ps --format "{{.Names}}":
log2splunk_splunk-proxy.iiag4ez2lh64wghixsicwuvw3.xvbg22eifeg84boljxbneadth
log2splunk_filebeat.iiag4ez2lh64wghixsicwuvw3.3907zq5o536tidrp3xebow69n
log2splunk_logstash.iiag4ez2lh64wghixsicwuvw3.j30z4qnbl1ow0jerstne7lgf2
ssg_certstoreparser.iiag4ez2lh64wghixsicwuvw3.ydu41wjxq366pvjqdlxu1ty04
portal_dispatcher.iiag4ez2lh64wghixsicwuvw3.rbr1nq7ggpq4jfc2m9eq947sa
portal_portal-enterprise.iiag4ez2lh64wghixsicwuvw3.47geadat8aso11oicqr1j86f8
portal_tenant-provisioner.1.kxcixl7eayxlfmz7lc0ftvgs6
portal_apim.iiag4ez2lh64wghixsicwuvw3.l1m4bbn3vui1pazts4ikt9acm
portal_pssg.iiag4ez2lh64wghixsicwuvw3.n1eajlgo7m08ppma503ax5ka1
portal_solr.1.ijih0nvsxmca5u1ncxv085iyx
portal_rabbitmq.iiag4ez2lh64wghixsicwuvw3.zjquabl0kqohjqa14kqweanqv
portal_analytics-server.iiag4ez2lh64wghixsicwuvw3.io7o0jelwe8htfmuu217v61dd
portal_portaldb.1.9o1tmax8vgjf5zn2vqx4b659o
portal_authenticator.iiag4ez2lh64wghixsicwuvw3.m62ujckas5ukdhutx5jr1cwi9
portal_portaldb-slave.1.yv3o3m537tww5gi05uiwf1s0q
portal_portal-data.iiag4ez2lh64wghixsicwuvw3.xlwnp9yqoesinptxdyxl4yfdr
dnsmasq_dnsmasq.iiag4ez2lh64wghixsicwuvw3.53596zk7hhnkm6szmw9imlny0
...
and

 docker ps --format "{{.Names}}"   | grep -v portaldb returns:

log2splunk_splunk-proxy.iiag4ez2lh64wghixsicwuvw3.xvbg22eifeg84boljxbneadth
log2splunk_filebeat.iiag4ez2lh64wghixsicwuvw3.3907zq5o536tidrp3xebow69n
log2splunk_logstash.iiag4ez2lh64wghixsicwuvw3.j30z4qnbl1ow0jerstne7lgf2
ssg_certstoreparser.iiag4ez2lh64wghixsicwuvw3.ydu41wjxq366pvjqdlxu1ty04
portal_dispatcher.iiag4ez2lh64wghixsicwuvw3.rbr1nq7ggpq4jfc2m9eq947sa
portal_portal-enterprise.iiag4ez2lh64wghixsicwuvw3.47geadat8aso11oicqr1j86f8
portal_tenant-provisioner.1.kxcixl7eayxlfmz7lc0ftvgs6
portal_apim.iiag4ez2lh64wghixsicwuvw3.l1m4bbn3vui1pazts4ikt9acm
portal_pssg.iiag4ez2lh64wghixsicwuvw3.n1eajlgo7m08ppma503ax5ka1
portal_solr.1.ijih0nvsxmca5u1ncxv085iyx
portal_rabbitmq.iiag4ez2lh64wghixsicwuvw3.zjquabl0kqohjqa14kqweanqv
portal_analytics-server.iiag4ez2lh64wghixsicwuvw3.io7o0jelwe8htfmuu217v61dd
portal_authenticator.iiag4ez2lh64wghixsicwuvw3.m62ujckas5ukdhutx5jr1cwi9
portal_portal-data.iiag4ez2lh64wghixsicwuvw3.xlwnp9yqoesinptxdyxl4yfdr
dnsmasq_dnsmasq.iiag4ez2lh64wghixsicwuvw3.53596zk7hhnkm6szmw9imlny0

Environment

Release : 4.5

Component : API PORTAL

Resolution

The attached script should resolve the customer's problem.  Also, the actual fix is targeted for Portal 5.0. 

Attachments

1599476869092__db-restore-updated.sh get_app