aboutsummaryrefslogtreecommitdiffstats
path: root/distribution
diff options
context:
space:
mode:
authorNelson, Thomas (arthurdent3) <nelson24@att.com>2019-05-09 14:16:37 +0000
committerTschaen, Brendan <ctschaen@att.com>2019-05-13 14:34:05 -0400
commitd6e7b63cc580e7b3822be61fe92a493ad5e222a3 (patch)
tree5a055529781a2989585075e13426979464f5fb33 /distribution
parent9a8b8ae8d7c8d6931f99def68068f8936a8cc0b3 (diff)
Changes Listed below:
- Added build version API - Updated Keyspace active to use Properties setting - Update Libraries Netty,jbcrypt,Jackson Databind and log4j - Removed some irrelivant files - Updated some usint tests to ignore some tests(This will be updated soon) - Bugfixes - Missing Values, inform user. - Respond with proper error - Fix Locking Contention issue. - Add locking retry for atomic calls. Change-Id: Ie218dd92edb0c20e4a0efe33eeaaec84e5293c44 Issue-ID: MUSIC-393 Signed-off-by: Nelson, Thomas (arthurdent3) <nelson24@att.com>
Diffstat (limited to 'distribution')
-rw-r--r--distribution/cassandra/docker-entrypoint.sh46
-rw-r--r--distribution/cassandra_job/Dockerfile21
-rw-r--r--distribution/cassandra_job/runcql.sh21
-rw-r--r--distribution/dockermusic/README.md48
-rw-r--r--distribution/dockermusic/logs/README.md1
-rwxr-xr-xdistribution/dockermusic/music.sh101
-rw-r--r--distribution/dockermusic/properties/music.properties24
-rw-r--r--distribution/music/Dockerfile29
-rw-r--r--distribution/music/startup.sh36
9 files changed, 113 insertions, 214 deletions
diff --git a/distribution/cassandra/docker-entrypoint.sh b/distribution/cassandra/docker-entrypoint.sh
index a42d498e..34825bd2 100644
--- a/distribution/cassandra/docker-entrypoint.sh
+++ b/distribution/cassandra/docker-entrypoint.sh
@@ -4,13 +4,13 @@ set -e
# first arg is `-f` or `--some-option`
# or there are no args
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
- set -- cassandra -f "$@"
+ set -- cassandra -f "$@"
fi
# allow the container to be started with `--user`
if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then
- chown -R cassandra /var/lib/cassandra /var/log/cassandra "$CASSANDRA_CONFIG"
- exec gosu cassandra "$BASH_SOURCE" "$@"
+ chown -R cassandra /var/lib/cassandra /var/log/cassandra "$CASSANDRA_CONFIG"
+ exec gosu cassandra "$BASH_SOURCE" "$@"
fi
_ip_address() {
@@ -33,45 +33,17 @@ if [ "$1" = 'cassandra' ]; then
CASSANDRA_LISTEN_ADDRESS="$(_ip_address)"
fi
- : ${CASSANDRA_BROADCAST_ADDRESS="$CASSANDRA_LISTEN_ADDRESS"}
+echo "#############################################"
+echo "############## Update music.cql #############"
+echo "#############################################"
if [ "$CASSANDRA_BROADCAST_ADDRESS" = 'auto' ]; then
CASSANDRA_BROADCAST_ADDRESS="$(_ip_address)"
fi
- : ${CASSANDRA_BROADCAST_RPC_ADDRESS:=$CASSANDRA_BROADCAST_ADDRESS}
-
- if [ -n "${CASSANDRA_NAME:+1}" ]; then
- : ${CASSANDRA_SEEDS:="cassandra"}
+ if [ "${MUSIC_REPLICATION_FACTOR}" ]; then
+ sed -ri 's/REPLICATION_FACTOR/'${MUSIC_REPLICATION_FACTOR}'/' "$f"
fi
- : ${CASSANDRA_SEEDS:="$CASSANDRA_BROADCAST_ADDRESS"}
-
- sed -ri 's/(- seeds:).*/\1 "'"$CASSANDRA_SEEDS"'"/' "$CASSANDRA_CONFIG/cassandra.yaml"
-
- for yaml in \
- broadcast_address \
- broadcast_rpc_address \
- cluster_name \
- endpoint_snitch \
- listen_address \
- num_tokens \
- rpc_address \
- start_rpc \
- ; do
- var="CASSANDRA_${yaml^^}"
- val="${!var}"
- if [ "$val" ]; then
- sed -ri 's/^(# )?('"$yaml"':).*/\2 '"$val"'/' "$CASSANDRA_CONFIG/cassandra.yaml"
- fi
- done
-
- for rackdc in dc rack; do
- var="CASSANDRA_${rackdc^^}"
- val="${!var}"
- if [ "$val" ]; then
- sed -ri 's/^('"$rackdc"'=).*/\1 '"$val"'/' "$CASSANDRA_CONFIG/cassandra-rackdc.properties"
- fi
- done
-fi
+done
echo "#############################################"
echo "############## Update music.cql #############"
diff --git a/distribution/cassandra_job/Dockerfile b/distribution/cassandra_job/Dockerfile
index 528c3bf4..937afdee 100644
--- a/distribution/cassandra_job/Dockerfile
+++ b/distribution/cassandra_job/Dockerfile
@@ -1,3 +1,24 @@
+#
+# ============LICENSE_START==========================================
+# org.onap.music
+# ===================================================================
+# Copyright (c) 2019 AT&T Intellectual Property
+# ===================================================================
+# 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.
+#
+# ============LICENSE_END=============================================
+# ====================================================================
+
#registry.hub.docker.com/
FROM library/cassandra:3.11
ENV DEF_USER=cassandra
diff --git a/distribution/cassandra_job/runcql.sh b/distribution/cassandra_job/runcql.sh
index 2ffd5f2f..89396bfc 100644
--- a/distribution/cassandra_job/runcql.sh
+++ b/distribution/cassandra_job/runcql.sh
@@ -1,4 +1,25 @@
#! /bin/bash
+#
+# ============LICENSE_START==========================================
+# org.onap.music
+# ===================================================================
+# Copyright (c) 2019 AT&T Intellectual Property
+# ===================================================================
+# 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.
+#
+# ============LICENSE_END=============================================
+# ====================================================================
+
if [ -z "$TIMEOUT" ]; then
TIMEOUT=10;
fi
diff --git a/distribution/dockermusic/README.md b/distribution/dockermusic/README.md
deleted file mode 100644
index a645ce70..00000000
--- a/distribution/dockermusic/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-### Docker Setup for Single instance of MUSIC
-
-<p>Please update the <b>properties/music.properties</b> file to fit your env.<br/>
-Update the music.sh file.<br/>
-The beginning of the <b>music.sh</b> file contains various variables.<br/></p>
-NEXUS_DOCKER_REPO - default REPO - Will read /opt/config/nexus_docker_repo.txt if other is needed.<br/>
-CASS_IMG - Cassandra Image<br/>
-TOMCAT_IMG - Tomcat Image<br/>
-ZK_IMG - Zookeeper Image<br/>
-MUSIC_IMG - Music Image containing the MUSIC war file.<br/>
-WORK_DIR - Default to PWD.<br/>
-CASS_USERNAME - Username for Cassandra - should match cassandra.user in music.properties
-file<br/>
-CASS_PASSWORD - Password for Cassandra - should match cassandra.password in music.properties.<br/>
-
-MUSIC Logs will be saved in logs/MUSIC after start of tomcat.<br/>
-
-```bash
-# Start containers
-./music.sh start
-# Stop containers
-./music.sh stop
-```
-
-If you want to check out Cassandra db with cqlsh.
-```bash
-docker exec –it music-db bash
-#at the prompt youcan run cqlsh as:
-cqlsh –u <user> -p <password>
-```
-
-Zookeeper:
-
-```bash
-docker exec –it music-zk bash
-#and then run:
-zkCli.sh
-```
-
-For other logs do <br/>
-```bash
-docker logs music-tomcat (tomcat)<br/>
-```
-to have rolling logs use –f as docker logs –f music-tomcat<br/>
-```bash
-docker logs music-zk (zookeeper)<br/>
-docker logs music-db (Cassandra )<br/>
-``` \ No newline at end of file
diff --git a/distribution/dockermusic/logs/README.md b/distribution/dockermusic/logs/README.md
deleted file mode 100644
index 88c252a7..00000000
--- a/distribution/dockermusic/logs/README.md
+++ /dev/null
@@ -1 +0,0 @@
-This folder is where the logs will be stored for MUSIC. \ No newline at end of file
diff --git a/distribution/dockermusic/music.sh b/distribution/dockermusic/music.sh
deleted file mode 100755
index e4c2af8c..00000000
--- a/distribution/dockermusic/music.sh
+++ /dev/null
@@ -1,101 +0,0 @@
-#
-# -------------------------------------------------------------------------
-# Copyright (c) 2017 AT&T Intellectual Property
-#
-# 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.
-#
-# -------------------------------------------------------------------------
-# In this example we are building a docker bridge network(music-net) for all
-# the containers
-# Then we connect the host bridge network(bridge) to the internal network(music-net)
-#
-#
-#
-SS=0
-if [ -e /opt/config/nexus_docker_repo.txt ]
-then
- NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
-else
- NEXUS_DOCKER_REPO=nexus3.onap.org:10001
-fi
-echo "Using ${NEXUS_DOCKER_REPO} for docker Repo"
-
-CASS_IMG=${NEXUS_DOCKER_REPO}/onap/music/cassandra_music:latest
-MUSIC_IMG=${NEXUS_DOCKER_REPO}/onap/music/music:latest
-TOMCAT_IMG=library/tomcat:8.5
-ZK_IMG=library/zookeeper:3.4
-WORK_DIR=${PWD}
-CASS_USERNAME=cassandra1
-CASS_PASSWORD=cassandra1
-
-if [ "$1" = "start" ]; then
-
-# Create Volume for mapping war file and tomcat
-docker volume create music-vol;
-
-# Create a network for all the containers to run in.
-docker network create music-net;
-
-# Start Cassandra
-docker run -d --rm --name music-db --network music-net \
--p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" \
--e CASSUSER=${CASS_USERNAME} \
--e CASSPASS=${CASS_PASSWORD} \
-${CASS_IMG};
-
-# Start Music war
-docker run -d --rm --name music-war \
--v music-vol:/app \
-${MUSIC_IMG};
-
-# Start Zookeeper
-docker run -d --rm --name music-zk --network music-net \
--p "2181:2181" -p "2888:2888" -p "3888:3888" \
-${ZK_IMG};
-
-# Delay for Cassandra
-sleep 20;
-
-# Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
-docker run -d --rm --name music-tomcat --network music-net -p "8080:8080" \
--v music-vol:/usr/local/tomcat/webapps \
--v ${WORK_DIR}/properties:/opt/app/music/etc:ro \
--v ${WORK_DIR}/logs:/opt/app/music/logs \
-${TOMCAT_IMG};
-
-# Connect tomcat to host bridge network so that its port can be seen.
-docker network connect bridge music-tomcat;
-SS=1;
-fi
-
-
-# Shutdown and clean up.
-if [ "$1" = "stop" ]; then
-docker stop music-war;
-docker stop music-db;
-docker stop music-zk;
-docker stop music-tomcat;
-docker network rm music-net;
-sleep 5;
-docker volume rm music-vol;
-SS=1
-fi
-
-if [ $SS = 0 ]; then
- echo "Please type ${0} start or ${0} stop"
-fi
-
-
-
-
-
diff --git a/distribution/dockermusic/properties/music.properties b/distribution/dockermusic/properties/music.properties
deleted file mode 100644
index d0c50400..00000000
--- a/distribution/dockermusic/properties/music.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-my.public.ip=localhost
-all.public.ips=localhost
-my.id=0
-all.ids=0
-#######################################
-# Optional current values are defaults
-#######################################
-zookeeper.host=music-zk
-cassandra.host=music-db
-#music.ip=localhost
-#debug=true
-#music.rest.ip=localhost
-#lock.lease.period=6000
-cassandra.user=cassandra1
-cassandra.password=cassandra1
-# AAF Endpoint if using AAF
-aaf.endpoint.url=https://aafist.test.att.com:8095/proxy/authz/nss/
-#aaf.endpoint.url=https://aaf.api.simpledemo.onap.org
-# Admin API
-aaf.admin.url=https://aafist.test.att.com:8095/proxy/authz/users/
-admin.aaf.role=com.att.music.api.admin_api
-music.namespace=com.att.music.api
-
-
diff --git a/distribution/music/Dockerfile b/distribution/music/Dockerfile
index b82b72a4..c3253ae0 100644
--- a/distribution/music/Dockerfile
+++ b/distribution/music/Dockerfile
@@ -1,11 +1,34 @@
+#
+# ============LICENSE_START==========================================
+# org.onap.music
+# ===================================================================
+# Copyright (c) 2019 AT&T Intellectual Property
+# ===================================================================
+# 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.
+#
+# ============LICENSE_END=============================================
+# ====================================================================
+
FROM openjdk:8
LABEL purpose="Springboot for MUSIC"
RUN apt update && apt install -y netcat telnet vim vim-common
RUN groupadd --gid 1000 music && useradd --gid 1000 --uid 1000 music
-RUN mkdir -p /opt/app/music
+RUN mkdir -p /opt/app/music/logs/MUSIC
COPY MUSIC.jar /opt/app/music
+COPY startup.sh /opt/app/music
RUN mkdir -p /opt/app/music/logs && \
- chown -R music:music /opt/app/music/
+ chown -R music:music /opt/app/music/ && \
+ chmod 755 /opt/app/music/startup.sh
USER music:music
WORKDIR /opt/app/music
-CMD ["/bin/bash","-c","java -jar MUSIC.jar >> /opt/app/music/logs/music-sb.log 2>&1"]
+CMD ["/opt/app/music/startup.sh"]
diff --git a/distribution/music/startup.sh b/distribution/music/startup.sh
new file mode 100644
index 00000000..420436c0
--- /dev/null
+++ b/distribution/music/startup.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# ============LICENSE_START==========================================
+# org.onap.music
+# ===================================================================
+# Copyright (c) 2019 AT&T Intellectual Property
+# ===================================================================
+# 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.
+#
+# ============LICENSE_END=============================================
+# ====================================================================
+
+echo "Running startup script to get password from certman"
+PWFILE=/opt/app/aafcertman/.password
+LOGFILE=/opt/app/music/logs/MUSIC/music-sb.log
+echo "PWFILE=${PWFILE}" >> $LOGFILE
+if [ -f $PWFILE ]; then
+echo "Found ${PWFILE}" >> $LOGFILE
+PASSWORD=$(cat ${PWFILE})
+echo "#### Using Password from ${PWFILE} for Certs" >> ${LOGFILE}
+else
+PASSWORD=changeit
+echo "#### Using Default Password for Certs" >> ${LOGFILE}
+fi
+
+java -jar MUSIC.jar --server.ssl.key-store-password="${PASSWORD}" --aaf_password="enc:${PASSWORD}" 2>&1 | tee ${LOGFILE}