-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding flowise service, scaffold script
- Loading branch information
Showing
9 changed files
with
204 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// deno run -A ./.scripts/scaffold.ts <handle> | ||
|
||
import { parse } from "https://deno.land/std/flags/mod.ts"; | ||
import { ensureDir } from "https://deno.land/std/fs/mod.ts"; | ||
import { join } from "https://deno.land/std/path/mod.ts"; | ||
|
||
const composeTemplate = (handle: string) => { | ||
const envPrefix = `HARBOR_${handle.toUpperCase()}_`; | ||
|
||
return ` | ||
services: | ||
${handle}: | ||
container_name: \${HARBOR_CONTAINER_PREFIX}.${handle} | ||
image: \${${envPrefix}IMAGE}:\${${envPrefix}VERSION} | ||
env_file: | ||
- ./.env | ||
- ${handle}/override.env | ||
networks: | ||
- harbor-network | ||
`; | ||
}; | ||
|
||
const envTemplate = (handle: string) => ` | ||
# This file can be used for additional environment variables | ||
# specifically for the '${handle}' service. | ||
# You can also use the "harbor env" command to set these variables. | ||
`; | ||
|
||
async function scaffold(handle: string) { | ||
try { | ||
// Validate handle | ||
if (!handle.match(/^[a-z0-9-]+$/)) { | ||
throw new Error( | ||
"Handle must contain only lowercase letters, numbers, and hyphens" | ||
); | ||
} | ||
|
||
// Create directory | ||
const dirPath = join(Deno.cwd(), handle); | ||
await ensureDir(dirPath); | ||
|
||
// Create compose file | ||
const composePath = join(Deno.cwd(), `compose.${handle}.yml`); | ||
await Deno.writeTextFile(composePath, composeTemplate(handle)); | ||
|
||
// Create env file | ||
const envPath = join(dirPath, "override.env"); | ||
await Deno.writeTextFile(envPath, envTemplate(handle)); | ||
|
||
console.log(`Successfully created scaffold for '${handle}'`); | ||
} catch (error) { | ||
console.error("Error:", error.message); | ||
Deno.exit(1); | ||
} | ||
} | ||
|
||
// Parse command line arguments | ||
const args = parse(Deno.args); | ||
const handle = args._[0]; | ||
|
||
if (!handle) { | ||
console.error("Please provide a handle argument"); | ||
Deno.exit(1); | ||
} | ||
|
||
await scaffold(String(handle)); |
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,15 @@ | ||
|
||
services: | ||
flowise: | ||
container_name: ${HARBOR_CONTAINER_PREFIX}.flowise | ||
image: ${HARBOR_FLOWISE_IMAGE}:${HARBOR_FLOWISE_VERSION} | ||
ports: | ||
- ${HARBOR_FLOWISE_HOST_PORT}:3000 | ||
volumes: | ||
# Persistence | ||
- ${HARBOR_FLOWISE_WORKSPACE}:/root/.flowise | ||
env_file: | ||
- ./.env | ||
- flowise/override.env | ||
networks: | ||
- harbor-network |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
data/ |
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,4 @@ | ||
|
||
# This file can be used for additional environment variables | ||
# specifically for the 'flowise' service. | ||
# You can also use the "harbor env" command to set these variables. |
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