Browse Source

Merge branch 'master' of git.swarmlab.io:swarmlab/hybrid-NodeVueJS

master
zeus 3 years ago
parent
commit
e44b3da801
  1. 56
      install/usr/share/swarmlab.io/sec/swarmlab-sec

56
install/usr/share/swarmlab.io/sec/swarmlab-sec

@ -105,11 +105,9 @@ if [ -d "$Wdir/project" ]; then
#
# ----------------------------------------------
rm -f $Wdir/out.log 2> /dev/null
search='ok'
error="Error:";
IMAGE=$(docker inspect --type=image $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME:latest 2>&1 | tee $Wdir/out.log)
if search=$(grep "$error" $Wdir/out.log)
if [ $search == 'ok' ]
then
echo ""
echo ">>> Load Origin "
@ -148,38 +146,6 @@ if [ -d "$Wdir/project" ]; then
COPY .vimrc /home/docker
USER docker
EOF
else
echo ">>> Load Local "
cat << EOF > $Wdir/Dockerfile
FROM localhost:5000/$IMAGE_local
#
USER root
COPY $bootstrap /usr/bin
COPY $hostnames_get /usr/bin
COPY $hostnames /usr/bin
COPY install-vim-plugin.sh .
ENV NOTVISIBLE "in users profile"
ENV USER1 docker
ENV USER_HOME /home/docker
ENV SSHDIR \${USER_HOME}/.ssh
COPY ssh/ \${SSHDIR}/
RUN mkdir -p /var/run/sshd \
&& echo 'root:$ROOT_PASSWORD' | chpasswd \
&& echo "export VISIBLE=now" >> /etc/profile \
&& mkdir -p /etc/opt \
&& mkdir -p /home/docker/project \
&& echo "docker:docker" | chpasswd \
&& echo "StrictHostKeyChecking no" > \${SSHDIR}/config \
&& cat \${SSHDIR}/*.pub >> \${SSHDIR}/authorized_keys \
&& chmod -R 600 \${SSHDIR}/* \
&& chown -R \${USER1}:\${USER1} \${SSHDIR}
WORKDIR /home/docker/project
COPY .vimrc /home/docker
USER docker
EOF
fi
else
echo ""
@ -312,10 +278,10 @@ cat << EOF > $Wdir/docker-compose.yml
version: "2"
services:
registry:
image: registry
ports:
- "${REGISTRY_PORT}:5000"
# registry:
# image: registry
# ports:
# - "${REGISTRY_PORT}:5000"
master:
image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME
@ -457,8 +423,8 @@ clear_all ()
{
$(docker stop $(docker ps -a | grep "_master_" | awk '{print $1}')) || true
$(docker stop $(docker ps -a | grep "_worker_" | awk '{print $1}')) || true
$(docker stop $(docker ps -a | grep "_registry_" | awk '{print $1}')) || true
docker ps -a | grep "_registry_" | awk '{print $1}' | xargs docker container rm || true
#$(docker stop $(docker ps -a | grep "_registry_" | awk '{print $1}')) || true # remove for microservices
#docker ps -a | grep "_registry_" | awk '{print $1}' | xargs docker container rm || true # remove for microservices
docker ps -a | grep "_worker_" | awk '{print $1}' | xargs docker container rm || true
docker ps -a | grep "_master_" | awk '{print $1}' | xargs docker container rm || true
}
@ -482,7 +448,7 @@ up_registry ()
echo "$ docker-compose up -d registry"
printf "\\n"
#docker stop swarmlab-registry || true && docker rm swarmlab-registry || true
#docker stop swarmlab-registry || true && docker rm swarmlab-registry || true # remove for microservices
docker container prune --force
docker-compose up --no-recreate -d registry
}
@ -700,9 +666,9 @@ if [ $COMMAND_UP -eq 1 ]; then
create_dockerfile
down_all
clear_all
up_registry
#up_registry # remove for microservices
generate_ssh_keys
build_and_push_image
#build_and_push_image # remove for microservices
up_master
up_workers

Loading…
Cancel
Save