Production environment
It is recommended to deploy RadioWeb using its Docker images. The following guide will help you deploy the images using Docker Compose.
Hardware requirements
RadioWeb is generally lightweight and does not require a large amount of compute resources.
To ensure a good end-user experience, we recommend running the stack on a server or VM with at least:
- 2 vCPU cores
- 2 GB RAM (or more)
Depending on your needs, you can either:
- Run frontend, backend, database, and storage bucket on the same server
- Run each part on separate servers/services
Both approaches are valid, but capacity planning must account for your topology. In particular, ensure sufficient storage for both:
- The MySQL database
- The S3 bucket storage
Building the Docker images
cd frontend
docker build --build-arg VITE_API_URL="https://api.domain.com" -t radioweb:frontend .INFO
Build argument VITE_API_URL has to be defined at the moment of building the Docker image so Vite can "hardcode" the API URL.
cd backend
docker build -t radioweb:backend .Deploying using Docker Compose
Use the following Docker Compose file as a template for deployment.
services:
radioweb-frontend:
image: radioweb:frontend
container_name: radioweb_frontend
hostname: frontend
ports:
- "80:8080"
depends_on:
- radioweb-backend
radioweb-backend:
image: radioweb:backend
container_name: radioweb_backend
hostname: backend
ports:
- "3000:3000"
environment:
DB_HOST: db
DB_PORT: 3306
DB_USER: radioweb_user
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: radioweb_db
S3_ENDPOINT: http://s3:9000
S3_PUBLIC_ENDPOINT: http://localhost:9000
S3_ACCESS_KEY_ID: radioweb_access_key
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
S3_BUCKET_NAME: radiowebbucket
S3_REGION: ca-central-1
CORS_ORIGINS: http://localhost
JWT_SECRET: ${JWT_SECRET}
OPENAI_API_KEY: ${OPENAI_API_KEY}
OPENAI_MODEL: gpt-4o
depends_on:
mysql:
condition: service_healthy
s3:
condition: service_healthy
mysql:
image: mysql:9.6.0
container_name: radioweb_db
hostname: db
ports:
- "3306:3306"
healthcheck:
test:
[
"CMD-SHELL",
"mysql -h 127.0.0.1 -u radioweb_user -p$${MYSQL_PASSWORD} -e \"USE radioweb_db; SELECT 1;\"",
]
start_period: 45s
interval: 10s
timeout: 5s
retries: 3
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: radioweb_db
MYSQL_USER: radioweb_user
MYSQL_PASSWORD: ${DB_PASSWORD}
s3:
image: rustfs/rustfs:latest
container_name: radioweb_s3
hostname: s3
ports:
- "9000:9000"
- "9001:9001"
healthcheck:
test: ["CMD", "sh", "-c", "curl -f http://localhost:9000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
environment:
RUSTFS_ACCESS_KEY: radioweb_access_key
RUSTFS_SECRET_KEY: ${S3_SECRET_ACCESS_KEY}
RUSTFS_REGION: ca-central-1Important environment variables
Depending on the URL of your frontend and backend servers, adjust the CORS_ORIGINS variable and VITE_API_URL (the latter when building the frontend Docker image). Further ensure the database and storage bucket variables are adequat.
IMPORTANT
JWT_SECRET environment variable
It is imperative to generate a secure and robust JWT_SECRET, as it is the foundation of the authentification process.
For instance, use openssl to generate a robust value.
openssl rand -hex 64Protect this secret like it is gold (because it is). Never share it. Only store it on the machine that will execute the server.
Management of secrets
Use your deployment's secrets system for sensitve environment variables (JWT_SECRET, S3_SECRET_ACCESS_KEY, DB_PASSWORD).
For Docker Compose, put them in a .env file in the same directory in which you execute docker compose.
JWT_SECRET=pleasechangemeineedtobechangedforpetesake
S3_SECRET_ACCESS_KEY=radioweb_secret_key
DB_PASSWORD=mysqlsecretpassword
OPENAI_API_KEY=your-open-api-key-here-please-never-commit-itDatabase and storage bucket
The application relies on an AWS S3 storage bucket to store files and a MySQL relational database for storing any other relevant information. In the present guide, we will showcase how to deploy the whole stack using Docker Compose. However, you can deploy the application with any instances of MySQL/S3.
Creating the bucket
IMPORTANT
By default, in a production environnement, RadioWeb will not create a storage bucket at startup. Ensure you define the bucket before attempting to start the backend. This step should not be necessary when using an actual instance of AWS S3.
Launch RustFS
docker compose up s3Go to http://localhost:9001, enter credentials and create bucket.
Stop RustFS with ctrl+c or
docker compose downStarting the rest of the project
Simply restart all services
docker compose up [-d]On deploying with TLS (HTTPS)
RadioWeb does not allow the user to provide a TLS certificate in order to communicate between the client and server using HTTPS.
It is however highly recommended that you secure the connection with the end-user. Consider deploying using a reverse-proxy, such as Caddy or Traefik.
Using the app
Navigate to http://localhost:80 and use the default admin user radioweb and password radiowebpass. You can also use the self-service sign up page.