1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-10 22:11:50 +02:00

Transcribe: Resolves #12831: Add support for transcribe server to the server docker compose configuration (#12832)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
pedr
2025-08-01 13:31:59 -03:00
committed by GitHub
parent 0067ac126d
commit 8b999f8dc6
9 changed files with 100 additions and 4 deletions

View File

@@ -15,6 +15,23 @@
# POSTGRES_PORT=5432
# POSTGRES_HOST=localhost
# =============================================================================
# TRANSCRIBE CONFIG EXAMPLE
# -----------------------------------------------------------------------------
# This service is not required, and it will be ignored by using --profile server
# when running docker-compose. If you want to use it, you need to set the
# following environment variables.
# =============================================================================
# TRANSCRIBE_API_KEY=secret_string_shared_between_server_and_transcribe
# TRANSCRIBE_ENABLED=true
# QUEUE_DATABASE_NAME=transcribe
# QUEUE_DATABASE_USER=transcribe
# QUEUE_DATABASE_PASSWORD=transcribe
# QUEUE_DATABASE_PORT=5431
# HTR_CLI_IMAGES_FOLDER=/home/user/images_storage
# =============================================================================
# DEV CONFIG EXAMPLE
# -----------------------------------------------------------------------------

View File

@@ -27,4 +27,5 @@ QUEUE_DRIVER=pg
QUEUE_DATABASE_NAME=transcribe
QUEUE_DATABASE_USER=transcribe
QUEUE_DATABASE_PASSWORD=transcribe
QUEUE_DATABASE_PORT=5432
QUEUE_DATABASE_PORT=5432
QUEUE_DATABASE_HOST=localhost

View File

@@ -17,11 +17,21 @@
version: '3'
networks:
app-network:
transcribe-network:
shared-network:
services:
db:
image: postgres:16
profiles:
- full
- server
volumes:
- ./data/postgres:/var/lib/postgresql/data
networks:
- app-network
ports:
- "5432:5432"
restart: unless-stopped
@@ -31,10 +41,17 @@ services:
- POSTGRES_DB=${POSTGRES_DATABASE}
app:
image: joplin/server:latest
profiles:
- full
- server
depends_on:
- db
- transcribe
ports:
- "22300:22300"
networks:
- app-network
- shared-network
restart: unless-stopped
environment:
- APP_PORT=22300
@@ -45,3 +62,48 @@ services:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=db
- TRANSCRIBE_API_KEY=${TRANSCRIBE_API_KEY}
- TRANSCRIBE_BASE_URL=http://transcribe:4567
- TRANSCRIBE_ENABLED=${TRANSCRIBE_ENABLED}
transcribe-db:
image: postgres:16
profiles:
- full
volumes:
- ./data/transcribe-postgres:/var/lib/postgresql/data
networks:
- transcribe-network
ports:
- "${QUEUE_DATABASE_PORT}:5432"
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=${QUEUE_DATABASE_PASSWORD}
- POSTGRES_USER=${QUEUE_DATABASE_USER}
- POSTGRES_DB=${QUEUE_DATABASE_NAME}
command: -p ${QUEUE_DATABASE_PORT}
transcribe:
image: joplin/transcribe:latest
profiles:
- full
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${HTR_CLI_IMAGES_FOLDER}:/app/packages/transcribe/images
depends_on:
- transcribe-db
ports:
- "4567:4567"
networks:
- transcribe-network
- shared-network
restart: unless-stopped
environment:
- APP_PORT=4567
- DB_CLIENT=pg
- QUEUE_DATABASE_NAME=${QUEUE_DATABASE_NAME}
- QUEUE_DATABASE_USER=${QUEUE_DATABASE_USER}
- QUEUE_DATABASE_PASSWORD=${QUEUE_DATABASE_PASSWORD}
- QUEUE_DATABASE_PORT=${QUEUE_DATABASE_PORT}
- QUEUE_DATABASE_HOST=transcribe-db
- API_KEY=${TRANSCRIBE_API_KEY}
- HTR_CLI_IMAGES_FOLDER=${HTR_CLI_IMAGES_FOLDER}

View File

@@ -60,7 +60,8 @@ Ensure that the provided database and user exist as Joplin Server will not creat
1. Using the [sample docker-compose file](https://raw.githubusercontent.com/laurent22/joplin/dev/docker-compose.server.yml), create a docker compose file in the location of your Docker configuration files. Example: /home/[user]/docker/docker-compose.yml
2. Update the fields in the docker-compose file as seen in the sample file.
3. Note that there is two profiles - one is `full` which runs Joplin Server and the Transcribe server, and other is `server` which is only Joplin Server.
4. To choose the profile that you want, pass for example `--profile server` when using docker compose.
## Setup reverse proxy

View File

@@ -1,10 +1,10 @@
# Installing
## Configure Docker for transcribe
## Configure Docker for Transcribe
1. Copy `.env-transcribe-sample` to the location of your Docker configuration files.
2. Rename the file `.env-transcribe-sample` to `.env-transcribe`.
3. `HTR_CLI_IMAGES_FOLDER` should be a fullpath to the folder that is going to store the images
3. `HTR_CLI_IMAGES_FOLDER` should be a full path to the folder that is going to store the images. It is an external folder, outside of the Docker container.
4. Run the following command to test starting the server using the default configuration:
```shell
@@ -15,6 +15,16 @@ docker run --env-file .env-transcribe -p 4567:4567 \
transcribe
```
## Using `docker compose`
For running with docker compose the minimal required configuration is available on `.env-sample` and `docker-compose.server.yml`.
1. Run `cp .env-sample .env`
2. Modify the options that make sense to you in the new `.env` file
3. Run `docker compose -f docker-compose.server.yml --profile full up --detached`
For further customization look at `.env-sample-transcribe`
# Setup for development
## Testing

View File

@@ -12,6 +12,7 @@ export const defaultEnvValues: EnvVariables = {
QUEUE_DATABASE_NAME: '',
QUEUE_DATABASE_USER: '',
QUEUE_DATABASE_PORT: 5432,
QUEUE_DATABASE_HOST: 'localhost',
};
export interface EnvVariables {
@@ -27,6 +28,7 @@ export interface EnvVariables {
QUEUE_DATABASE_NAME: string;
QUEUE_DATABASE_USER: string;
QUEUE_DATABASE_PORT: number;
QUEUE_DATABASE_HOST: string;
}
export function parseEnv(rawEnv: Record<string, string | undefined>): EnvVariables {

View File

@@ -15,6 +15,7 @@ const createQueue = async (envVariables: EnvVariables, isPrimary: boolean) => {
user: envVariables.QUEUE_DATABASE_USER,
password: envVariables.QUEUE_DATABASE_PASSWORD,
port: envVariables.QUEUE_DATABASE_PORT,
host: envVariables.QUEUE_DATABASE_HOST,
},
ttl: envVariables.QUEUE_TTL,
maintenanceInterval: envVariables.QUEUE_MAINTENANCE_INTERVAL,

View File

@@ -33,6 +33,7 @@ export default class PgBossQueue implements BaseQueue {
user: this.options.database.user,
password: this.options.database.password,
port: this.options.database.port,
host: this.options.database.host,
});
}

View File

@@ -115,6 +115,7 @@ export type QueueConfiguration = {
user?: string;
password?: string;
port?: number;
host?: string;
};
ttl: number;
retryCount: number;