diff options
author | platania <platania@research.att.com> | 2017-02-16 11:20:22 -0500 |
---|---|---|
committer | platania <platania@research.att.com> | 2017-02-16 11:20:47 -0500 |
commit | 3426556541256f93d2cba65df3b9c8d1d1772861 (patch) | |
tree | 56e5b26481400d35e3e2e36be20df953793e348d /boot | |
parent | f525cb9014ae27ddd795f933dee54a78b214a589 (diff) |
Initial OpenECOMP Demo commit
Change-Id: Ibf8696196a7ac2c84ac8aa7cde1982c9c89fb64d
Signed-off-by: platania <platania@research.att.com>
Diffstat (limited to 'boot')
-rw-r--r-- | boot/.DS_Store | bin | 0 -> 6148 bytes | |||
-rw-r--r-- | boot/.gitkeep | 0 | ||||
-rw-r--r-- | boot/aaf_serv.sh | 98 | ||||
-rw-r--r-- | boot/aaf_vm_init.sh | 4 | ||||
-rw-r--r-- | boot/aai_serv.sh | 98 | ||||
-rw-r--r-- | boot/aai_vm_init.sh | 28 | ||||
-rw-r--r-- | boot/appc_serv.sh | 98 | ||||
-rw-r--r-- | boot/appc_vm_init.sh | 14 | ||||
-rw-r--r-- | boot/asdc_ext_volume_partitions.txt | 7 | ||||
-rw-r--r-- | boot/asdc_serv.sh | 98 | ||||
-rw-r--r-- | boot/asdc_vm_init.sh | 9 | ||||
-rw-r--r-- | boot/db_openecomp_org | 109 | ||||
-rw-r--r-- | boot/dcae_serv.sh | 116 | ||||
-rw-r--r-- | boot/dcae_vm_init.sh | 23 | ||||
-rw-r--r-- | boot/mr_serv.sh | 116 | ||||
-rw-r--r-- | boot/mr_vm_init.sh | 22 | ||||
-rw-r--r-- | boot/mso_serv.sh | 98 | ||||
-rw-r--r-- | boot/mso_vm_init.sh | 50 | ||||
-rw-r--r-- | boot/named.conf.local | 12 | ||||
-rw-r--r-- | boot/named.conf.options | 39 | ||||
-rw-r--r-- | boot/policy_serv.sh | 98 | ||||
-rw-r--r-- | boot/policy_vm_init.sh | 9 | ||||
-rw-r--r-- | boot/portal_serv.sh | 98 | ||||
-rw-r--r-- | boot/portal_vm_init.sh | 29 | ||||
-rw-r--r-- | boot/robot_serv.sh | 98 | ||||
-rw-r--r-- | boot/robot_vm_init.sh | 19 | ||||
-rw-r--r-- | boot/sdnc_serv.sh | 98 | ||||
-rw-r--r-- | boot/sdnc_vm_init.sh | 9 | ||||
-rw-r--r-- | boot/vid_serv.sh | 98 | ||||
-rw-r--r-- | boot/vid_vm_init.sh | 15 |
30 files changed, 1610 insertions, 0 deletions
diff --git a/boot/.DS_Store b/boot/.DS_Store Binary files differnew file mode 100644 index 00000000..5008ddfc --- /dev/null +++ b/boot/.DS_Store diff --git a/boot/.gitkeep b/boot/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/boot/.gitkeep diff --git a/boot/aaf_serv.sh b/boot/aaf_serv.sh new file mode 100644 index 00000000..73d22ad3 --- /dev/null +++ b/boot/aaf_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./aaf_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/aaf_vm_init.sh b/boot/aaf_vm_init.sh new file mode 100644 index 00000000..1f29429c --- /dev/null +++ b/boot/aaf_vm_init.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd dcae-startup-vm-aaf +./deploy.sh diff --git a/boot/aai_serv.sh b/boot/aai_serv.sh new file mode 100644 index 00000000..2e0dbab3 --- /dev/null +++ b/boot/aai_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./aai_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/aai_vm_init.sh b/boot/aai_vm_init.sh new file mode 100644 index 00000000..148fc583 --- /dev/null +++ b/boot/aai_vm_init.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DMAAP_TOPIC=$(cat /opt/config/dmaap_topic.txt) +GITLAB_CERTNAME=$(cat /opt/config/gitlab_certname.txt) +GITLAB_USERNAME=$(cat /opt/config/gitlab_username.txt) +GITLAB_PASSWD=$(cat /opt/config/gitlab_password.txt) + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +docker pull $NEXUS_DOCKER_REPO/ecomp/aai-hbase-1.2.3 +docker rm -f hbase-1.2.3 +docker run -d --net=host --name="hbase-1.2.3" $NEXUS_DOCKER_REPO/ecomp/aai-hbase-1.2.3 + +# Wait 3 minutes before instantiating the A&AI container +sleep 180 + +docker pull $NEXUS_DOCKER_REPO/ecomp/ajsc-aai:latest +docker rm -f aai-service +docker run --name=aai-service --net=host -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt -it -e GITLAB_CERTNAME=$GITLAB_CERTNAME -e GITLAB_USERNAME=$GITLAB_USERNAME -e GITLAB_PASSWORD=$GITLAB_PASSWD -e AAI_REPO_PATH=OpenECOMP -e AAI_CHEF_ENV=simpledemo -d -e AAI_CHEF_LOC=/var/chef/aai-data/environments -e docker_gitbranch=develop $NEXUS_DOCKER_REPO/ecomp/ajsc-aai:latest + +docker pull $NEXUS_DOCKER_REPO/ecomp/model-loader:latest +docker rm -f model-loader-service + +docker run --name=model-loader-service -it -d -e DISTR_CLIENT_ASDC_ADDRESS=c2.vm1.asdc.simpledemo.openecomp.org:8443 -e DISTR_CLIENT_ENVIRONMENT_NAME=$DMAAP_TOPIC -e DISTR_CLIENT_USER=aai -e DISTR_CLIENT_PASSWORD=OBF:1ks51l8d1o3i1pcc1r2r1e211r391kls1pyj1z7u1njf1lx51go21hnj1y0k1mli1sop1k8o1j651vu91mxw1vun1mze1vv11j8x1k5i1sp11mjc1y161hlr1gm41m111nkj1z781pw31kku1r4p1e391r571pbm1o741l4x1ksp -e APP_SERVER_BASE_URL=https://c1.vm1.aai.simpledemo.openecomp.org:8443 -e APP_SERVER_KEYSTORE_PASSWORD=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o -e APP_SERVER_AUTH_USER=ModelLoader -e APP_SERVER_AUTH_PASSWORD=OBF:1qvu1v2h1sov1sar1wfw1j7j1wg21saj1sov1v1x1qxw $NEXUS_DOCKER_REPO/ecomp/model-loader:latest + diff --git a/boot/appc_serv.sh b/boot/appc_serv.sh new file mode 100644 index 00000000..a71db888 --- /dev/null +++ b/boot/appc_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./appc_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/appc_vm_init.sh b/boot/appc_vm_init.sh new file mode 100644 index 00000000..1692a074 --- /dev/null +++ b/boot/appc_vm_init.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DMAAP_TOPIC=$(cat /opt/config/dmaap_topic.txt) + +cd /opt/appc + +sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="$DMAAP_TOPIC"/g" /opt/appc/docker-compose.yml + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +/opt/docker/docker-compose pull +/opt/docker/docker-compose up -d diff --git a/boot/asdc_ext_volume_partitions.txt b/boot/asdc_ext_volume_partitions.txt new file mode 100644 index 00000000..b00c6ae2 --- /dev/null +++ b/boot/asdc_ext_volume_partitions.txt @@ -0,0 +1,7 @@ +# partition table of /dev/xvdb +unit: sectors + +/dev/xvdb1 : start= 2048, size=209713152, Id=83 +/dev/xvdb2 : start= 0, size= 0, Id= 0 +/dev/xvdb3 : start= 0, size= 0, Id= 0 +/dev/xvdb4 : start= 0, size= 0, Id= 0 diff --git a/boot/asdc_serv.sh b/boot/asdc_serv.sh new file mode 100644 index 00000000..7d2539eb --- /dev/null +++ b/boot/asdc_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./asdc_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/asdc_vm_init.sh b/boot/asdc_vm_init.sh new file mode 100644 index 00000000..f0777d5f --- /dev/null +++ b/boot/asdc_vm_init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +ENV_NAME=$(cat /opt/config/env_name.txt) + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +bash /data/scripts/docker_run.sh -e $ENV_NAME diff --git a/boot/db_openecomp_org b/boot/db_openecomp_org new file mode 100644 index 00000000..be42b603 --- /dev/null +++ b/boot/db_openecomp_org @@ -0,0 +1,109 @@ +; +; BIND data file for local loopback interface +; +$TTL 604800 +@ IN SOA openecomp.org. admin.openecomp.org. ( + 20161202 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +; name servers - NS records + IN NS openecomp.org. + +; name servers - A records +openecomp.org. IN A 10.0.0.1 + +; +vm1.aai.simpledemo.openecomp.org. IN A 10.0.1.1 +c1.vm1.aai.simpledemo.openecomp.org. IN A 10.0.1.1 +c2.vm1.aai.simpledemo.openecomp.org. IN A 10.0.1.1 +c3.vm1.aai.simpledemo.openecomp.org. IN A 10.0.1.1 + +vm1.appc.simpledemo.openecomp.org. IN A 10.0.2.1 +c1.vm1.appc.simpledemo.openecomp.org. IN A 10.0.2.1 +c2.vm1.appc.simpledemo.openecomp.org. IN A 10.0.2.1 + +vm1.asdc.simpledemo.openecomp.org. IN A 10.0.3.1 +c1.vm1.asdc.simpledemo.openecomp.org. IN A 10.0.3.1 +c2.vm1.asdc.simpledemo.openecomp.org. IN A 10.0.3.1 +c3.vm1.asdc.simpledemo.openecomp.org. IN A 10.0.3.1 +c4.vm1.asdc.simpledemo.openecomp.org. IN A 10.0.3.1 + +vm1.dcae.simpledemo.openecomp.org. IN A 10.0.4.1 +c1.vm1.dcae.simpledemo.openecomp.org. IN A 10.0.4.1 +c2.vm1.dcae.simpledemo.openecomp.org. IN A 10.0.4.1 +c3.vm1.dcae.simpledemo.openecomp.org IN A 10.0.4.1 + +vm1.mso.simpledemo.openecomp.org. IN A 10.0.5.1 +c1.vm1.mso.simpledemo.openecomp.org. IN A 10.0.5.1 +c1.vm1.mso.simpledemo.openecomp.org. IN A 10.0.5.1 + +vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c1.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c2.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c3.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c4.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c5.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c6.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c7.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 +c8.vm1.policy.simpledemo.openecomp.org. IN A 10.0.6.1 + +vm1.sdnc.simpledemo.openecomp.org. IN A 10.0.7.1 +c1.vm1.sdnc.simpledemo.openecomp.org. IN A 10.0.7.1 +c2.vm1.sdnc.simpledemo.openecomp.org. IN A 10.0.7.1 +c3.vm1.sdnc.simpledemo.openecomp.org. IN A 10.0.7.1 +c4.vm1.sdnc.simpledemo.openecomp.org. IN A 10.0.7.1 + +vm1.vid.simpledemo.openecomp.org. IN A 10.0.8.1 +c1.vm1.vid.simpledemo.openecomp.org. IN A 10.0.8.1 +c2.vm1.vid.simpledemo.openecomp.org. IN A 10.0.8.1 + +vm1.portal.simpledemo.openecomp.org. IN A 10.0.9.1 +c1.vm1.portal.simpledemo.openecomp.org. IN A 10.0.9.1 +c2.vm1.portal.simpledemo.openecomp.org. IN A 10.0.9.1 + +vm1.aaf.simpledemo.openecomp.org. IN A 10.0.12.1 + +vm1.mr.simpledemo.openecomp.org. IN A 10.0.11.1 + +;CNAMES +;A&AI +aai.api.simpledemo.openecomp.org. IN CNAME vm1.aai.simpledemo.openecomp.org. +aai.hbase.simpledemo.openecomp.org. IN CNAME vm1.aai.simpledemo.openecomp.org. + +;APPC +appc.api.simpledemo.openecomp.org. IN CNAME vm1.appc.simpledemo.openecomp.org. + +;ASDC +asdc.api.simpledemo.openecomp.org. IN CNAME vm1.asdc.simpledemo.openecomp.org. + +;DCAE +dcae.api.simpledemo.openecomp.org. IN CNAME vm1.dcae.simpledemo.openecomp.org. + +;MSO +mso.api.simpledemo.openecomp.org. IN CNAME vm1.mso.simpledemo.openecomp.org. + +;Policy +policy.api.simpledemo.openecomp.org. IN CNAME vm1.policy.simpledemo.openecomp.org. + +;SDNC +sdnc.api.simpledemo.openecomp.org. IN CNAME vm1.sdnc.simpledemo.openecomp.org. + +;VID +vid.api.simpledemo.openecomp.org. IN CNAME vm1.vid.simpledemo.openecomp.org. + +;PORTAL +portal.api.simpledemo.openecomp.org. IN CNAME vm1.portal.simpledemo.openecomp.org. + +;Message Router +;mr.api.simpledemo.openecomp.org. IN CNAME vm1.mr.simpledemo.openecomp.org. +ueb.api.simpledemo.openecomp.org. IN CNAME vm1.mr.simpledemo.openecomp.org. +mr.api.simpledemo.openecomp.org. IN A 10.0.4.102 +collector.api.simpledemo.openecomp.org. IN A 10.0.4.102 +;dbc.api.simpledemo.openecomp.org. IN CNAME vm1.mr.simpledemo.openecomp.org. +;drprov.api.simpledemo.openecomp.org. IN CNAME vm1.mr.simpledemo.openecomp.org. + +;AAF +aaf.api.simpledemo.openecomp.org. IN CNAME vm1.aaf.simpledemo.openecomp.org.
\ No newline at end of file diff --git a/boot/dcae_serv.sh b/boot/dcae_serv.sh new file mode 100644 index 00000000..f20a37bf --- /dev/null +++ b/boot/dcae_serv.sh @@ -0,0 +1,116 @@ + +############################################################################# +# +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# +# 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. +# +############################################################################# + +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./dcae_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/dcae_vm_init.sh b/boot/dcae_vm_init.sh new file mode 100644 index 00000000..1802ed4e --- /dev/null +++ b/boot/dcae_vm_init.sh @@ -0,0 +1,23 @@ + +############################################################################# +# +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# +# 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. +# +############################################################################# + +#!/bin/bash + +cd /opt/dcae-startup-vm-controller +bash init.sh +make up diff --git a/boot/mr_serv.sh b/boot/mr_serv.sh new file mode 100644 index 00000000..77f86395 --- /dev/null +++ b/boot/mr_serv.sh @@ -0,0 +1,116 @@ + +############################################################################# +# +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# +# 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. +# +############################################################################# + +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./mr_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/mr_vm_init.sh b/boot/mr_vm_init.sh new file mode 100644 index 00000000..4cd6caf0 --- /dev/null +++ b/boot/mr_vm_init.sh @@ -0,0 +1,22 @@ + +############################################################################# +# +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# +# 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. +# +############################################################################# + +#!/bin/bash + +cd /opt/dcae-startup-vm-message-router +bash deploy.sh diff --git a/boot/mso_serv.sh b/boot/mso_serv.sh new file mode 100644 index 00000000..00ee4170 --- /dev/null +++ b/boot/mso_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./mso_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/mso_vm_init.sh b/boot/mso_vm_init.sh new file mode 100644 index 00000000..f878f535 --- /dev/null +++ b/boot/mso_vm_init.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +OPENSTACK_USERNAME=$(cat /opt/config/openstack_username.txt) +OPENSTACK_APIKEY=$(cat /opt/config/api_key.txt) +DMAAP_TOPIC=$(cat /opt/config/dmaap_topic.txt) +export MSO_DOCKER_IMAGE_VERSION=1.0.0 + +# Update the MSO configuration file. +read -d '' MSO_CONFIG_UPDATES <<-EOF +{ +"default_attributes": + { + "asdc-connections": + { + "asdc-controller1": + { + "environmentName": "$DMAAP_TOPIC" + } + }, + "mso-po-adapter-config": + { + "identity_services": + [ + {"dcp_clli": "RAX_KEYSTONE", + "identity_url": "https://identity.api.rackspacecloud.com/v2.0", + "mso_id": "$OPENSTACK_USERNAME", + "mso_pass": "$OPENSTACK_APIKEY", + "admin_tenant": "service", + "member_role": "admin", + "tenant_metadata": "true", + "identity_server_type": "KEYSTONE", + "identity_authentication_type": "RACKSPACE_APIKEY" + + } + ] + } + } +} +EOF +export MSO_CONFIG_UPDATES + + +# Deploy the environment +cd /opt/test_lab +chmod +x deploy.sh +#This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb) +./deploy.sh $NEXUS_DOCKER_REPO $NEXUS_USERNAME $NEXUS_PASSWD ecomp-nexus:51211 release sfWU3DFVdBr7GVxB85mTYgAW diff --git a/boot/named.conf.local b/boot/named.conf.local new file mode 100644 index 00000000..3cc9f0d3 --- /dev/null +++ b/boot/named.conf.local @@ -0,0 +1,12 @@ +// +// Do any local configuration here +// + +// Consider adding the 1918 zones here, if they are not used in your +// organization +//include "/etc/bind/zones.rfc1918"; + +zone "openecomp.org" { + type master; + file "/etc/bind/zones/db.openecomp.org"; # zone file path +}; diff --git a/boot/named.conf.options b/boot/named.conf.options new file mode 100644 index 00000000..2b23f7e7 --- /dev/null +++ b/boot/named.conf.options @@ -0,0 +1,39 @@ +acl "trusted" { + #x.x.x.x; +}; +options { + directory "/var/cache/bind"; + + #recursion no; # enables recursive queries + #allow-recursion { trusted; }; # allows recursive queries from "trusted” clients i.e. LB only + listen-on { 10.0.0.1; }; # ns1 IP address - listen on this address only + allow-transfer { none; }; # disable zone transfers by default + + forwarders { + 8.8.8.8; + 8.8.4.4; + }; + + // If there is a firewall between you and nameservers you want + // to talk to, you may need to fix the firewall to allow multiple + // ports to talk. See http://www.kb.cert.org/vuls/id/800113 + + // If your ISP provided one or more IP addresses for stable + // nameservers, you probably want to use them as forwarders. + // Uncomment the following block, and insert the addresses replacing + // the all-0's placeholder. + + // forwarders { + // 0.0.0.0; + // }; + + //======================================================================== + // If BIND logs error messages about the root key being expired, + // you will need to update your keys. See https://www.isc.org/bind-keys + //======================================================================== + dnssec-validation auto; + + auth-nxdomain no; # conform to RFC1035 + listen-on-v6 { any; }; +}; + diff --git a/boot/policy_serv.sh b/boot/policy_serv.sh new file mode 100644 index 00000000..2e7195b9 --- /dev/null +++ b/boot/policy_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./policy_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/policy_vm_init.sh b/boot/policy_vm_init.sh new file mode 100644 index 00000000..ad71cf0e --- /dev/null +++ b/boot/policy_vm_init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) + +cd /opt/policy +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +/opt/docker/docker-compose up -d diff --git a/boot/portal_serv.sh b/boot/portal_serv.sh new file mode 100644 index 00000000..cf0c412d --- /dev/null +++ b/boot/portal_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./portal_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/portal_vm_init.sh b/boot/portal_vm_init.sh new file mode 100644 index 00000000..744c4fc9 --- /dev/null +++ b/boot/portal_vm_init.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/ecomp/portaldb:1610.3 +docker pull $NEXUS_DOCKER_REPO/ecomp/portalapps:1610.3 + +docker create --name data_vol_portal -v /var/lib/mysql mariadb + +docker tag 6ce6ea8c6e52 ecompdb:portal +docker tag 925a8a953d4c ep:1610-1 + +docker rm -f ecompdb_portal +docker rm -f 1610-1 + +./dbstart.sh +./new_start.sh + +sleep 60 + +if [ ! -e /opt/config/boot.txt ] +then + IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) + mysql -u root -p'Aa123456' -h $IP_ADDRESS < users.sql + echo "yes" > /opt/config/boot.txt +fi
\ No newline at end of file diff --git a/boot/robot_serv.sh b/boot/robot_serv.sh new file mode 100644 index 00000000..7c4419d1 --- /dev/null +++ b/boot/robot_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./robot_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/robot_vm_init.sh b/boot/robot_vm_init.sh new file mode 100644 index 00000000..582a3f2e --- /dev/null +++ b/boot/robot_vm_init.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +NEXUS_REPO=$(cat /opt/config/nexus_repo.txt) + +# +# Deploy latest robot configuration +# +wget --user=$NEXUS_USERNAME --password=$NEXUS_PASSWD --no-check-certificate -O /opt/eteshare/config/robot_properties_ete.py $NEXUS_REPO/org.openecomp.boot/robot_properties_ete.py +wget --user=$NEXUS_USERNAME --password=$NEXUS_PASSWD --no-check-certificate -O /opt/eteshare/config/robot_preload_parameters.py $NEXUS_REPO/org.openecomp.boot/robot_preload_parameters.py +wget --user=$NEXUS_USERNAME --password=$NEXUS_PASSWD --no-check-certificate -O /opt/eteshare/config/vm_config2robot.sh $NEXUS_REPO/org.openecomp.boot/vm_config2robot.sh +/bin/bash /opt/eteshare/config/vm_config2robot.sh + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/openecompete +docker rm -f openecompete_container +docker run -d --name openecompete_container -v /opt/eteshare:/share -p 88:88 $NEXUS_DOCKER_REPO/openecompete diff --git a/boot/sdnc_serv.sh b/boot/sdnc_serv.sh new file mode 100644 index 00000000..58f03f1c --- /dev/null +++ b/boot/sdnc_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./sdnc_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/sdnc_vm_init.sh b/boot/sdnc_vm_init.sh new file mode 100644 index 00000000..a642a530 --- /dev/null +++ b/boot/sdnc_vm_init.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) + +cd /opt/sdnc +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +/opt/docker/docker-compose up -d diff --git a/boot/vid_serv.sh b/boot/vid_serv.sh new file mode 100644 index 00000000..445196c3 --- /dev/null +++ b/boot/vid_serv.sh @@ -0,0 +1,98 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO + +dir="/opt" +cmd="./vid_vm_init.sh" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/boot/vid_vm_init.sh b/boot/vid_vm_init.sh new file mode 100644 index 00000000..fa019760 --- /dev/null +++ b/boot/vid_vm_init.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/ecomp/vid:1.0.0 + +docker rm -f vid-mariadb +docker rm -f vid-server + +docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v /opt/vid-my.cnf:/etc/mysql/my.cnf -v /opt/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10 + +docker run -e VID_MYSQL_DBNAME=vid_openecomp -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $NEXUS_DOCKER_REPO/ecomp/vid:1.0.0 |