Skip to content

Commit ddfcd1a

Browse files
authored
Merge pull request #2753 from MichalMaciejKowal/2731-wrong-extension-for-mongo-backup-file
fix: Remove .sql for mongo backup file name
2 parents 3d48b25 + 401b177 commit ddfcd1a

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ pnpm run dokploy:build
9999

100100
## Docker
101101

102-
To build the docker image
102+
To build the docker image first run commands to copy .env files
103+
104+
```bash
105+
cp apps/dokploy/.env.production.example .env.production
106+
cp apps/dokploy/.env.production.example apps/dokploy/.env.production
107+
```
108+
109+
then run build command
103110

104111
```bash
105112
pnpm run docker:build

packages/server/src/utils/backups/compose.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const runComposeBackup = async (
1919
const project = await findProjectById(environment.projectId);
2020
const { prefix, databaseType, serviceName } = backup;
2121
const destination = backup.destination;
22-
const backupFileName = `${new Date().toISOString()}.sql.gz`;
22+
const backupFileName = `${new Date().toISOString()}.${databaseType === "mongo" ? "bson" : "sql"}.gz`;
2323
const s3AppName = serviceName ? `${appName}_${serviceName}` : appName;
2424
const bucketDestination = `${s3AppName}/${normalizeS3Path(prefix)}${backupFileName}`;
2525
const deployment = await createDeploymentBackup({

packages/server/src/utils/backups/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ export const keepLatestNBackups = async (
135135
const appName = getServiceAppName(backup);
136136
const backupFilesPath = `:s3:${backup.destination.bucket}/${appName}/${normalizeS3Path(backup.prefix)}`;
137137

138-
// --include "*.sql.gz" or "*.zip" ensures nothing else other than the dokploy backup files are touched by rclone
139-
const rcloneList = `rclone lsf ${rcloneFlags.join(" ")} --include "*${backup.databaseType === "web-server" ? ".zip" : ".sql.gz"}" ${backupFilesPath}`;
138+
// --include "*.bson.gz" or "*.sql.gz" or "*.zip" ensures nothing else other than the dokploy backup files are touched by rclone
139+
const rcloneList = `rclone lsf ${rcloneFlags.join(" ")} --include "*${backup.databaseType === "web-server" ? ".zip" : ".{sql.gz,bson.gz}"}" ${backupFilesPath}`;
140140
// when we pipe the above command with this one, we only get the list of files we want to delete
141141
const sortAndPickUnwantedBackups = `sort -r | tail -n +$((${backup.keepLatestCount}+1)) | xargs -I{}`;
142142
// this command deletes the files

packages/server/src/utils/backups/mongo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const runMongoBackup = async (mongo: Mongo, backup: BackupSchedule) => {
1616
const project = await findProjectById(environment.projectId);
1717
const { prefix } = backup;
1818
const destination = backup.destination;
19-
const backupFileName = `${new Date().toISOString()}.sql.gz`;
19+
const backupFileName = `${new Date().toISOString()}.bson.gz`;
2020
const bucketDestination = `${appName}/${normalizeS3Path(prefix)}${backupFileName}`;
2121
const deployment = await createDeploymentBackup({
2222
backupId: backup.backupId,

0 commit comments

Comments
 (0)