diff --git a/Docker/README.md b/Docker/README.md index e4c0a673..05808a1f 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -1,5 +1,14 @@ # Install Shinobi with Docker +### There are two ways! + +## Docker Ninja Way + +``` +bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh) +``` + +## From Source > Image is based on Ubuntu Bionic (20.04). Node.js 12 is used. MariaDB and FFmpeg are included. 1. Download Repo @@ -42,13 +51,12 @@ docker run -d --name='Shinobi' -p '8080:8080/tcp' -v "/dev/shm/Shinobi/streams": |----------------------|----------------------------------------------------------------------|--------------------| | SUBSCRIPTION_ID | **THIS IS NOT REQUIRED**. If you are a subscriber to any of the Shinobi services you may use that key as the value for this parameter. If you have donated by PayPal you may use your Transaction ID to activate the license as well. | *None* | | DB_USER | Username that the Shinobi process will connect to the database with. | majesticflame | - | DB_PASSWORD | Password that the Shinobi process will connect to the database with. | mizukagesbluedress | + | DB_PASSWORD | Password that the Shinobi process will connect to the database with. | *None* | | DB_HOST | Address that the Shinobi process will connect to the database with. | localhost | | DB_DATABASE | Database that the Shinobi process will interact with. | ccio | - | DB_ROOT_USER | Privileged Username for the MariaDB instance. | root | - | DB_ROOT_PASSWORD | Privileged Password for the MariaDB instance. | mizukagesbluedress | | DB_DISABLE_INCLUDED | Disable included database to use your own. Set to `true` to disable.| false | +> For those using `DB_DISABLE_INCLUDED=true` please remember to create a user in your databse first. The Docker image will create the `DB_DATABASE` under the specified connection information. ### Tips diff --git a/Docker/init.sh b/Docker/init.sh index 24c0882a..994ecdf4 100644 --- a/Docker/init.sh +++ b/Docker/init.sh @@ -1,6 +1,10 @@ #!/bin/sh set -e +cp sql/framework.sql sql/framework1.sql +OLD_SQL_USER_TAG="ccio" +NEW_SQL_USER_TAG="$DB_DATABASE" +sed -i "s/$OLD_SQL_USER_TAG/$NEW_SQL_USER_TAG/g" sql/framework1.sql if [ "$DB_DISABLE_INCLUDED" = "false" ]; then echo "MariaDB Directory ..." ls /var/lib/mysql @@ -49,16 +53,11 @@ if [ "$DB_DISABLE_INCLUDED" = "false" ]; then mysql -e "source /home/Shinobi/sql/user.sql" || true else - echo "Create database schema if it does not exists ..." - mysql -u "$DB_ROOT_USER" -h "$DB_HOST" -p"$DB_ROOT_PASSWORD" -e "source /home/Shinobi/sql/framework.sql" || true - - echo "Create database user if it does not exists ..." - mysql -u "$DB_ROOT_USER" -h "$DB_HOST" -p"$DB_ROOT_PASSWORD" -e "source /home/Shinobi/sql/user.sql" || true - + mysql -u "$DB_USER" -h "$DB_HOST" -p"$DB_PASSWORD" --port="$DB_PORT" -e "source /home/Shinobi/sql/framework.sql" || true fi - +DATABASE_CONFIG='{"host": "'$DB_HOST'","user": "'$DB_USER'","password": "'$DB_PASSWORD'","database": "'$DB_DATABASE'","port":'$DB_PORT'}' cronKey="$(head -c 1024 < /dev/urandom | sha256sum | awk '{print substr($1,1,29)}')" @@ -71,7 +70,7 @@ if [ ! -e "./conf.json" ]; then sudo cp conf.sample.json conf.json fi sudo sed -i -e 's/change_this_to_something_very_random__just_anything_other_than_this/'"$cronKey"'/g' conf.json -node tools/modifyConfiguration.js cpuUsageMarker=CPU subscriptionId=$SUBSCRIPTION_ID thisIsDocker=true pluginKeys="$PLUGIN_KEYS" +node tools/modifyConfiguration.js cpuUsageMarker=CPU subscriptionId=$SUBSCRIPTION_ID thisIsDocker=true pluginKeys="$PLUGIN_KEYS" db="$DATABASE_CONFIG" sudo cp conf.json /config/conf.json diff --git a/Dockerfile b/Dockerfile index b7ce55c5..9c1f6b05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,10 @@ FROM node:12.18.3-buster-slim ENV DB_USER=majesticflame \ - DB_PASSWORD=mizukagesbluedress \ - DB_HOST=localhost \ + DB_PASSWORD='' \ + DB_HOST='localhost' \ DB_DATABASE=ccio \ - DB_ROOT_PASSWORD=mizukagesbluedress \ - DB_ROOT_USER=root \ + DB_PORT=3306 \ SUBSCRIPTION_ID=sub_XXXXXXXXXXXX \ PLUGIN_KEYS='{}' \ DB_DISABLE_INCLUDED=false