-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #252 from linz/feat/configure-temp-folder
Feat/configure temp folder
- Loading branch information
Showing
7 changed files
with
107 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const MountDevice = `xvdz`; | ||
const MountFolder = '/scratch'; | ||
const MountFolderScript = `MIME-Version: 1.0 | ||
Content-Type: multipart/mixed; boundary="==MYBOUNDARY==" | ||
--==MYBOUNDARY== | ||
Content-Type: text/x-shellscript; charset="us-ascii" | ||
#!/bin/bash | ||
mkfs.ext4 /dev/${MountDevice} | ||
mkdir ${MountFolder} | ||
mount /dev/${MountDevice} ${MountFolder} | ||
service docker restart | ||
--==MYBOUNDARY==`; | ||
|
||
export const ScratchData = { | ||
/** Device name `xvdz` */ | ||
Device: MountDevice, | ||
/** Folder where device is mounted @default /scratch */ | ||
Folder: MountFolder, | ||
UserData: Buffer.from(MountFolderScript).toString('base64'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as path from 'path'; | ||
import { Env } from '@basemaps/shared'; | ||
import { promises as fs } from 'fs'; | ||
|
||
/** Make a temp folder inside TEMP_FOLDER's path */ | ||
export async function makeTempFolder(folder: string): Promise<string> { | ||
const tempPath = Env.get(Env.TempFolder, '/tmp'); | ||
const folderPath = path.join(tempPath, folder); | ||
|
||
await fs.mkdir(folderPath, { recursive: true }); | ||
return folderPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters