Skip to content

Commit

Permalink
fix(server): allow starting backup through API and fix pg_dumpall arg…
Browse files Browse the repository at this point in the history
…s when using database URLs (#13970)

* fix(server): allow starting backup through API

* fix(server): fix pg_dumpall args when using database URLs

The database has to be specified using `-d`, unlike for pg_dump.
  • Loading branch information
dotlambda authored Nov 7, 2024
1 parent be2b76b commit f4741c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion server/src/services/backup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class BackupService extends BaseService {
} = this.configRepository.getEnv();

const isUrlConnection = config.connectionType === 'url';
const databaseParams = isUrlConnection ? [config.url] : ['-U', config.username, '-h', config.host];
const databaseParams = isUrlConnection ? ['-d', config.url] : ['-U', config.username, '-h', config.host];
const backupFilePath = path.join(
StorageCore.getBaseFolder(StorageFolder.BACKUPS),
`immich-db-backup-${Date.now()}.sql.gz.tmp`,
Expand Down
4 changes: 4 additions & 0 deletions server/src/services/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ export class JobService extends BaseService {
return this.jobRepository.queue({ name: JobName.LIBRARY_QUEUE_SYNC_ALL, data: { force } });
}

case QueueName.BACKUP_DATABASE: {
return this.jobRepository.queue({ name: JobName.BACKUP_DATABASE, data: { force } });
}

default: {
throw new BadRequestException(`Invalid job name: ${name}`);
}
Expand Down

0 comments on commit f4741c7

Please sign in to comment.