Compare commits

..

15 Commits
v1.1 ... v1.2

Author SHA1 Message Date
Markos Gogoulos
632db06ca3 command for mp4hls path 2021-03-22 21:35:32 +02:00
swiftugandan
0129ab6732 Fix docker chown recursion performance and bento4 upgrade (#95)
* optimize docker chown performance

* upgrades bento4
2021-03-22 20:04:12 +02:00
dependabot[bot]
2b65afc8dd Bump pillow from 8.0.1 to 8.1.1 (#108)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.0.1 to 8.1.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/8.0.1...8.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-22 20:02:59 +02:00
Dan1ell
b27e3ca6f6 Update Configuration.md (#86)
Clarifying which local_settings.py file to use.
2021-03-21 20:38:40 +02:00
Markos Gogoulos
1a7adb80da Update Configuration.md (#93)
add option
2021-03-21 20:38:18 +02:00
Markos Gogoulos
2552551662 removes redundant usage of FRONTEND_HOST variable (#102) 2021-03-21 20:36:32 +02:00
Markos Gogoulos
3b35ce0262 use mediacms image from docker hub (#69)
* use mediacms image from docker hub
2021-03-08 21:54:09 +02:00
Markos Gogoulos
883af9bb4a on Readme page resize screenshots (#68)
* image formating on Readme
2021-03-08 21:36:41 +02:00
swiftugandan
47f2279098 docker remove dangling pids (#58)
Co-authored-by: Munaawa Philip <munaawap@kainos.com>
2021-02-18 21:25:40 +02:00
Markos Gogoulos
c3d411ede1 set http prefix to variable on installation (#56) 2021-02-17 22:32:30 +02:00
swiftugandan
4450350dba fixes hls generation for docker builds (#55)
Co-authored-by: Munaawa Philip <munaawap@kainos.com>
2021-02-17 22:32:18 +02:00
Markos Gogoulos
ba1bf7d263 Feat doc docker (#57)
* updated Readme, unset variabla

* unset variabla

* documentation
2021-02-17 22:32:06 +02:00
Markos Gogoulos
41c66469e2 Updated material icons version (#54)
Co-authored-by: root <1515939+styiannis@users.noreply.github.com>
2021-02-17 22:30:34 +02:00
Markos Gogoulos
9d1a22e4a9 reset variable 2021-02-11 17:38:09 +02:00
Markos Gogoulos
17eae8eefb add demo link, set False to variable (#52) 2021-02-10 18:38:40 +02:00
21 changed files with 138 additions and 121 deletions

3
.gitignore vendored
View File

@@ -1,5 +1,8 @@
media_files/encoded/
media_files/original/
media_files/hls/
media_files/chunks/
media_files/uploads/
postgres_data/
celerybeat-schedule
logs/

View File

@@ -16,10 +16,12 @@ RUN pip install -r requirements.txt
COPY . /home/mediacms.io/mediacms
WORKDIR /home/mediacms.io/mediacms
RUN wget -q http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip && \
mkdir -p /home/mediacms.io/mediacms/media_files/hls Bento4-SDK-1-6-0-632.x86_64-unknown-linux/bin/ && \
unzip -j Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip Bento4-SDK-1-6-0-632.x86_64-unknown-linux/bin/mp4hls -d Bento4-SDK-1-6-0-632.x86_64-unknown-linux/bin/ && \
rm Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip
RUN wget -q http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip && \
unzip Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip -d ../bento4 && \
mv ../bento4/Bento4-SDK-1-6-0-637.x86_64-unknown-linux/* ../bento4/ && \
rm -rf ../bento4/Bento4-SDK-1-6-0-637.x86_64-unknown-linux && \
rm -rf ../bento4/docs && \
rm Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip
############ RUNTIME IMAGE ############
FROM python:3.8-slim-buster as runtime-image
@@ -45,7 +47,7 @@ ENV ENABLE_MIGRATIONS='yes'
ENV VIRTUAL_ENV=/home/mediacms.io
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=compile-image /home/mediacms.io /home/mediacms.io
COPY --chown=www-data:www-data --from=compile-image /home/mediacms.io /home/mediacms.io
RUN apt-get update -y && apt-get -y upgrade && apt-get install --no-install-recommends \
supervisor nginx ffmpeg imagemagick procps -y && \

View File

@@ -4,20 +4,16 @@ MediaCMS is a modern, fully featured open source video and media CMS. It is deve
It is built mostly using the modern stack Django + React and includes a REST API.
A demo is available at https://demo.mediacms.io
## Screenshots
![MediaCMS](docs/images/index.jpg)
Vanilla MediaCMS index page
![MediaCMS](docs/images/video.jpg)
Video page with player different options
![MediaCMS](docs/images/embed.jpg)
Embed video page
<p align="center">
<img src="https://raw.githubusercontent.com/mediacms-io/mediacms/main/docs/images/index.jpg" width="340">
<img src="https://raw.githubusercontent.com/mediacms-io/mediacms/main/docs/images/video.jpg" width="340">
<img src="https://raw.githubusercontent.com/mediacms-io/mediacms/main/docs/images/embed.jpg" width="340">
</p>
## Features
- **Complete control over your data**: host it yourself!
@@ -79,19 +75,27 @@ In terms of disk space, think of what the needs will be. A general rule is to mu
## Installation
MediaCMS can be installed through an automated script that installs and configures all needed services on a single server, and through Docker Compose.
There are two ways to run MediaCMS, through Docker Compose and through installing it on a server via an automation script that installs and configures all needed services.
### Docker Compose installation
With a recent version of Docker Compose installed, run as root
Install a recent version of [Docker](https://docs.docker.com/get-docker/), and [Docker Compose](https://docs.docker.com/compose/install/).
Run as root
```bash
git clone https://github.com/mediacms-io/mediacms
cd mediacms
docker-compose build && docker-compose up
```
This will build an image, download and setup necessary images and start all containers. Once it finishes, MediaCMS will be installed on http://localhost
The default option is to serve MediaCMS on all ips available of the server (including localhost).
Now run
```bash
docker-compose up
```
This will download all MediaCMS related Docker images and start all containers. Once it finishes, MediaCMS will be installed and available on http://localhost or http://ip
For more instructions, checkout the docs on the [Docker deployment](docs/Docker_deployment.md) page. Docker Compose support has been contributed by @swiftugandan.

View File

@@ -23,7 +23,7 @@ DEFAULT_THEME = "black" # this is not taken under consideration currently
# if set to False will not fetch external content
# this is only for the static files, as fonts/css/js files loaded from CDNs
# not for user uploaded media!
LOAD_FROM_CDN = True
LOAD_FROM_CDN = False
LOGIN_ALLOWED = True # whether the login button appears
REGISTER_ALLOWED = True # whether the register button appears
UPLOAD_MEDIA_ALLOWED = True # whether the upload media button appears
@@ -42,7 +42,11 @@ ALLOW_RATINGS_CONFIRMED_EMAIL_ONLY = True
# ip of the server should be part of this
ALLOWED_HOSTS = ["*", "mediacms.io", "127.0.0.1", "localhost"]
FRONTEND_HOST = "http://localhost"
# this variable - along with SSL_FRONTEND_HOST is used on several places
# as email where a URL need appear etc
# FRONTEND_HOST needs an http prefix - at the end of the file
# there's a conversion to https with the SSL_FRONTEND_HOST env
INTERNAL_IPS = "127.0.0.1"
@@ -209,7 +213,7 @@ CANNOT_ADD_MEDIA_MESSAGE = ""
# mp4hls command, part of Bendo4
MP4HLS_COMMAND = (
"/home/mediacms.io/mediacms/Bento4-SDK-1-6-0-632.x86_64-unknown-linux/bin/mp4hls"
"/home/mediacms.io/mediacms/Bento4-SDK-1-6-0-637.x86_64-unknown-linux/bin/mp4hls"
)
# highly experimental, related with remote workers

View File

@@ -4,12 +4,14 @@ set -e
# forward request and error logs to docker log collector
ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && \
ln -sf /dev/stdout /var/log/nginx/mediacms.io.access.log && ln -sf /dev/stderr /var/log/nginx/mediacms.io.error.log
cp /home/mediacms.io/mediacms/deploy/docker/local_settings.py /home/mediacms.io/mediacms/cms/local_settings.py
mkdir -p /home/mediacms.io/mediacms/{logs,pids}
mkdir -p /home/mediacms.io/mediacms/{logs,pids,media_files/hls}
touch /home/mediacms.io/mediacms/logs/debug.log
chown -R www-data. /home/mediacms.io/
# Remove any dangling pids
rm -rf /home/mediacms.io/mediacms/pids/*
TARGET_GID=$(stat -c "%g" /home/mediacms.io/mediacms/)
@@ -25,6 +27,9 @@ else
usermod -a -G $GROUP www-data
fi
# We should do this only for folders that have a different owner, since it is an expensive operation
find /home/mediacms.io/ ! \( -user www-data -group $TARGET_GID \) -exec chown www-data:$TARGET_GID {} +
chmod +x /home/mediacms.io/mediacms/deploy/docker/start.sh /home/mediacms.io/mediacms/deploy/docker/prestart.sh
exec "$@"

View File

@@ -29,4 +29,8 @@ CACHES = {
BROKER_URL = REDIS_LOCATION
CELERY_RESULT_BACKEND = BROKER_URL
MP4HLS_COMMAND = (
"/home/mediacms.io/bento4/bin/mp4hls"
)
DEBUG = False

View File

@@ -7,15 +7,15 @@ server {
error_log /var/log/nginx/mediacms.io.error.log warn;
# redirect to https if logged in
if ($http_cookie ~* "sessionid") {
rewrite ^/(.*)$ https://localhost/$1 permanent;
}
# # redirect to https if logged in
# if ($http_cookie ~* "sessionid") {
# rewrite ^/(.*)$ https://localhost/$1 permanent;
# }
# redirect basic forms to https
location ~ (login|login_form|register|mail_password_form)$ {
rewrite ^/(.*)$ https://localhost/$1 permanent;
}
# # redirect basic forms to https
# location ~ (login|login_form|register|mail_password_form)$ {
# rewrite ^/(.*)$ https://localhost/$1 permanent;
# }
location /static {
alias /home/mediacms.io/mediacms/static ;

View File

@@ -9,7 +9,7 @@ services:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./deploy/docker/reverse_proxy/client_max_body_size.conf:/etc/nginx/conf.d/client_max_body_size.conf:ro
migrations:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./:/home/mediacms.io/mediacms/
environment:
@@ -24,10 +24,7 @@ services:
db:
condition: service_healthy
web:
build:
context: .
target: runtime-image
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
volumes:
@@ -41,7 +38,7 @@ services:
depends_on:
- migrations
celery_beat:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./:/home/mediacms.io/mediacms/
environment:
@@ -53,7 +50,7 @@ services:
depends_on:
- redis
celery_worker:
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
volumes:

View File

@@ -11,7 +11,7 @@ services:
- ./deploy/docker/reverse_proxy/certs/:/etc/nginx/certs/
- ./deploy/docker/reverse_proxy/client_max_body_size.conf:/etc/nginx/conf.d/client_max_body_size.conf:ro
migrations:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./:/home/mediacms.io/mediacms/
environment:
@@ -26,10 +26,7 @@ services:
db:
condition: service_healthy
web:
build:
context: .
target: runtime-image
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
volumes:
@@ -43,7 +40,7 @@ services:
depends_on:
- migrations
celery_beat:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./:/home/mediacms.io/mediacms/
environment:
@@ -55,7 +52,7 @@ services:
depends_on:
- redis
celery_worker:
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 2
volumes:

View File

@@ -2,7 +2,7 @@ version: "3"
services:
migrations:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./deploy/docker/local_settings.py:/home/mediacms.io/mediacms/deploy/docker/local_settings.py
environment:
@@ -17,10 +17,7 @@ services:
db:
condition: service_healthy
web:
build:
context: .
target: runtime-image
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
ports:
@@ -37,7 +34,7 @@ services:
depends_on:
- migrations
celery_beat:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./deploy/docker/local_settings.py:/home/mediacms.io/mediacms/deploy/docker/local_settings.py
environment:
@@ -49,7 +46,7 @@ services:
depends_on:
- redis
celery_worker:
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
volumes:

View File

@@ -2,7 +2,7 @@ version: "3"
services:
migrations:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./:/home/mediacms.io/mediacms/
environment:
@@ -17,10 +17,7 @@ services:
db:
condition: service_healthy
web:
build:
context: .
target: runtime-image
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
ports:
@@ -35,7 +32,7 @@ services:
depends_on:
- migrations
celery_beat:
image: mediacms:latest
image: mediacms/mediacms:latest
volumes:
- ./:/home/mediacms.io/mediacms/
environment:
@@ -47,7 +44,7 @@ services:
depends_on:
- redis
celery_worker:
image: mediacms:latest
image: mediacms/mediacms:latest
deploy:
replicas: 1
volumes:

View File

@@ -2,7 +2,11 @@
A number of options are available on `cms/settings.py`.
It is advisable to override any of them by adding it to `cms/local_settings.py` .
It is advisable to override any of them by adding it to `local_settings.py` .
In case of a the single server installation, add to `cms/local_settings.py` .
In case of a docker compose installation, add to `deploy/docker/local_settings.py` . This will automatically overwrite `cms/local_settings.py` .
Any change needs restart of MediaCMS in order to take effect. So edit `cms/local_settings.py`, make a change and restart MediaCMS
@@ -94,6 +98,14 @@ Make changes (True/False) to any of the following:
- CAN_SHARE_MEDIA = True # whether the share media appears
```
### show/hide the download option on a media
Edit `templates/config/installation/features.html` and set
```
download: false
```
### automatically hide media upon being reported
set a low number for variable `REPORTED_TIMES_THRESHOLD`

View File

@@ -5,12 +5,7 @@ from .methods import is_mediacms_editor, is_mediacms_manager
def stuff(request):
"""Pass settings to the frontend"""
ret = {}
if request.is_secure():
# in case session is https, pass this setting so
# that the frontend uses https too
ret["FRONTEND_HOST"] = settings.SSL_FRONTEND_HOST
else:
ret["FRONTEND_HOST"] = settings.FRONTEND_HOST
ret["FRONTEND_HOST"] = request.build_absolute_uri('/')
ret["DEFAULT_THEME"] = settings.DEFAULT_THEME
ret["PORTAL_NAME"] = settings.PORTAL_NAME
ret["LOAD_FROM_CDN"] = settings.LOAD_FROM_CDN

View File

@@ -60,8 +60,9 @@ FRONTEND_HOST=`echo "$FRONTEND_HOST" | sed -r 's/https:\/\///g'`
sed -i s/localhost/$FRONTEND_HOST/g deploy/local_install/mediacms.io
FRONTEND_HOST_HTTP_PREFIX='http://'$FRONTEND_HOST
echo 'FRONTEND_HOST='\'"$FRONTEND_HOST"\' >> cms/local_settings.py
echo 'FRONTEND_HOST='\'"$FRONTEND_HOST_HTTP_PREFIX"\' >> cms/local_settings.py
echo 'PORTAL_NAME='\'"$PORTAL_NAME"\' >> cms/local_settings.py
echo "SSL_FRONTEND_HOST = FRONTEND_HOST.replace('http', 'https')" >> cms/local_settings.py
@@ -114,8 +115,8 @@ fi
# Bento4 utility installation, for HLS
cd /home/mediacms.io/mediacms
wget http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip
unzip Bento4-SDK-1-6-0-632.x86_64-unknown-linux.zip
wget http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip
unzip Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip
mkdir /home/mediacms.io/mediacms/media_files/hls
# last, set default owner

View File

@@ -9,7 +9,7 @@ uwsgi==2.0.19.1
django-redis==4.12.1
celery==4.4.7
Pillow==8.0.1
Pillow==8.1.1
django-imagekit
markdown
django-filter

View File

@@ -1,10 +1,8 @@
/*@import url('https://fonts.googleapis.com/icon?family=Material+Icons');*/
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url('../../lib/material-icons/v50/icons.woff2') format('woff2');
src: url('../../lib/material-icons/v77/icons.woff2') format('woff2');
font-display: swap;
}

Binary file not shown.

View File

@@ -1,37 +1,37 @@
MediaCMS.url = {
home: "{{FRONTEND_HOST}}",
search: "{{FRONTEND_HOST}}/search",
latestMedia: "{{FRONTEND_HOST}}/latest",
featuredMedia: "{{FRONTEND_HOST}}/featured",
recommendedMedia: "{{FRONTEND_HOST}}/recommended",
members: "{{FRONTEND_HOST}}/members",
home: "/",
search: "/search",
latestMedia: "/latest",
featuredMedia: "/featured",
recommendedMedia: "/recommended",
members: "/members",
/* Error pages */
error404: "{{FRONTEND_HOST}}/error",
error404: "/error",
/* Taxonomies pages */
tags: "{{FRONTEND_HOST}}/tags",
categories: "{{FRONTEND_HOST}}/categories",
topics: "{{FRONTEND_HOST}}/topics",
languages: "{{FRONTEND_HOST}}/languages",
countries: "{{FRONTEND_HOST}}/countries",
tags: "/tags",
categories: "/categories",
topics: "/topics",
languages: "/languages",
countries: "/countries",
/* User pages */
likedMedia: "{{FRONTEND_HOST}}/liked",
history: "{{FRONTEND_HOST}}/history",
likedMedia: "/liked",
history: "/history",
/* Add/edit pages */
addMedia: "{{FRONTEND_HOST}}/upload",
addMedia: "/upload",
/* User account pages */
editProfile: "{{user.edit_url}}",
{% if request.user.is_authenticated %}
signout: "{{FRONTEND_HOST}}/accounts/logout/",
signout: "/accounts/logout/",
editChannel: "{{user.default_channel_edit_url}}",
changePassword: "{{FRONTEND_HOST}}/accounts/password/change/",
changePassword: "/accounts/password/change/",
/* Administration pages */
{% if IS_MEDIACMS_ADMIN %}admin: '/admin',{% endif %}
/* Management pages */
{% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER or IS_MEDIACMS_EDITOR %}manageMedia: "{{FRONTEND_HOST}}/manage/media",{% endif %}
{% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER %}manageUsers: "{{FRONTEND_HOST}}/manage/users",{% endif %}
{% if IS_MEDIACMS_ADMIN or IS_MEDIACMS_MANAGER or IS_MEDIACMS_EDITOR %}manageComments: "{{FRONTEND_HOST}}/manage/comments",{% endif %}
{% if IS_MEDIACMS_EDITOR %}manageMedia: "/manage/media",{% endif %}
{% if IS_MEDIACMS_MANAGER %}manageUsers: "/manage/users",{% endif %}
{% if IS_MEDIACMS_EDITOR %}manageComments: "/manage/comments",{% endif %}
{% else %}
signin: "{{FRONTEND_HOST}}/accounts/login/",
register: "{{FRONTEND_HOST}}/accounts/signup/",
signin: "/accounts/login/",
register: "/accounts/signup/",
{% endif %}
};

View File

@@ -1,8 +1,8 @@
MediaCMS.site = {
id: 'mediacms',
title: "{{PORTAL_NAME}}",
url: '{{FRONTEND_HOST}}/',
api: '{{FRONTEND_HOST}}/api/v1',
url: '{{FRONTEND_HOST}}',
api: '{{FRONTEND_HOST}}api/v1',
theme: {
mode: 'light', // Valid values: 'light', 'dark'.
switch: {
@@ -11,12 +11,12 @@ MediaCMS.site = {
},
logo:{
lightMode:{
img: "{{FRONTEND_HOST}}/static/images/logo_dark.png",
svg: "{{FRONTEND_HOST}}/static/images/logo_dark.svg",
img: "/static/images/logo_dark.png",
svg: "/static/images/logo_dark.svg",
},
darkMode:{
img: "{{FRONTEND_HOST}}/static/images/logo_light.png",
svg: "{{FRONTEND_HOST}}/static/images/logo_light.svg",
img: "/static/images/logo_light.png",
svg: "/static/images/logo_light.svg",
},
},
pages: {
@@ -50,3 +50,4 @@ MediaCMS.site = {
},
},
};