Browse Source

change repo

master
zeus 3 years ago
parent
commit
79ca157f7a
  1. 58
      install/usr/share/swarmlab.io/sec/swarmlab-sec

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

@ -39,7 +39,7 @@ APTPARAM=" --no-install-recommends "
IMAGE_local="hybrid-nodevuejs" IMAGE_local="hybrid-nodevuejs"
HYBRID_NETWORK="hybrid-nodevuejs" HYBRID_NETWORK="hybrid-nodevuejs"
# dont edit # dont edit
IMAGE_origin="hub.swarmlab.io:5443/hybrid-nodevuejs:latest" IMAGE_origin="hub.swarmlab.io:5480/hybrid-nodevuejs:latest"
bootstrap="sec_bootstrap" bootstrap="sec_bootstrap"
hostnames="auto_update_hosts" hostnames="auto_update_hosts"
hostnames_get="get_hosts" hostnames_get="get_hosts"
@ -105,11 +105,9 @@ if [ -d "$Wdir/project" ]; then
# #
# ---------------------------------------------- # ----------------------------------------------
rm -f $Wdir/out.log 2> /dev/null search='ok'
error="Error:"; if [ $search == 'ok' ]
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)
then then
echo "" echo ""
echo ">>> Load Origin " echo ">>> Load Origin "
@ -148,38 +146,6 @@ if [ -d "$Wdir/project" ]; then
COPY .vimrc /home/docker COPY .vimrc /home/docker
USER docker USER docker
EOF 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 fi
else else
echo "" echo ""
@ -312,10 +278,10 @@ cat << EOF > $Wdir/docker-compose.yml
version: "2" version: "2"
services: services:
registry: # registry:
image: registry # image: registry
ports: # ports:
- "${REGISTRY_PORT}:5000" # - "${REGISTRY_PORT}:5000"
master: master:
image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME 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 "_master_" | awk '{print $1}')) || true
$(docker stop $(docker ps -a | grep "_worker_" | 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 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 #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 "_worker_" | awk '{print $1}' | xargs docker container rm || true
docker ps -a | grep "_master_" | 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" echo "$ docker-compose up -d registry"
printf "\\n" 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 container prune --force
docker-compose up --no-recreate -d registry docker-compose up --no-recreate -d registry
} }
@ -700,9 +666,9 @@ if [ $COMMAND_UP -eq 1 ]; then
create_dockerfile create_dockerfile
down_all down_all
clear_all clear_all
up_registry #up_registry # remove for microservices
generate_ssh_keys generate_ssh_keys
build_and_push_image #build_and_push_image # remove for microservices
up_master up_master
up_workers up_workers

Loading…
Cancel
Save