DmitryBurnaev / podcast-service

Podcast's API service
MIT License
3 stars 2 forks source link

Podcasts Service

Backend Service which can be used for creation a custom podcasts (sets of episodes) based on fetched public media resources.
This project provides a backend (API service) and is positioned as an updated version of podcast application.

GitHub Pipenv locked Python version Code style: black

Content

Project Description

Target

This application can be used for creation your podcasts.
If you have any sounds (or YouTube videos as example) which you want to listen later, you can create podcast (via web interface) and attach your tracks to it
Created podcast (with prepared episodes) will have a direct link (to RSS feed), which can be used for adding your podcast to same podcast application (Add by URL)
Adding and downloading each new episodes will refresh RSS-feed and your APP will be able to get them.

Tech Stack

Tech details

Technically project contains from 3 parts:

Starlette API service (run on APP_PORT from your env):
Media storage (S3):
Background application: RQ

Install Project

Prepare virtual environment

cd "<PATH_TO_PROJECT>"
cp .env.template .env
# update variables to actual (redis, postgres, etc.)

Prepare extra resources (postgres | redis)

export $(cat .env | grep -v ^# | xargs)
docker run --name postgres-etc -e POSTGRES_PASSWORD=${DATABASE_PASSWORD} -d postgres:10.11
docker run --name redis-etc -d redis

Create database

export $(cat .env | grep -v ^# | xargs)
PGPASSWORD=${DATABASE_PASSWORD} psql -U${DATABASE_USER} -h${DATABASE_HOST} -p${DATABASE_PORT} -c "create database ${DATABASE_NAME};"

Apply migrations

cd "<PATH_TO_PROJECT>" && make migrate

Run Project

Useful commands


+ Run tests
```shell script
cd "<PATH_TO_PROJECT>"/src && pytest 

Environment Variables

REQUIRED Variables

argument description example
APP_HOST App default host running (used by docker compose) 127.0.0.1
APP_PORT App default port running (used by docker compose) 9000
APP_SERVICE Run service (web/celery/test) via entrypoint.sh web
SECRET_KEY Django secret key (security) abc3412j345j1f2d3f
SITE_URL URL address to the UI-part of the podcast APP https://podcast.site.com
SERVICE_URL URL address to the BE-part of the podcast APP https://podcast-service.site.com
DB_HOST PostgreSQL database host 127.0.0.1
DB_PORT PostgreSQL database port 5432
DB_NAME PostgreSQL database name podcast
DB_USERNAME PostgreSQL database username podcast
DB_PASSWORD PostgreSQL database password podcast_asf2342
S3_STORAGE_URL URL to S3-like file storage https://s3.storage.endpoint.net
S3_ACCESS_KEY_ID Public key to S3 storage
S3_SECRET_ACCESS_KEY Secret key to S3 storage
S3_REGION_NAME S3 region
S3_BUCKET_NAME S3 bucket podcast-media
S3_BUCKET_AUDIO_PATH S3 dir for episodes audio
S3_BUCKET_IMAGES_PATH S3 dir for images (episode,podcast covers) images
S3_BUCKET_RSS_PATH S3 dir for generated RSS feeds rss

OPTIONAL Variables

argument description default
JWT_EXPIRES_IN Default time for token's lifespan 300 (sec)
APP_DEBUG Run app in debug mode False
LOG_LEVEL Allows to set current logging level DEBUG
SENTRY_DSN Sentry dsn (if not set, error logs won't be sent)
REDIS_HOST Redis host localhost
REDIS_PORT Redis port 6379
REDIS_DB Redis db 0
REDIS_PROGRESS_PUBSUB_CH Subscribe channel name for progress events channel:episodes-progress
DB_NAME_TEST Custom name for DB name for tests DB_NAME + _test
SENDGRID_API_KEY Is needed for sending Email (invite, passw., etc)
DB_ECHO Sending all db queries to stdout False
DB_ECHO Sending all db queries to stdout False
SMTP_HOST SMTP host for sending email
SMTP_PORT SMTP port for sending email 462
SMTP_USERNAME SMTP credential for sending email
SMTP_PASSWORD SMTP credential for sending email
SMTP_STARTTLS SMTP starttls config
SMTP_USE_TLS SMTP use tls config true
SMTP_FROM_EMAIL Default email for sending
SENS_DATA_ENCRYPT_KEY Key for sensdata encryption aa&nhn-ka7tq6i+22ks2ya5x

License

This product is released under the MIT license. See LICENSE for details.