final tweaks

This commit is contained in:
Georges-Antoine Assi
2025-06-19 09:54:00 -04:00
parent e0a1df1c6f
commit 393c886a80
4 changed files with 57 additions and 29 deletions

View File

@@ -1,8 +1,45 @@
# Setup for development environment
# Setting up RomM for development
## Environment setup
## Option 1: Using Docker
### Mocking RomM structure
If you prefer to use Docker for development, you can set up RomM using the provided Docker Compose configuration. This method simplifies the setup process by encapsulating all dependencies within Docker containers.
### Environment setup
#### Create the mock structure with at least one rom and empty config for manual testing
```sh
mkdir -p romm_mock/library/roms/switch
touch romm_mock/library/roms/switch/metroid.xci
mkdir -p romm_mock/resources
mkdir -p romm_mock/assets
mkdir -p romm_mock/config
touch romm_mock/config/config.yml
```
#### Copy env.template to .env and fill the variables
```sh
cp env.template .env
```
#### Build the image
```sh
docker compose build # or `docker compose build --no-cache` to rebuild from scratch
```
#### Spin up the Docker containers
```sh
docker compose up -d
```
And you're done! You can access the app at `http://localhost:3000`. Any changes made to the code will be automatically reflected in the app thanks to the volume mounts.
## Option 2: Manual setup
### Environment setup
#### - Create the mock structure with at least one rom and empty config for manual testing
@@ -15,8 +52,6 @@ mkdir -p romm_mock/config
touch romm_mock/config/config.yml
```
### Setting up the backend
#### - Copy env.template to .env and fill the variables
```sh
@@ -30,7 +65,8 @@ cp env.template .env
sudo apt install libmariadb3 libmariadb-dev libpq-dev pipx
# Build and configure RAHasher (optional)
# IMPORTANT! This is only required to calculate RA hashes. This is needed only if RA API is going to be enabled
# This is only required to calculate RA hashes
# Users on macOS can skip this step as RAHasher is not supported
git clone --recursive https://github.com/RetroAchievements/RALibretro.git
cd ./RALibretro
git checkout 1.8.0
@@ -65,7 +101,7 @@ If you are on Arch Linux or another Arch-based distro, you need to run the comma
CFLAGS="-Wno-error=incompatible-pointer-types" poetry sync --all-extras
```
#### - Spin up mariadb in docker
#### - Spin up the database and other services
```sh
docker compose up -d
@@ -101,8 +137,8 @@ npm install
```sh
mkdir assets/romm
ln -s ../backend/romm_mock/resources assets/romm/resources
ln -s ../backend/romm_mock/assets assets/romm/assets
ln -s ../romm_mock/resources assets/romm/resources
ln -s ../romm_mock/assets assets/romm/assets
```
#### - Run the frontend
@@ -111,11 +147,11 @@ ln -s ../backend/romm_mock/assets assets/romm/assets
npm run dev
```
### Setting up the linter
## Setting up the linter
We use [Trunk](https://trunk.io) for linting, which combines multiple linters and formatters with sensible defaults and a single configuration file. You'll need to install the Trunk CLI to use it.
#### - Install the Trunk CLI
### - Install the Trunk CLI
```sh
curl https://get.trunk.io -fsSL | bash

View File

@@ -77,7 +77,7 @@ ENV PATH="/usr/local/bin:$HOME/.local/bin:${PATH}"
COPY pyproject.toml poetry.lock* .python-version /app/
# Install Python dependencies
RUN poetry sync
RUN poetry sync --all-extras
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh

View File

@@ -33,8 +33,7 @@ services:
image: mariadb:11.3.2
container_name: romm-db-dev
restart: unless-stopped
env_file:
- .env
env_file: .env
environment:
- MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWD:-rootpassword}
- MARIADB_DATABASE=${DB_NAME:-romm}
@@ -49,8 +48,7 @@ services:
image: valkey/valkey:8
container_name: romm-valkey-dev
restart: unless-stopped
env_file:
- .env
env_file: .env
ports:
- "${REDIS_PORT:-6379}:6379"
@@ -58,8 +56,7 @@ services:
image: postgres:16-alpine
container_name: romm-postgresql-dev
restart: unless-stopped
env_file:
- .env
env_file: .env
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
@@ -74,8 +71,7 @@ services:
container_name: romm-authentik-server
restart: unless-stopped
command: server
env_file:
- .env
env_file: .env
environment:
AUTHENTIK_REDIS__HOST: romm-valkey-dev
AUTHENTIK_POSTGRESQL__HOST: romm-postgres-dev
@@ -99,8 +95,7 @@ services:
container_name: romm-authentik-worker
restart: unless-stopped
command: worker
env_file:
- .env
env_file: .env
environment:
AUTHENTIK_REDIS__HOST: romm-valkey-dev
AUTHENTIK_POSTGRESQL__HOST: romm-postgres-dev

View File

@@ -1,16 +1,12 @@
#!/bin/bash
set -e
# Copy env template if .env doesn't exist
if [[ ! -f /app/.env ]]; then
cp /app/env.template /app/.env
echo "Created .env file from template. Please edit with your configuration."
fi
echo "Starting entrypoint script..."
# Create symlinks for frontend
mkdir -p /app/frontend/assets/romm
ln -sf /app/romm_mock/resources /app/frontend/assets/romm/resources
ln -sf /app/romm_mock/assets /app/frontend/assets/romm/assets
ln -sf /app/romm/resources /app/frontend/assets/romm/resources
ln -sf /app/romm/assets /app/frontend/assets/romm/assets
# Define a signal handler to propagate termination signals
function handle_termination() {
@@ -21,6 +17,7 @@ function handle_termination() {
# Trap SIGTERM and SIGINT signals
trap handle_termination SIGTERM SIGINT
# Start all services in the background
cd /app/backend
poetry run python main.py &