Skip to content

Commit

Permalink
fix(server): fix db export/import
Browse files Browse the repository at this point in the history
  • Loading branch information
0fatal committed Apr 3, 2024
1 parent b61a60c commit 52613ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ RUN apt-get install -y openssl wget libkrb5-dev

ARG TARGETARCH

RUN export MONGO_TOOLS=mongodb-database-tools-ubuntu1804-$( [ "$TARGETARCH" = "amd64" ] && echo "x86_64" || echo "arm64" )-100.8.0 && \
wget https://fastdl.mongodb.org/tools/db/${MONGO_TOOLS}.tgz && \
tar -zxvf ${MONGO_TOOLS}.tgz -C /usr/local/ --strip-components=1 ${MONGO_TOOLS}/bin/ && \
rm -rf ${MONGO_TOOLS}.tgz $MONGO_TOOLS

WORKDIR /app

EXPOSE 3000
Expand Down
2 changes: 1 addition & 1 deletion server/src/database/database.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { ImportDatabaseDto } from './dto/import-database.dto'
import { InjectUser } from 'src/utils/decorator'
import { UserWithKubeconfig } from 'src/user/entities/user'
import { ResponseUtil } from 'src/utils/response'
import path from 'path'
import * as path from 'path'
import * as os from 'os'
import { createReadStream, existsSync, mkdirSync } from 'fs'
import { unlink, writeFile } from 'fs/promises'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class DedicatedDatabaseService {
if (!dedicatedDatabase) {
throw new Error(`database ${appid} not found`)
}
const connectionUri = this.getConnectionUri(user, dedicatedDatabase)
const connectionUri = await this.getConnectionUri(user, dedicatedDatabase)
assert(connectionUri, `database ${appid} connection uri not found`)

let syncId: ObjectId
Expand Down Expand Up @@ -309,7 +309,7 @@ export class DedicatedDatabaseService {
if (!dedicatedDatabase) {
throw new Error(`database ${appid} not found`)
}
const connectionUri = this.getConnectionUri(user, dedicatedDatabase)
const connectionUri = await this.getConnectionUri(user, dedicatedDatabase)
assert(connectionUri, `database ${appid} connection uri not found`)

let syncId: ObjectId
Expand Down

0 comments on commit 52613ab

Please sign in to comment.