Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images & dependencies update #1036

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=mediacms
POSTGRES_PASSWORD=mediacms
POSTGRES_DB=mediacms
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.4-bookworm AS compile-image
FROM python:3.12.4-bookworm AS compile-image

SHELL ["/bin/bash", "-c"]

Expand All @@ -8,10 +8,12 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV PIP_NO_CACHE_DIR=1

RUN mkdir -p /home/mediacms.io/mediacms/{logs} && cd /home/mediacms.io && python3 -m venv $VIRTUAL_ENV
RUN apt-get update -y && apt-get -y upgrade && apt-get install --no-install-recommends

# Install dependencies:
COPY requirements.txt .

RUN pip install pip==24.1.1
RUN pip install certifi
RUN pip install -r requirements.txt

COPY . /home/mediacms.io/mediacms
Expand All @@ -25,7 +27,7 @@ RUN wget -q http://zebulon.bok.net/Bento4/binaries/Bento4-SDK-1-6-0-637.x86_64-u
rm Bento4-SDK-1-6-0-637.x86_64-unknown-linux.zip

############ RUNTIME IMAGE ############
FROM python:3.11.4-bookworm as runtime-image
FROM python:3.12.4-bookworm as runtime-image

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down Expand Up @@ -60,11 +62,7 @@ RUN wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-stati
rm -rf ffmpeg-tmp ffmpeg-release-amd64-static.tar.xz

WORKDIR /home/mediacms.io/mediacms

EXPOSE 9000 80

RUN chmod +x ./deploy/docker/entrypoint.sh

ENTRYPOINT ["./deploy/docker/entrypoint.sh"]

CMD ["./deploy/docker/start.sh"]
61 changes: 61 additions & 0 deletions Dockerfile_Alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM python:3.12.4-alpine3.20 AS compile-image

# Set up virtualenv
ENV VIRTUAL_ENV=/home/mediacms.io
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV PIP_NO_CACHE_DIR=1

RUN mkdir -p /home/mediacms.io/mediacms/{logs} && cd /home/mediacms.io && python3 -m venv $VIRTUAL_ENV
RUN apk update && apk upgrade
RUN apk add --no-cache --virtual .build-deps gcc libc-dev linux-headers

