summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors00370346 <swarup.nayak1@huawei.com>2019-06-19 17:54:31 +0530
committers00370346 <swarup.nayak1@huawei.com>2019-06-19 17:54:31 +0530
commit69d6b8580efc61f4c4423d0039a0a28206b09b85 (patch)
tree8525625aa1028b32267343b078bf6ec882446326
parentea8f556f54ed08727b7b4391c20e5470ad712cf6 (diff)
Issue-ID: DCAEGEN2-1561 RESTConf container support for non-root
Signed-off-by: s00370346 <swarup.nayak1@huawei.com> Change-Id: I7c3158dc51bf5c36e9dd74f12de2513f7d606d3a
-rw-r--r--pom.xml9
-rwxr-xr-xsrc/main/scripts/restConfCollector.sh1
2 files changed, 6 insertions, 4 deletions
diff --git a/pom.xml b/pom.xml
index 7f19d09..911a672 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,8 @@ limitations under the License.
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>8</java.version>
<docker.image.name>onap/org.onap.dcaegen2.collectors.restconfcollector</docker.image.name>
+ <docker.user.name>restconf</docker.user.name>
+ <docker.user.dir>/opt/app/restconfcollector</docker.user.dir>
<!-- TEST SETTINGS -->
<surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
<!-- PLUGIN SETTINGS -->
@@ -199,7 +201,7 @@ limitations under the License.
<env>
<HOSTALIASES>/etc/host.aliases</HOSTALIASES>
</env>
- <workdir>/opt/app/restconfcollector</workdir>
+ <workdir>${docker.user.dir}</workdir>
<resources>
<resource>
<targetPath>.</targetPath>
@@ -207,13 +209,14 @@ limitations under the License.
</resource>
</resources>
<runs>
- <run>chmod +x /opt/app/restconfcollector/bin/*.sh</run> <!-- Maven is loosing file permissions during artifacts copy -->
+ <run>adduser -h ${docker.user.dir} -D ${docker.user.name}; chown -R ${docker.user.name}: ${docker.user.dir}; chmod +x ${docker.user.dir}/bin/*.sh</run>
</runs>
- <cmd>/opt/app/restconfcollector/bin/docker_entry.sh</cmd>
+ <cmd>${docker.user.dir}/bin/docker_entry.sh</cmd>
<exposes>
<expose>8080</expose>
<expose>8687</expose>
</exposes>
+ <user>${docker.user.name}</user>
</configuration>
<executions>
<execution>
diff --git a/src/main/scripts/restConfCollector.sh b/src/main/scripts/restConfCollector.sh
index cbf9fa7..6cdd4d2 100755
--- a/src/main/scripts/restConfCollector.sh
+++ b/src/main/scripts/restConfCollector.sh
@@ -45,7 +45,6 @@ restConfCollector_start() {
# for all the jars.
cd ${BASEDIR}
- echo "192.168.17.11 onap-message-router" >> /etc/hosts
nohup $JAVA -cp "etc${PATHSEP}lib/*" $JAVA_OPTS -Dhttps.protocols=TLSv1.1,TLSv1.2 $MAINCLASS $* &
if [ $? -ne 0 ]; then
echo "restConf Collector has been started!!!" | tee -a ${BASEDIR}/logs/console.txt