asifdxtreme closed pull request #251: SCB-90 Failed to deploy frontend Service
center on Huawei Cloud
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/251
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/frontend/conf/app.conf b/frontend/conf/app.conf
index 7c6f64e6..e308845e 100644
--- a/frontend/conf/app.conf
+++ b/frontend/conf/app.conf
@@ -1,5 +1,5 @@
-SC_HOST_IP = 127.0.0.1
-SC_HOST_PORT = 30100
-SC_HOST_MODE = http
-FRONTEND_HOST_IP = 127.0.0.1
-FRONTEND_HOST_PORT = 30103
+SC_HOST_IP=127.0.0.1
+SC_HOST_PORT=30100
+SC_HOST_MODE=http
+FRONTEND_HOST_IP=127.0.0.1
+FRONTEND_HOST_PORT=30103
diff --git a/scripts/docker/build-frontend-image/Dockerfile.tmpl
b/scripts/docker/build-frontend-image/Dockerfile.tmpl
new file mode 100644
index 00000000..0766be81
--- /dev/null
+++ b/scripts/docker/build-frontend-image/Dockerfile.tmpl
@@ -0,0 +1,7 @@
+FROM ubuntu
+
+ADD frontend.tar.gz /opt
+
+WORKDIR /opt/frontend
+
+ENTRYPOINT ["/opt/frontend/start_linux.sh"]
diff --git a/scripts/docker/build-frontend-image/README.md
b/scripts/docker/build-frontend-image/README.md
new file mode 100644
index 00000000..b433c493
--- /dev/null
+++ b/scripts/docker/build-frontend-image/README.md
@@ -0,0 +1,16 @@
+## Service-Center support for build docker image
+
+This script helps you to make the docker image of service-center frontend
present in your current working directory.
+
+The start_linux.sh will be the entrypoint for the docker container to start.
+
+### How To Run
+
+This script assumes you have already downloaded all the dependencies using
'gvt restore'.
+
+ bash -x build.sh
+
+Once the script finishes you will see image scfrontend-dev.tgz in the same
directory.
+Load this image to the docker and start using.
+
+ docker run -d -p 30101:30103 -t servicecomb/scfrontend
diff --git a/scripts/docker/build-frontend-image/build.sh
b/scripts/docker/build-frontend-image/build.sh
new file mode 100644
index 00000000..9eaeadc8
--- /dev/null
+++ b/scripts/docker/build-frontend-image/build.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+set -e
+
+umask 027
+
+SCRIPT_DIR=$(cd $(dirname $0); pwd)
+BASE_DIR=${SCRIPT_DIR}/../../..
+
+mkdir -p $SCRIPT_DIR/frontend
+
+cd $BASE_DIR/frontend
+
+# make CGO_ENABLED=0 since busybox will not execute if it is dynamically linked
+export CGO_ENABLED=0
+export GOOS="linux"
+export GOARCH="amd64"
+
+# buils scfrontend
+go build -o $SCRIPT_DIR/frontend/scfrontend
+
+#go to the script directory
+#cd $SCRIPT_DIR
+
+# copy the app conf folders to build-frontend-image/frontend
+cp -r app conf $BASE_DIR/scripts/frontend/start_linux.sh $SCRIPT_DIR/frontend
+
+chmod 755 $SCRIPT_DIR/frontend/start_linux.sh $SCRIPT_DIR/frontend/scfrontend
+
+sed -i "s|FRONTEND_HOST_IP=127.0.0.1|FRONTEND_HOST_IP=0.0.0.0|g"
$SCRIPT_DIR/frontend/conf/app.conf
+
+#go to the script directory
+cd $SCRIPT_DIR
+tar cf frontend.tar.gz frontend
+cp Dockerfile.tmpl Dockerfile
+
+docker build -t servicecomb/scfrontend .
+docker save servicecomb/scfrontend:latest |gzip >scfrontend-dev.tgz
+
+# remove the frontend directory from the build-frontend-image path
+rm -rf frontend Dockerfile frontend.tar.gz
diff --git a/scripts/frontend/start_linux.sh b/scripts/frontend/start_linux.sh
index 957ea07c..34fee7bf 100644
--- a/scripts/frontend/start_linux.sh
+++ b/scripts/frontend/start_linux.sh
@@ -1,4 +1,6 @@
#!/bin/bash
+
+cd /opt/frontend/
cd conf/
. app.conf
echo $SC_HOST_IP
@@ -7,4 +9,4 @@ echo $SC_HOST_MODE
cd ../
sed -i '/ip/c\ip:"'$SC_HOST_MODE'://'$SC_HOST_IP'",' ./app/apiList/apiList.js
sed -i '/port/c\port:"'$SC_HOST_PORT'"' ./app/apiList/apiList.js
-./scfrontend > start-sc-frontend.log 2>&1 &
+./scfrontend > start-sc-frontend.log 2>&1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services