Closed kozoke closed 5 years ago
admin account I figured from the Dockerhub tags, the password is administrator
[https://hub.docker.com/r/migoller/shinobi/~/dockerfile/]
But in the admin interface, I am unable to create any further users.
Hey guys. I'm sorry for being offline so long.
If you do not set any environment variables running a container based on my Shinobi Docker images you should be able to access the corresponding web UIs:
As far as I know it's not possible to login to the admin UI or the default web UI with the super admin account! I struggled a long time with those issues when I started to set up Shinobi.
So, please add at least a regular admin account to your installation first, right?
If you want to integrate any LDAP accounts, please let me know.
Try to open http://[IP of Docker host]:8080/super
in your browser. You'll have to enter the credentials you've set for your Docker container.
Environment variable | Dockerfile default value |
---|---|
ADMIN_USER |
admin@shinobi.video |
ADMIN_PASSWORD |
administrator |
After the login succeeded you should get a screen like this.
Hit "+" on the right side of "Account" to enter a new regular admin account.
Open http://[IP of Docker host]:8080/admin
in your browser. You'll have to login with the credentials of an admin account you've created with the super admin account. If the login succeeds you'll get a screen like this.
Now you can add additional "regular" user accounts, assign special rights to them, etc. .
Now try to open http://[IP of Docker host]:8080
in your browser, please. You should be able to login with credentials of admin or user accounts.
Please let me know, if you're able to login now.
@todvndvn : You say
But in the admin interface, I am unable to create any further users.
To which admin interface do you login: Super admin UI or admin UI?
Best Regards, Michael
@MiGoller , You are awesome. Thanks for the reply.
Except for the initial login on IPADDRESS/super URL, nothing is working. Unable to create any users in IPADDRESS/admin page or on the IPADDRESS:PORT page.
Upon further digging I found that mysql did not create database. I logged into the container tried to start mysql and failed. So I uninstalled and reinstalled mysql but it still stuck the same sock error as below.
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
Appreciate your inputs.
Thanks.
Ah, ok. Looks like I have to update the readme files. I'm sorry for that.
I've stripped down the image for micro-services environments; so MySQL or MariaDB are missing at all. The images support existing MySQL oder MariaDB servers. You'll have to set the following environment variables to accomplish that:
If you set these environment variables the container will check upon every start if the database exists. If not, the container will create the database even on a remote host, creates the user account, sets it's password and grants access to the Shinobi database.
So, do you have an existing MySQL or MariaDB server? If not I'll supply instruction on how to set up a dedicated MySQL server on Docker; another way is to run docker stack or compose to create the corresponding containers. I'll provide that szenario within my upcoming commits.
For easier use I'll add another flavour of images with already installed MySQL servers. Would the be helpfull to you?
Regards, Michael
Hey all,
thank you for your feedback. I've setup an environment for this issue and I'm able to reproduce a stable workaround as long as none of my images ships with MySQL.
Ok, let's go. Please follow the instructions to get it up and running, hopefully. The following steps will pull my latest Alpine-based Shinobi image and the latest MariaDB image from Docker Hub. I encountered many problems setting up the environment with the latest MySQL image.
Install docker-compose if it's not installed.
Just run $ sudo apt-get install docker-compose
.
Create a directory for this workaround to keep Shinobi's database, configuration files and video files. Let's say we name it shinobi
.
$ mkdir shinobi
Change into that freshly created directory.
$ cd shinobi
Now create the the subdirectories for database, configuration files and video files.
$ mkdir c_datadir c_config c_videos
You will create environment files now for Shinobi and MariaDB settings, so we do not have to pass the environment variables to each container for every variable.
Create a file named Shinobi.env
with this default content. You would find it inside the Dockerfile
if you're interested in.
ADMIN_USER=admin@shinobi.video
ADMIN_PASSWORD=administrator
CRON_KEY=b59b5c62-57d0-4cd1-b068-a55e5222786f
PLUGINKEY_MOTION=49ad732d-1a4f-4931-8ab8-d74ff56dac57
PLUGINKEY_OPENCV=6aa3487d-c613-457e-bba2-1deca10b7f5d
PLUGINKEY_OPENALPR=SomeOpenALPRkeySoPeopleDontMessWithYourShinobi
MOTION_HOST=localhost
MOTION_PORT=8080
Create a file named MySQL.env
with this content. Once again that's nothing special.
MYSQL_USER=majesticflame
MYSQL_PASSWORD=password
MYSQL_HOST=db
MYSQL_DATABASE=ccio
MYSQL_ROOT_PASSWORD=blubsblawoot
MYSQL_ROOT_USER=root
Next we will use docker-compose
to create and start a stack for Shinobi with a container for Shinobi and a container for MariaDB.
Create a file named docker-compose.yml
with this content. The content differs from the last commit to my corresponding GitHub repository, because I switched from MySQL to MariaDB because of connection issues.
version: '2'
services:
db:
image: mariadb
env_file:
- MySQL.env
volumes:
- ./c_datadir:/var/lib/mysql
web:
image: migoller/shinobi:alpine
env_file:
- MySQL.env
- Shinobi.env
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ./c_config:/config
- ./c_videos:/opt/shinobi/videos
depends_on:
- db
ports:
- "8080:8080"
This file instructs docker-compose
to create two containers for this stack:
db
for the MariaDB server.web
for the Shinobi app.We will persist the data with volume mounts to the directories created earlier.
Ok, now let's see if the stack's containers will be created as expected.
$ docker-compose -f ./docker-compose.yml create
Finally the output should show that the containers have been created. The output must not show errors creating the containers.
Creating shinobi_db_1
Creating shinobi_web_1
$
If you have named the directory differently the containers will have different names.
We have successfully created the containers. Now start the stack for the very first time.
$ docker-compose -f ./docker-compose.yml up
The docker-compose
command will show you any container output.
Creating network "shinobi_default" with the default driver
Creating shinobi_db_1
Creating shinobi_web_1
Attaching to shinobi_db_1, shinobi_web_1
web_1 | Copy custom configuration files ...
web_1 | No custom config files found.
web_1 | Create default config file /opt/shinobi/conf.json ...
web_1 | Create default config file /opt/shinobi/super.json ...
web_1 | Create default config file /opt/shinobi/plugins/motion/conf.json ...
web_1 | Hash admin password ...
web_1 | Wait for MySQL server ...
web_1 | cp: can't stat '/config/*': No such file or directory
db_1 | Initializing database
db_1 |
The first start will take a few moments because the MariaDB server environment and the Shinobi database have to be set up first.
Look for Shinobi is ready.
. If you find it... well Shinobi is up and running.
web_1 | Set MySQL configuration from environment variables ...
web_1 | . Username
web_1 | . Password
web_1 | . Host
web_1 | . Database
web_1 | Set keys for CRON and PLUGINS from environment variables ...
web_1 | Set configuration for motion plugin from environment variables ...
web_1 | Starting Shinobi ...
web_1 | [2018-09-27 xx:xx:xx] PM2 log: Launching in no daemon mode
web_1 | [2018-09-27 xx:xx:xx] PM2 log: Starting execution sequence in -fork mode- for app name:Camera-App id:0
web_1 | [2018-09-27 xx:xx:xx] PM2 log: Starting execution sequence in -fork mode- for app name:Cron-App id:1
web_1 | [2018-09-27 xx:xx:xx] PM2 log: App name:Camera-App id:0 online
web_1 | [2018-09-27 xx:xx:xx] PM2 log: App name:Cron-App id:1 online
web_1 | [2018-09-27 xx:xx:xx] PM2 log: Starting execution sequence in -fork mode- for app name:Motion-App id:2
web_1 | [2018-09-27 xx:xx:xx] PM2 log: App name:Motion-App id:2 online
web_1 | Shinobi : cron.js started
web_1 | NODE.JS version : v8.10.0
web_1 | FFMPEG version : 3.4.2-static https://johnvansickle.com/ffmpeg/
web_1 | Shinobi - PORT : 8080
web_1 | 2018-09-27T20:05:03+02:00 Critical update 1/2 already applied
web_1 | 2018-09-27T20:05:03+02:00 Critical update 2/2 already applied
web_1 | 2018-09-27T20:05:04+02:00 pluginInitiatorSuccess { f: 'init',
web_1 | plug: 'Motion',
web_1 | notice: 'Looks like you have the Motion plugin running. Don\'t forget to enable <b>Send Frames</b> to start pushing frames to be read.',
web_1 | pluginKey: '49ad732d-1a4f-4931-8ab8-d74ff56dac57' }
web_1 | 2018-09-27Txx:xx:xx+02:00 Connected to plugin : Detector - Motion - undefined
web_1 | 2018-09-27Txx:xx:xx+02:00 admin@local.org : size check for videos : 0
web_1 | 2018-09-27Txx:xx:xx+02:00 admin@local.org : end of size check for videos 1/1
web_1 | 2018-09-27Txx:xx:xx+02:00 all users checked, wait to close open files and remove files over user limit
web_1 | 2018-09-27Txx:xx:xx+02:00 waiting to give unfinished video check some time. 3 seconds.
web_1 | 2018-09-27Txx:xx:xx+02:00 starting all monitors set to watch and record
web_1 | 2018-09-27Txx:xx:xx+02:00 Shinobi is ready.
Now you should be able to login to the super admin dashboard at http://[IP of Docker host]:8080/super
. Give it a try, please.
If you're able to login as the super admin with the credentials found in the Shinobi.ebv
file, create a normal admin first.
Now login http://[IP of Docker host]:8080/admin
with the admin credentials. The super admin will not be able to login. Create a regular user account.
Finally login to the users dashboard http://[IP of Docker host]:8080
with admin or user credentials. The super admin will not be able to login.
Please let me know if you get it up and running.
Regards, Michael
PS: One small suggestion to improve it for noobs like me.. please update sudo in the command line of docker-compose at both places. Without SUDO if we used the command, the error message is not so obvious. That's all.
You're welcome. I'm happy about you get it up and running successfully. Thank you for your feedback. I'll modify my docs and publish them later. I will close this issue, right?
Btw: Do your run Docker CE on a Linux distro? If so, did you follow the installation on Get Docker CE for Ubuntu? Docker privides Post-installation steps for Linux including a section on how to manage Docker as a non-root user. You'd just have to create a group named docker
and add your own useraccount as a member to that group. Logoff and login again.
Regards, Michael
This is very helpful. I think that an older Docker solution for shinobi managed to have the mysql database inside the container, rather than in external volumes on persistent storage. I would really like to be able to re-create the containers to get later versions without having to worry about all that state disappearing.
Hey Imamakos.
I'm sorry for comming back to you so lately. I still provide "official" Docker images for Shinobi including MariaDB server as well. It's up to you. Please have a look at the "offical"-tagged images on https://cloud.docker.com/repository/docker/migoller/shinobidocker/tags .
To persist your data using the "official" images you have to bind or mount the container's data directory /var/lib/mysql
like -v [Path to Shinobi direcory]/datadir:/var/lib/mysql
.
Hey Imamakos.
I'll close this issue if my hint did the trick to you.
Sure, thanks for the pointer.
Hi,
I'm trying to log into the admin account Web Address : http://xxx.xxx.xxx.xxx:8080/super Username : admin@shinobi.video Password : admin
but it won't accept the password. Any suggestions?