mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-07-25 15:03:31 +00:00
@ -1,26 +1,31 @@
|
||||
# Developers documentation
|
||||
|
||||
## Table of contents
|
||||
- [System architecture](#system-architecture)
|
||||
- [API documentation](#api-documentation)
|
||||
- [How to contribute](#how-to-contribute)
|
||||
- [Working with Docker tips](#working-with-docker-tips)
|
||||
- [How video is transcoded](#how-video-is-transcoded)
|
||||
- [1. Welcome](#1-welcome)
|
||||
- [2. System architecture](#2-system-architecture)
|
||||
- [3. API documentation](#3-api-documentation)
|
||||
- [4. How to contribute](#4-how-to-contribute)
|
||||
- [5. Working with Docker tips](#5-working-with-docker-tips)
|
||||
- [6. Working with the automated tests](#6-working-with-the-automated-tests)
|
||||
- [7. How video is transcoded](#7-how-video-is-transcoded)
|
||||
|
||||
## How to contribute
|
||||
## 1. Welcome
|
||||
This page is created for MediaCMS developers and contains related information.
|
||||
|
||||
## 2. System architecture
|
||||
to be written
|
||||
|
||||
## 3. API documentation
|
||||
API is documented using Swagger - checkout ot http://your_installation/swagger - example https://demo.mediacms.io/swagger/
|
||||
This page allows you to login to perform authenticated actions - it will also use your session if logged in.
|
||||
|
||||
## 4. How to contribute
|
||||
Before you send a PR, make sure your code is properly formatted. For that, use `pre-commit install` to install a pre-commit hook and run `pre-commit run --all` and fix everything before you commit. This pre-commit will check for your code lint everytime you commit a code.
|
||||
|
||||
Checkout the [Code of conduct page](../CODE_OF_CONDUCT.md) if you want to contribute to this repository
|
||||
|
||||
|
||||
## System architecture
|
||||
|
||||
## API documentation
|
||||
API is documented using Swagger - checkout ot http://your_installation/swagger - example https://demo.mediacms.io/swagger/
|
||||
This page allows you to login to perform authenticated actions - it will also use your session if logged in.
|
||||
|
||||
|
||||
## Working with Docker tips
|
||||
## 5. Working with Docker tips
|
||||
|
||||
To perform the Docker installation, follow instructions to install Docker + Docker compose (docs/Docker_Compose.md) and then build/start docker-compose-dev.yaml . This will run the frontend application on port 8088 on top of all other containers (including the Django web application on port 80)
|
||||
|
||||
@ -33,7 +38,7 @@ docker-compose -f docker-compose-dev.yaml up
|
||||
Eg change `frontend/src/static/js/pages/HomePage.tsx` , dev application refreshes in a number of seconds (hot reloading) and I see the changes, once I'm happy I can run
|
||||
|
||||
```
|
||||
docker-compose -f docker-compose-dev.yaml -T frontend npm run dist
|
||||
docker-compose -f docker-compose-dev.yaml exec -T frontend npm run dist
|
||||
```
|
||||
|
||||
And then in order for the changes to be visible on the application while served through nginx,
|
||||
@ -50,7 +55,8 @@ Media page: need to upload content through the main application (nginx/port 80),
|
||||
|
||||
There are some issues with CORS too to resolve, in order for some pages to function, eg the manage comments page
|
||||
|
||||
```http://localhost:8088/manage-media.html px manage_media
|
||||
```
|
||||
http://localhost:8088/manage-media.html manage_media
|
||||
```
|
||||
|
||||
### Backend application changes
|
||||
@ -81,3 +87,42 @@ there is also an experimental small service (not commited to the repo currently)
|
||||
When the Encode object is marked as success and chunk=False, and thus is available for download/stream, there is a task that gets started and saves an HLS version of the file (1 mp4-->x number of small .ts chunks). This would be FILES_C
|
||||
|
||||
This mechanism allows for workers that have access on the same filesystem (either localhost, or through a shared network filesystem, eg NFS/EFS) to work on the same time and produce results.
|
||||
|
||||
## 6. Working with the automated tests
|
||||
|
||||
This instructions assume that you're using the docker installation
|
||||
|
||||
1. start docker-compose
|
||||
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
2. Install the requirements on `requirements-dev.txt ` on web container (we'll use the web container for this)
|
||||
|
||||
```
|
||||
docker-compose exec -T web pip install -r requirements-dev.txt
|
||||
```
|
||||
|
||||
3. Now you can run the existing tests
|
||||
|
||||
```
|
||||
docker-compose exec --env TESTING=True -T web pytest
|
||||
```
|
||||
|
||||
The `TESTING=True` is passed for Django to be aware this is a testing environment (so that it runs Celery tasks as functions for example and not as background tasks, since Celery is not started in the case of pytest)
|
||||
|
||||
|
||||
4. You may try a single test, by specifying the path, for example
|
||||
|
||||
```
|
||||
docker-compose exec --env TESTING=True -T web pytest tests/test_fixtures.py
|
||||
```
|
||||
|
||||
5. You can also see the coverage
|
||||
|
||||
```
|
||||
docker-compose exec --env TESTING=True -T web pytest --cov=. --cov-report=html
|
||||
```
|
||||
|
||||
and of course...you are very welcome to help us increase it ;)
|
||||
|
Reference in New Issue
Block a user