Demonstration of an open source music streaming service, band page or record store.
This is a front end example APP, that utilises the core functionality of YAMS, which is provided in a separate open source yams core engine
You are welcome to use this project as the basis for your very own yet another music service.
After forking this repository, you probably want to :
- Create your own
front_page
andabout
pages.
These can be found under : app/views/pages
The whole app can be spun up on your host using Docker - see the provided Docker compose setup.
The following instructions are for a non docker install or for a development setup.
This application requires:
- Ruby > 2.7
- ElasticSearch, Kibana - Installation instructions - or see docker section below.
- Postgres, Sidekiq and Redis
You will also need a Javascript runtime - see : https://github.com/rails/execjs Node.js (v14) is usually a good option : https://github.com/nodesource/distributions/blob/master/README.md
To manage javascript assets, we use webpacker and yarn
Yarn Installation instructions
The following packages have been added to this project
./bin/rails hotwire:install
./bin/rails stimulus:install
./bin/rails active_storage:install
yarn add bootstrap
yarn add @popperjs/core
yarn add turbolinks
yarn add dropzone
yarn add select2
yarn add @hotwired/stimulus-webpack-helpers
yarn add jquery
yarn add @rails/ujs
Various features of Active Storage depend on third-party software which must be installed separately:
Audio processing requires ffmpeg
For Ubuntu
sudo apt install ffmpeg
Image uploads require libvips v8.6+ or ImageMagick for analysis and transformations.
For Ubuntu
sudo apt-get install imagemagick
In your cloned project, install the gems and dependencies :
bundle install
yarn install
The suite of additional services can also be spun up using Docker and accessed by the app.
The .env file can be used to configure certain aspects of the setup - see .env.example
Database connection details can be set in here, or in Rails encrypted secrets - see config/database.yml
Uploaded image and audio files are stored using Active Storage.
In config/environments/development.rb the service is set to :local
by default, and the local storage path
is defined by ENV : YAMS_LOCAL_STORAGE_PATH
In Production, follow Active Storage's usual configuration and set your preferred cloud storage in : config/storage.yml
Can be configured in the initializer : 'config/initializers/yams_audio_engine.rb'
YamsAudioEngine::Config.configure do |config|
# Waveform colors.
#
config.wave_color = '#f7931a'
config.progress_color = '#f2a900'
config.cursor_color = '#010101'
end
A Dockerfile and docker-compose file are provided to simplify installation.
The complete stack, for a development
container, can be spun up with a single thor command :
bundle exec thor yams:docker:dev
Pass --init
if you would like to also create and seed the DB.
Elastic Search container may exit first time, with log containing :
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
RESOLUTION : Run :
sudo sysctl -w vm.max_map_count=262144
Elastic search will be available at : http://localhost:9200
Kibana will be available at : http://localhost:5601
Sidekick configuration, including list of queues to start can found here : docker/config/sidekiq.yml
In development you can use Foreman to start all of the processes associated with the app and display stdout and stderr of each process.
This should not go in Gemfile - so install manually.
gem install foreman
To start all servers :
foreman start -f Procfile.dev
Otherwise, start the web server on port 3000
bundle exec rails server
And start the webpacker server
bin/webpack-dev-server
To manually install Redis locally see : https://redis.io/topics/quickstart
To start locally, run from the root of the application:
redis-server
bundle exec sidekiq
If using the docker install, the DB container should be ready to use,if you wish to use the seed data, open a bash sh in the container and jump to the section Seed the DB
docker exec -ti development bash
For manual installs, we use .env to manage configuration, including DB access.
Copy .env.example to .env and edit, supplying your DB credentials. Current config is setup to use postgres.
Standard Rails DB stuff applies to create, migrate and seed the DB.
rake db:create
rake db:migrate
The admin user is created via db:seed
task. You can specify the email and password in .env
In development seed will also create an artist User
email: '[email protected]' password: 'artist_change_me'
rails db:seed
Audio files and associated details can be bulk uploaded from an Excel spreadsheet containing details of tracks and covers.
There is a starter pack of music and images available for free, by visiting this link
If download does not start automatically, there should be a Download button top right.
Save zip and extract contents to /tmp
on your local hard drive:
If you save elsewhere, open up the loading spreadsheet,
db/seed/aqwan_tracks.xls
, and change the/tmp
path that's hardcoded in there.
The development artist user is assigned by default in the spreadsheet, again edit in the spreadsheet to change.
Run
thor yams:db:seed_music
This is essentially a wrapper around an Excel import tool for Rails.
If you want to load your own, the raw command would be :
thor datashift:import:excel -i <spreedsheet>.xls -m Track -c lib/tasks/config/track_import.yaml
If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
@copyright aqwan @ autotelik
open source