My GitHub Mirror of docker_deployment_notes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

3.8 KiB

WIP

Not finished yet. Docker-compose was generated by the follow script below. You should install shinobi via the script below. Not the docker-compose that was shown further down.

ShinobiInstall.sh

#!/bin/bash
if ! [ -x "$(command -v docker)" ]; then
    echo "You are missing Docker"
    echo "docker not found!"
    echo "Get it here : https://docs.docker.com/engine/install/"
    exit 1
else
    docker -v
fi
if ! [ -x "$(command -v docker-compose)" ]; then
    echo "You are missing Docker Compose"
    echo "docker-compose not found!"
    echo "Get it here : https://docs.docker.com/compose/install/"
    exit 1
else
    docker-compose -v
fi

PLUGIN_LIST=''
PLUGIN_YMLS=();

SSL_TOGGLE="$(echo "$1" | awk '{print tolower($0)}')"
if [ "$SSL_TOGGLE" = "true" ]; then
    SSL_TOGGLE='true'
else
    SSL_TOGGLE='false'
fi

echo "Shinobi - Do you want to Install Object Detection? (TensorFlow.js)"
echo "(y)es or (N)o"
read -r TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE
TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE="$(echo "$TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE" | awk '{print tolower($0)}')"
if [ "$TENSORFLOW_PLUGIN_DOCKER_ADDON_AGREE" = "y" ]; then
    TENSORFLOW_PLUGIN_KEY=$(head -c 1024 < /dev/urandom | sha256sum | awk '{print substr($1,1,29)}')
    PLUGIN_YMLS+=('"Tensorflow":"'$TENSORFLOW_PLUGIN_KEY'"')
    PLUGIN_LIST+=$(cat <<-END

    shinobiplugintensorflow:
        image: shinobisystems/shinobi-tensorflow:latest
        container_name: shinobi-tensorflow
        environment:
          - PLUGIN_KEY=$TENSORFLOW_PLUGIN_KEY
          - PLUGIN_HOST=Shinobi
        volumes:
          - $HOME/Shinobi/docker-plugins/tensorflow:/config
        restart: unless-stopped
END
    )
fi

# Join Plugin Keys
PLUGIN_YMLS=$(printf ",%s" "${PLUGIN_YMLS[@]}")
PLUGIN_YMLS=${PLUGIN_YMLS:1}
PLUGIN_YMLS="{$PLUGIN_YMLS}"
cat > docker-compose.yml <<- EOM
version: "3"
services:
    shinobi:
        image: shinobisystems/shinobi:dev
        container_name: Shinobi
        environment:
           - PLUGIN_KEYS=$PLUGIN_YMLS
#          - SSL_ENABLED=$SSL_TOGGLE
        volumes:
           - ./config:/config
           - ./customAutoLoad:/home/Shinobi/libs/customAutoLoad
           - ./database:/var/lib/mysql
           - ./videos:/home/Shinobi/videos
           - ./plugins:/home/Shinobi/plugins
           - /dev/shm/Shinobi/streams:/dev/shm/streams
           - /etc/localtime:/etc/localtime:ro
#        ports:
#           - 8080:8080
        restart: unless-stopped

networks:
  default:
    external:
      name: caddy_net
$PLUGIN_LIST
EOM
cat docker-compose.yml
docker-compose up -d
# rm docker-compose.yml

Minimum File Structure

/home/
└── ~/
    └── docker/
        └── shinobi/
            ├── docker-compose.yml

Caddyfile

shinobi.yourdomain.com {
    reverse_proxy shinobi:8080
}

docker-compose.yml

version: "3"
services:
    shinobi:
        image: shinobisystems/shinobi:dev
        container_name: Shinobi
        environment:
#           - PLUGIN_KEYS={"Tensorflow":"KEYGENERATEDBY SCRIPT!!!!"}
#          - SSL_ENABLED=false
        volumes:
           - ./config:/config
           - ./customAutoLoad:/home/Shinobi/libs/customAutoLoad
           - ./database:/var/lib/mysql
           - ./videos:/home/Shinobi/videos
           - ./plugins:/home/Shinobi/plugins
           - /dev/shm/Shinobi/streams:/dev/shm/streams
           - /etc/localtime:/etc/localtime:ro
#        ports:
#           - 8080:8080
        restart: unless-stopped

    shinobiplugintensorflow:
        image: shinobisystems/shinobi-tensorflow:latest
        container_name: shinobi-tensorflow
        environment:
#          - PLUGIN_KEY=KEYGENERATEDBY SCRIPT!!!!
          - PLUGIN_HOST=Shinobi
        volumes:
          - /home/taidao/Shinobi/docker-plugins/tensorflow:/config
        restart: unless-stopped

networks:
  default:
    external:
      name: caddy_net