a39ed083f1e80287238f3d2012313d9072b89201
[integration/csit.git] / scripts / vvp / clone_and_setup_vvp_data.sh
1 #!/bin/bash
2 #
3 # ============LICENSE_START=======================================================
4 # ONAP CLAMP
5 # ================================================================================
6 # Copyright (C) 2017 AT&T Intellectual Property. All rights
7 #                             reserved.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 # http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END============================================
21 # ===================================================================
22 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 #
24
25 echo "This is ${WORKSPACE}/test/csit/scripts/vvp/clone_and_setup_vvp_data.sh"
26
27 # Clone vvp enviroment template
28 mkdir -p ${WORKSPACE}/data/environments/
29 mkdir -p ${WORKSPACE}/data/clone/
30 mkdir -p /opt/configmaps/settings/
31
32 cd ${WORKSPACE}/data/clone
33 git clone --depth 1 http://gerrit.onap.org/r/vvp/engagementmgr -b master
34
35 chmod -R 775 ${WORKSPACE}/data/
36
37 # copy settings file from tox environment infrastructure:
38 cp -f ${WORKSPACE}/data/clone/engagementmgr/django/vvp/settings/tox_settings.py /opt/configmaps/settings/__init__.py
39
40 # uwsgi.ini file creation
41 echo "[uwsgi]
42 http = :80
43 plugin = python
44 chdir = /srv
45 module = vvp.wsgi:application
46 master = True
47 pidfile = /tmp/project-master.pid
48 vacuum = True
49 max-requests = 5000
50 enable-threads = True
51 stats = 0.0.0.0:9000
52 stats-http = True" > /opt/configmaps/settings/uwsgi.ini
53
54 # storage.py file creation
55 echo "from storages.backends.s3boto import S3BotoStorage
56 from django.conf import settings
57 class S3StaticStorage(S3BotoStorage):
58     custom_domain = '%s/%s' % (settings.AWS_S3_HOST, settings.STATIC_BUCKET)
59     bucket_name = settings.STATIC_BUCKET
60 class S3MediaStorage(S3BotoStorage):
61     custom_domain = '%s/%s' % (settings.AWS_S3_HOST, settings.MEDIA_BUCKET)
62     bucket_name = settings.MEDIA_BUCKET" > /opt/configmaps/settings/storage.py
63
64 # envbool.py file creation
65 echo "import os
66 def envbool(key, default=False, unknown=True):
67     return {'true': True, '1': True, 'false': False, '0': False,
68         '': default,}.get(os.getenv(key, '').lower(), unknown)" > /opt/configmaps/settings/envbool.py
69
70 # vvp_env.list file creation
71 echo "# set enviroment variables
72 OAUTHLIB_INSECURE_TRANSPORT=1
73 HOST_IP=${IP}
74 ENVNAME=${ENVIRONMENT}
75 http_proxy=${http_proxy}
76 https_proxy=${https_proxy}
77 no_proxy=${no_proxy}
78 DJANGO_SETTINGS_MODULE=vvp.settings
79 # export PYTHONPATH={pwd}
80 SECRET_KEY=6mo22&FAKEFALEFALEFKEuq0u*4ksk^aq8lte&)yul
81 ENVIRONMENT=development
82 SERVICE_PROVIDER=ExampleProvider
83 PROGRAM_NAME=VVP
84 PROGRAM_NAME_URL_PREFIX=vvp
85 SERVICE_PROVIDER_DOMAIN=example-domain.com
86 EMAIL_HOST=localhost
87 EMAIL_HOST_PASSWORD=
88 EMAIL_HOST_USER=
89 EMAIL_PORT=25
90 PGDATABASE=icedb
91 PGUSER=iceuser
92 PGPASSWORD=Aa123456
93 PGHOST=localhost
94 PGPORT=5433
95 SECRET_WEBHOOK_TOKEN=AiwiFAKEFAKEFAKEmahch2zahshaGi
96 SECRET_GITLAB_AUTH_TOKEN=ieNgFAKEFAKE4zohvee9a
97 SECRET_JENKINS_PASSWORD=xaiyiFAKEFAKEqueuBu
98 SECRET_CMS_APP_CLIENT_ID=MHmJo0ccDhFAKEFAKEFAKEPAC6H6HAMzhCCM16
99 SECRET_CMS_APP_CLIENT_SECRET=nI8QFAKEEEpnw5nTs
100 SLACK_API_TOKEN=
101 S3_HOST=localhost
102 S3_PORT=443
103 AWS_ACCESS_KEY_ID=FD2FAKEFAKEFAKEVD1MWRN
104 AWS_SECRET_ACCESS_KEY=TKoiwxzFAKEFAKEFAKEFAKEFAKEQ27nP2lCiutEsD
105 STATIC_ROOT=/app/htdocs" > ${WORKSPACE}/data/environments/vvp_env.list
106
107 ifconfig
108
109 IP_ADDRESS=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
110 export HOST_IP=$IP_ADDRESS