Shinobi/Docker/README.md

100 lines
4.8 KiB
Markdown
Raw Normal View History

# 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.
2020-08-25 23:32:42 +00:00
1. Download Repo
```
2020-08-25 08:33:34 +00:00
git clone -b dev https://gitlab.com/Shinobi-Systems/Shinobi.git ShinobiSource
```
2. Enter Repo and Build Image.
```
cd ShinobiSource
docker build --tag shinobi-image:1.0 .
```
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' -v '/etc/localtime':'/etc/localtime':'ro' shinobi-image:1.0
```
2020-08-26 02:53:50 +00:00
> Host mount paths have been updated in this document.
### Volumes
| Volumes | Description |
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
2020-08-26 02:53:50 +00:00
| /dev/shm/Shinobi/streams | **IMPORTANT!** This must be mapped to somewhere in the host's RAM. When running this image on Windows you will need to select a different location. |
| $HOME/Shinobi/config | Put `conf.json` or `super.json` files in here to override the default. values. |
| $HOME/Shinobi/customAutoLoad | Maps to the `/home/Shinobi/libs/customAutoLoad` folder for loading your own modules into Shinobi. |
| $HOME/Shinobi/database | A map to `/var/lib/mysql` in the container. This is the database's core files. |
| $HOME/Shinobi/videos | A map to `/home/Shinobi/videos`. The storage location of your recorded videos. |
| $HOME/Shinobi/plugins | A map to `/home/Shinobi/plugins`. Mapped so that plugins can easily be modified or swapped. |
2020-08-25 23:32:42 +00:00
### Configurable Environment Variables
| Environment Variable | Description | Default |
|----------------------|----------------------------------------------------------------------|--------------------|
| 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. | *None* |
2020-08-25 23:32:42 +00:00
| 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_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.
2020-08-25 23:32:42 +00:00
### Tips
Modifying `conf.json` or Superuser credentials.
> Please read **Volumes** table in this README. conf.json is for general configuration. super.json is for Superuser credential management.
Get Docker Containers
```
docker ps -a
```
Get Images
```
docker images
```
Container Logs
```
2020-08-25 08:50:17 +00:00
docker logs /Shinobi
```
2020-08-25 23:32:42 +00:00
Enter the Command Line of the Container
```
docker exec -it /Shinobi /bin/bash
```
Stop and Remove
```
docker stop /Shinobi
docker rm /Shinobi
```
**WARNING - DEVELOPMENT ONLY!!!** Kill all Containers and Images
> These commands will completely erase all of your docker containers and images. **You have been warned!**
```
docker stop /Shinobi
docker rm $(docker ps -a -f status=exited -q)
docker rmi $(docker images -a -q)
```