/rainfall

Bandcamp exodus solution, letting you create personal artist sites using Faircamp

Primary LanguagePythonMIT LicenseMIT

Rainfall

Free Bandcamp exodus tool, letting you publish music sites to Netlify using Faircamp.

GitHub build status codecov GitHub License

This project does not aim to replicate the full feature set of the Bandcamp site/app. Instead, the goal is to allow artists to create individual websites where users can listen to and potentially download and pay for their tracks. These websites are created using the Faircamp static site generator, and can be hosted anywhere on the web.

Rainfall has reached version 1.0 of development!

Screenshot of the Rainfall tool, on the song upload page

Currently, you can upload tracks and preview your Faircamp powered site. When you're ready, you can download a .ZIP file of your site, which you can then upload to any of the cloud providers mentioned on the welcome page, or anywhere else that hosts static websites:

Future plans are to integrate with these providers, specifically Netlify, so that you can immediately upload your new website and host it for free under an account that you control. Even more future integrations might allow you to purchase a domain name through Netlify and go from zero -> running music site with just a few uploads.

Development

Rainfall features a Python backend, using the amazing Flask API framework and the SQLAlchemy ORM (which is much less scary than it seems at first). The database system is SQLite. It is tested using Pytest.

The frontend is written in Vue 3 using the Options API, with frontend styling implemented using TailwindCSS and some Flowbite components. It is tested using Cypress.

For development, you will need a .env file in the project root directory, and a .env.development file in the rainfall-frontend directory. The project directory may also contain a .env.prod file, but this is never loaded, it is purely for reference. Production environment variables are set using Fly.io secrets.

Running Tests

Backend

From the project root, run:

RAINFALL_ENV=test pipenv run pytest

Frontend

From the rainfall-frontend directory, run:

yarn run test:e2e:dev

Deployment

Rainfall is deployed to Fly.io using a Docker container. Once you have installed flyctl and authenticated, simply run the following:

fly deploy

The frontend also requires a .env.production file with the fields GOOGLE_CLIENT_ID and VITE_GOOGLE_REDIRECT_URI. This will be ignored by git, but needs to be present when fly deploy is run so that it is baked into the frontend production deployment.

The docker container will automatically be built remotely and deployed. The backend data for the production site (SQLite db and song/project files) lives on a Fly volume that is attached to the web worker.

Running Database migrations

First, make sure the web app is running (not sleeping) by visiting the Rainfall homepage (https://rainfall.dev).

Then, log into the machine using fly ssh (first setting it up with a key if you need to):

fly ssh console

Finally run the alembic command:

pipenv run alembic upgrade head