# Install dependencies:
COPY requirements.txt .
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-641.x86_64-unknown-linux.zip && \
unzip Bento4-SDK-1-6-0-641.x86_64-unknown-linux.zip -d ../bento4 && \
mv ../bento4/Bento4-SDK-1-6-0-641.x86_64-unknown-linux/* ../bento4/ && \
rm -rf ../bento4/Bento4-SDK-1-6-0-641.x86_64-unknown-linux && \
rm -rf ../bento4/docs && \
rm Bento4-SDK-1-6-0-641.x86_64-unknown-linux.zip

############ RUNTIME IMAGE ############
FROM python:3.13-rc-alpine AS runtime-image

ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# See: https://github.com/celery/celery/issues/6285#issuecomment-715316219
ENV CELERY_APP='cms'

# Use these to toggle which processes supervisord should run
ENV ENABLE_UWSGI='yes'
ENV ENABLE_NGINX='yes'
ENV ENABLE_CELERY_BEAT='yes'
ENV ENABLE_CELERY_SHORT='yes'
ENV ENABLE_CELERY_LONG='yes'
ENV ENABLE_MIGRATIONS='yes'

# Set up virtualenv
ENV VIRTUAL_ENV=/home/mediacms.io
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install certifi
COPY --chown=www-data:www-data --from=compile-image /home/mediacms.io /home/mediacms.io
RUN apk update && apk upgrade && apk add --no-cache --no-interactive --virtual supervisor nginx imagemagick procps wget xz

RUN wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \
mkdir -p ffmpeg-tmp && \
tar -xf ffmpeg-release-amd64-static.tar.xz --strip-components 1 -C ffmpeg-tmp && \
cp -v ffmpeg-tmp/ffmpeg ffmpeg-tmp/ffprobe ffmpeg-tmp/qt-faststart /usr/local/bin && \
rm -rf ffmpeg-tmp ffmpeg-release-amd64-static.tar.xz

WORKDIR /home/mediacms.io/mediacms
EXPOSE 9000 80
RUN chmod +x ./deploy/docker/entrypoint.sh
ENTRYPOINT ["./deploy/docker/entrypoint.sh"]
CMD ["./deploy/docker/start.sh"]
4 changes: 2 additions & 2 deletions cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
# basic http auth user/password if you want to restrict access

MAX_MEDIA_PER_PLAYLIST = 70
# bytes, size of uploaded media
UPLOAD_MAX_SIZE = 800 * 1024 * 1000 * 5
# bytes, size of uploaded media (100G)
UPLOAD_MAX_SIZE = 800 * 1024 * 1000 * 5 * 25

MAX_CHARS_FOR_COMMENT = 10000 # so that it doesn't end up huge
TIMESTAMP_IN_TIMEBAR = False # shows timestamped comments in the timebar for videos
Expand Down
3 changes: 3 additions & 0 deletions deploy/docker/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
POSTGRES_HOST = 'db'
REDIS_LOCATION = "redis://redis:6379/1"

#Set max upload file size to 100G
UPLOAD_MAX_SIZE = 100000000000

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ events {
http {
proxy_connect_timeout 75;
proxy_read_timeout 12000;
client_max_body_size 5800M;
client_max_body_size 0;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
Expand Down
2 changes: 1 addition & 1 deletion deploy/local_install/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ events {
http {
proxy_connect_timeout 75;
proxy_read_timeout 12000;
client_max_body_size 5800M;
client_max_body_size 0;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ services:
depends_on:
- migrations
db:
image: postgres:15.2-alpine
image: postgres:16.3-alpine
volumes:
- ../postgres_data:/var/lib/postgresql/data/
restart: always
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-http-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
depends_on:
- migrations
db:
image: postgres:15.2-alpine
image: postgres:16.3-alpine
volumes:
- ../postgres_data/:/var/lib/postgresql/data/
restart: always
Expand All @@ -89,4 +89,4 @@ services:
test: ["CMD", "redis-cli","ping"]
interval: 30s
timeout: 10s
retries: 3
retries: 3
4 changes: 2 additions & 2 deletions docker-compose-https-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ services:
depends_on:
- migrations
db:
image: postgres:15.2-alpine
image: postgres:16.3-alpine
volumes:
- ../postgres_data/:/var/lib/postgresql/data/
restart: always
Expand All @@ -91,4 +91,4 @@ services:
test: ["CMD", "redis-cli","ping"]
interval: 30s
timeout: 10s
retries: 3
retries: 3
2 changes: 1 addition & 1 deletion docker-compose-letsencrypt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ services:
depends_on:
- migrations
db:
image: postgres:15.2-alpine
image: postgres:16.3-alpine
volumes:
- ../postgres_data:/var/lib/postgresql/data/
restart: always
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-named-volumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ services:
depends_on:
- migrations
db:
image: postgres:15.2-alpine
image: postgres:16.3-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
restart: always
Expand All @@ -91,4 +91,4 @@ services:
volumes:
postgres_data:
media_store:
static_store:
static_store:
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ services:
depends_on:
- migrations
db:
image: postgres:15.2-alpine
image: postgres:16.3-alpine
volumes:
- ../postgres_data:/var/lib/postgresql/data/
restart: always
Expand Down
31 changes: 16 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
Django==4.2.2
djangorestframework==3.14.0
django-allauth==0.54.0
setuptools==70.2.0
Django==5.0.6
djangorestframework==3.15.2
django-allauth==0.55.2
psycopg==3.1.9
uwsgi==2.0.21
django-redis==5.3.0
uwsgi==2.0.26
django-redis==5.4.0
celery==5.3.1
drf-yasg==1.21.6
Pillow==9.5.0
django-imagekit==4.1.0
markdown==3.4.3
django-filter==23.2
drf-yasg==1.21.7
Pillow==10.4.0
django-imagekit==5.0.0
markdown==3.6.0
django-filter==24.2
filetype==1.2.0
django-mptt==0.14.0
django-crispy-forms==1.13.0
requests==2.31.0
django-mptt==0.16.0
django-crispy-forms==2.2.0
requests==2.32.3
django-celery-email==3.0.0
m3u8==3.5.0
m3u8==5.1.0
django-ckeditor==6.6.1
django-debug-toolbar==4.1.0
django-debug-toolbar==4.4.2
django-login-required-middleware==0.9.0