浏览代码

hotfix: roll back and add back permissions a+rwx to app-data folder

Nicolas Meienberger 1 年之前
父节点
当前提交
a0f5d07df1

+ 9 - 0
packages/cli/src/executors/app/app.executors.ts

@@ -1,11 +1,15 @@
 import fs from 'fs';
 import path from 'path';
+import { exec } from 'child_process';
+import { promisify } from 'util';
 import { getEnv } from '@/utils/environment/environment';
 import { pathExists } from '@/utils/fs-helpers';
 import { compose } from '@/utils/docker-helpers';
 import { copyDataDir, generateEnvFile } from './app.helpers';
 import { fileLogger } from '@/utils/logger/file-logger';
 
+const execAsync = promisify(exec);
+
 export class AppExecutors {
   private readonly logger;
 
@@ -143,6 +147,8 @@ export class AppExecutors {
 
   public startApp = async (appId: string, config: Record<string, unknown>) => {
     try {
+      const { appDataDirPath } = this.getAppPaths(appId);
+
       this.logger.info(`Starting app ${appId}`);
 
       this.logger.info(`Regenerating app.env file for app ${appId}`);
@@ -151,6 +157,9 @@ export class AppExecutors {
       await compose(appId, 'up --detach --force-recreate --remove-orphans');
 
       this.logger.info(`App ${appId} started`);
+
+      await execAsync(`chmod -R a+rwx ${path.join(appDataDirPath)}`).catch(() => {});
+
       return { success: true, message: `App ${appId} started successfully` };
     } catch (err) {
       return this.handleAppError(err);

+ 2 - 0
packages/cli/src/executors/system/system.executors.ts

@@ -116,6 +116,8 @@ export class SystemExecutors {
         }
       }),
     );
+
+    await execAsync(`sudo chmod -R a+rwx ${path.join(rootFolderHost, 'app-data')}`);
   };
 
   public systemInfo = async () => {