This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Running the app

Getting AudioBookRequest up and running.

The app has a docker image that simplifies the deployment. The preferred methods of running the application all revolve around running the Docker image in different ways.

Select the method you want to use to deploy below or if your tool is not listed (for example Portainer), head to the docker page.

1 - Docker

How to get started using Docker.

If you prefer to run the app manually with docker, you can simply run the following command:

docker run -p 8000:8000 -v $(pwd)/config:/config markbeep/audiobookrequest:1

This will start the container on port 8000 and create the config/ directory in your current working directory.

The above command might break on Windows. Instead, use ${PWD}\config:/config ... in PowerShell or %cd%\config:/config ... in Windows Command Prompt.

2 - Docker Compose

How to get started using Docker-Compose.

Docker-compose works the similar way as Docker.

The basic docker compose file is as follows:

services:
  web:
    image: markbeep/audiobookrequest:1
    ports:
      - '8000:8000'
    volumes:
      - ./config:/config

If you want to add any environment variables, you can add them as explained here. It would look along the lines of this:

services:
  web:
    image: markbeep/audiobookrequest:1
    ports:
      - '8000:5432'
    volumes:
      - ./config:/config
    environment:
      ABR_APP__PORT: 5432
      ABR_APP__OPENAPI_ENABLED: true

3 - Kubernetes

How to get started using Kubernetes.

Here’s an example for a kubernetes deployment file you’d use:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: audiobookrequest
  labels:
    app: audiobookrequest
spec:
  replicas: 1
  selector:
    matchLabels:
      app: audiobookrequest
  template:
    metadata:
      labels:
        app: audiobookrequest
    spec:
      containers:
        - name: audiobookrequest
          image: markbeep/audiobookrequest:1
          imagePullPolicy: Always
          volumeMounts:
            - mountPath: /config
              name: abr-config
          ports:
            - name: http-request
              containerPort: 8000
      volumes:
        - name: abr-config
          hostPath:
            path: /mnt/disk/AudioBookRequest/

For the volume you can assign it a host path on a node, or assign it to a PVC.

4 - Bare Metal

How to get started without Docker.

To run ABR locally without Docker, the same steps as for the local development have to be followed. First, follow the instructions to get local development working.

Once local development works, there are a few adjustments that have to be made to run the app in production mode instead of debug/local mode.

  1. Delete the .env.local file or delete all contents in it.
  2. Run the python script to fetch and download all required javascript files: uv run python /app/util/fetch_js.py. This should populate your static/ directory with some new js files.
  3. Instead of running fastapi dev you want to execute fastapi start to start the webserver.
  4. Create a file called .env and place any environment variables you want to set in there.
  5. If you intend to change the port (documented as the env variable ABR_APP__PORT), you’ll have to run fastapi with the --port <PORT> flag:
    fastapi run --port 5432
    

With these changes your deployment will be running in production mode.