Update Docker image to use Ubuntu 20.04

install-with-shinobicctv-user-instead-of-root
Moe 2020-08-26 15:30:34 -07:00
parent 37ad70ba6c
commit f0321004ac
6 changed files with 45 additions and 65 deletions

View File

@ -1,6 +1,6 @@
# Install Shinobi with Docker
> Image is based on Ubuntu Bionic (18.04). Node.js 12 is used. MariaDB is included.
> Image is based on Ubuntu Bionic (20.04). Node.js 12 is used. MariaDB and FFmpeg are included.
1. Download Repo
@ -15,10 +15,12 @@ cd ShinobiSource
docker build --tag shinobi-image:1.0 .
```
3. This command only works on Linux because of the temporary directory used. This location must exist in RAM. `-v "/dev/shm/shinobiStreams":'/dev/shm/streams':'rw'`.
3. Create a container with the image.
> This command only works on Linux because of the temporary directory used. This location must exist in RAM. `-v "/dev/shm/shinobiStreams":'/dev/shm/streams':'rw'`. The timezone is also acquired from the host by the volume declaration of `-v '/etc/localtime':'/etc/localtime':'ro'`.
```
docker run -d --name='Shinobi' -p '8080:8080/tcp' -v "/dev/shm/Shinobi/streams":'/dev/shm/streams':'rw' -v "$HOME/Shinobi/config":'/config':'rw' -v "$HOME/Shinobi/customAutoLoad":'/home/Shinobi/libs/customAutoLoad':'rw' -v "$HOME/Shinobi/database":'/var/lib/mysql':'rw' -v "$HOME/Shinobi/videos":'/home/Shinobi/videos':'rw' -v "$HOME/Shinobi/plugins":'/home/Shinobi/plugins':'rw' shinobi-image:1.0
docker run -d --name='Shinobi' -p '8080:8080/tcp' -v "/dev/shm/Shinobi/streams":'/dev/shm/streams':'rw' -v "$HOME/Shinobi/config":'/config':'rw' -v "$HOME/Shinobi/customAutoLoad":'/home/Shinobi/libs/customAutoLoad':'rw' -v "$HOME/Shinobi/database":'/var/lib/mysql':'rw' -v "$HOME/Shinobi/videos":'/home/Shinobi/videos':'rw' -v "$HOME/Shinobi/plugins":'/home/Shinobi/plugins':'rw' -v '/etc/localtime':'/etc/localtime':'ro' shinobi-image:1.0
```
> Host mount paths have been updated in this document.

View File

@ -66,37 +66,26 @@ cd /home/Shinobi
mkdir -p libs/customAutoLoad
if [ -e "/config/conf.json" ]; then
cp /config/conf.json conf.json
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
node tools/modifyConfiguration.js subscriptionId=$SUBSCRIPTION_ID
cp conf.json /config/conf.json
fi
#create super.json
if [ -e "/config/super.json" ]; then
echo "============="
echo "Default Superuser : admin@shinobi.video"
echo "Default Password : admin"
echo "* You can edit these settings in \"super.json\" located in the Shinobi directory."
cp /config/super.json super.json
fi
if [ ! -e "./conf.json" ]; then
sudo cp conf.sample.json conf.json
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
node tools/modifyConfiguration.js subscriptionId=$SUBSCRIPTION_ID
sudo cp conf.json /config/conf.json
fi
#create super.json
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
sudo cp conf.json /config/conf.json
echo "============="
echo "Default Superuser : admin@shinobi.video"
echo "Default Password : admin"
echo "Log in at http://HOST_IP:SHINOBI_PORT/super"
if [ -e "/config/super.json" ]; then
cp /config/super.json super.json
fi
if [ ! -e "./super.json" ]; then
echo "============="
echo "Default Superuser : admin@shinobi.video"
echo "Default Password : admin"
echo "* You can edit these settings in \"super.json\" located in the Shinobi directory."
sudo cp super.sample.json super.json
sudo cp super.sample.json /config/super.json
fi
touch thisIsDocker.txt
# Execute Command
echo "Starting Shinobi ..."
exec "$@"

View File

@ -1,4 +1,4 @@
FROM ubuntu:bionic
FROM ubuntu:focal
ENV DB_USER=majesticflame \
DB_PASSWORD=mizukagesbluedress \
@ -8,6 +8,7 @@ ENV DB_USER=majesticflame \
DB_ROOT_USER=root \
SUBSCRIPTION_ID=sub_XXXXXXXXXXXX \
DB_DISABLE_INCLUDED=false
ARG DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /home/Shinobi /config /var/lib/mysql
@ -77,9 +78,6 @@ RUN apt install -y \
tar \
sudo \
xz-utils
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 800 --slave /usr/bin/g++ g++ /usr/bin/g++-7
####
WORKDIR /home/Shinobi

View File

@ -433,7 +433,7 @@ module.exports = function(s,config,lang,io){
s.databaseEngine = require('knex')(s.databaseOptions)
//run prerequsite queries
s.preQueries()
setTimeout(function(){
setTimeout(() => {
//check for subscription
checkSubscription(function(){
//check terminal commander
@ -443,7 +443,7 @@ module.exports = function(s,config,lang,io){
//load monitors (for groups)
loadMonitors(function(){
//check for orphaned videos
checkForOrphanedVideos(function(){
checkForOrphanedVideos(async () => {
s.processReady()
})
})

View File

@ -120,17 +120,14 @@ module.exports = function(s,config,lang,app){
old:jsonfile.readFileSync(s.location.config)
})
try{
const dockerConfigFile = '/config/conf.json'
fs.stat(dockerConfigFile,(err) => {
if(!err){
fs.stat(s.mainDirectory + '/thisIsDocker.txt',(err) => {
if(!err){
fs.writeFile(dockerConfigFile,JSON.stringify(postBody,null,3),function(){
})
}
})
}
})
if(config.thisIsDocker){
const dockerConfigFile = '/config/conf.json'
fs.stat(dockerConfigFile,(err) => {
if(!err){
fs.writeFile(dockerConfigFile,JSON.stringify(postBody,null,3),function(){})
}
})
}
}catch(err){
console.log(err)
}
@ -221,17 +218,14 @@ module.exports = function(s,config,lang,app){
}
//update master list in system
try{
const dockerSuperFile = '/config/super.json'
fs.stat(dockerSuperFile,(err) => {
if(!err){
fs.stat(s.mainDirectory + '/thisIsDocker.txt',(err) => {
if(!err){
fs.writeFile(dockerSuperFile,JSON.stringify(currentSuperUserList,null,3),function(){
})
}
})
}
})
if(config.thisIsDocker){
const dockerSuperFile = '/config/super.json'
fs.stat(dockerSuperFile,(err) => {
if(!err){
fs.writeFile(dockerSuperFile,JSON.stringify(currentSuperUserList,null,3),function(){})
}
})
}
}catch(err){
console.log(err)
}

View File

@ -57,17 +57,14 @@ processArgv.forEach(function(val) {
});
try{
const dockerConfigFile = '/config/conf.json'
fs.stat(dockerConfigFile,(err) => {
if(!err){
fs.stat('../thisIsDocker.txt',(err) => {
if(!err){
fs.writeFile(dockerConfigFile,JSON.stringify(config,null,3),function(){
})
}
})
}
})
if(config.thisIsDocker){
const dockerConfigFile = '/config/conf.json'
fs.stat(dockerConfigFile,(err) => {
if(!err){
fs.writeFile(dockerConfigFile,JSON.stringify(config,null,3),function(){})
}
})
}
}catch(err){
console.log(err)
}