Skip to content

Commit

Permalink
Merge branch 'thelan-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Delle Cave committed Oct 2, 2018
2 parents c261f49 + e4a1a6e commit 56eeb74
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Dockerfile
@@ -0,0 +1,32 @@
FROM python:2.7-slim

# Install base softwares
RUN apt-get update && apt-get install -y --no-install-recommends \
libcurl4-gnutls-dev \
libgnutls28-dev \
build-essential \
python-magic \
chromium-driver chromium redis-server && \
rm -rf /var/lib/apt/lists/*

# Add source to container
ADD . /opt/mjcast-src

# Install python module
RUN pip install -r /opt/mjcast-src/requirements.txt && \
cd /opt/mjcast-src && python ./setup.py install

# Add extra resources
RUN mkdir /var/log/mjcast && \
chown nobody.nogroup /var/log/mjcast && \
chmod +x /opt/mjcast-src/docker/docker-entrypoint.sh && \
mkdir /etc/mjcast && \
cp -a /opt/mjcast-src/etc/mjcast/mjcast.yml.example /etc/mjcast/mjcast.yml && \
mkdir /usr/share/mjcast && cp /opt/mjcast-src/share/mjcast/loading.jpg /usr/share/mjcast/loading.jpg

EXPOSE 8670

ENTRYPOINT ["/opt/mjcast-src/docker/docker-entrypoint.sh"]

# Run mjcast in foreground
CMD ["mjcast", "-f"]
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -12,3 +12,19 @@ Installation on Debian
- apt-get install chromium-driver chromium python-dev python-pip redis-server
- pip install -r requirements.txt
- pip install mjcast

Running with Docker
===================

If you want to run this project with docker you first need to build it.

```sh
docker build -t mjcast .
```

Then you would run it with the following command:
```sh
docker run -d --shm-size 512M -p 8670:8670 -v `pwd`/docker/mjcast.yml.example:/etc/mjcast/mjcast.yml:ro mjcast
```

Do not ommit the `--shm-size` else chromium won't start
6 changes: 6 additions & 0 deletions docker/docker-entrypoint.sh
@@ -0,0 +1,6 @@
#!/bin/sh

echo "Starting redis server ..."
redis-server > /dev/null 2>&1&
echo "${@}"
$@
78 changes: 78 additions & 0 deletions docker/mjcast.yml.example
@@ -0,0 +1,78 @@
general:
listen_addr: 0.0.0.0
listen_port: 8670
charset: utf-8
content_type: 'application/json; charset=utf-8'
max_workers: 10
loading_file: '/usr/share/mjcast/loading.jpg'
redis:
playlist:
url: 'redis://127.0.0.1:6379?db=0'
plugins:
playlist:
-
name: google_news
executable_path: '/usr/bin/chromedriver'
binary_location: '/usr/bin/chromium'
datetime:
color: [0, 0, 0]
scale: 1.2
thickness: 2
url: 'https://news.google.com/news/headlines?ned=us&gl=US&hl=en'
delay: 1
ttl: 20
wait: 10
options:
- '--no-sandbox' # only if you running daemon as root
- '--headless'
- '--disable-gpu'
- '--window-size=1920,1080'
- '--hide-scrollbars'
-
name: prometheus
executable_path: '/usr/bin/chromedriver'
binary_location: '/usr/bin/chromium'
datetime:
color: [255, 255, 255]
scale: 1.2
thickness: 2
url: 'https://prometheus.io/assets/grafana_prometheus.png'
delay: 1
ttl: 20
wait: 10
options:
- '--no-sandbox' # only if you running daemon as root
- '--headless'
- '--disable-gpu'
- '--window-size=1920,1080'
- '--hide-scrollbars'
-
name: bing
executable_path: '/usr/bin/chromedriver'
binary_location: '/usr/bin/chromium'
datetime:
color: [130, 7, 170]
scale: 1.2
thickness: 2
url: 'https://www.bing.com'
delay: 1
ttl: 20
wait: 10
options:
- '--no-sandbox' # only if you running daemon as root
- '--headless'
- '--disable-gpu'
- '--window-size=1920,1080'
- '--hide-scrollbars'
modules:
server:
routes:
status:
handler: 'status'
name: 'server/status'
op: 'GET'
stream:
safe_init: true
handler: 'stream'
name: 'server/stream'
op: 'GET'

0 comments on commit 56eeb74

Please sign in to comment.