Shared Music service provides you rooms where you can listen to music with friends or anyone else who wants to come in. All you have to do is click create room button and share the link. It’s that simple! See all the features here.
Main goals:
Live version can be visited at: sharedmusic.me
git clone https://github.com/Lomank123/shared-music.git
.env
file and copy the contents of .env.sample
to it.For Linux:
cd path/to/project/shared-music
cp .env.sample .env
Create /backups
folder (if you want to use backups):
mkdir backups
/sharedmusic/sharedmusic/settings/settings.py
and find CHANNEL_LAYERS
variable. Replace
"hosts": [(REDIS_HOST, 6379)],
with
"hosts": [('redis', 6379)],
docker-compose build
For the first time it may take 5-20 minutes to build everything (depends on your internet connection and PC hardware)
/sharedmusic/sharedmusic/settings/settings.py
you can find CHANNEL_LAYERS
:
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'main.channel_layers.CustomChannelLayer',
'CONFIG': {
"hosts": [(REDIS_HOST, 6379)],
},
},
}
channels.layers.InMemoryChannelLayer
main.channel_layers.CustomChannelLayer
- custom implementation of channels_redis.pubsub.RedisPubSubChannelLayer
venv
setup:
mkdir venv
cd venv
py -m venv ./venv
pip install -r requirements.txt
Create Postgres db and user (credentials should be the same as in .env
file)
DB_HOST
env var in .env
file from 'db'
to 'localhost'
:
DB_HOST=localhost
/sharedmusic
dir:
cd sharedmusic
py manage.py makemigrations
py manage.py migrate
py manage.py createsuperuser
http
and WebSocket
connections.Run Redis
if you use CustomChannelLayer
Run these commands:
cd sharedmusic
py manage.py runserver
docker-compose up
docker-compose up filldb
dev.json
fixtures containadmin
12345
test1
123123123Aa
/backups
dir you can just run pgbackups
container
docker-compose up pgbackups
If you want to configure it follow here
docker-compose up db
docker exec -t -i shared-music_db_1 sh
mkdir backups
docker cp D:\path\to\folder\backups\last\backupfile.sql.gz shared-music_db_1:/backups
Replace backupfile.sql.gz
with your actual backup file name (located at backups\last
for example)
$USERNAME
and $DBNAME
with .env
variables (DB_USER
and DB_NAME
), and also $BACKUPFILE
with previously copied file name)
docker exec --tty --interactive shared-music_db_1 /bin/sh -c "zcat backups/$BACKUPFILE | psql --username=$USERNAME --dbname=$DBNAME -W"
Enter password (DB_PASS
variable in .env
)
docker-compose up test
These tests cover:
Services and consumers tests run using InMemoryChannelLayer
.
Assuming remote host OS is Linux, and Docker, docker-compose and Git have been installed recently:
IP
is your host ip address):
ssh -l username IP
Fill in password after this command.
Follow installation guide
docker-compose -f docker-compose-deploy.yml up