-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create infra and deployment commands
- Loading branch information
1 parent
f169674
commit 1cee96a
Showing
19 changed files
with
143 additions
and
32 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
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,18 @@ | ||
import { Command } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
|
||
export default class DeployApp extends Command { | ||
static description = 'Get currently selected ENV stage'; | ||
|
||
static examples = [`$ saas aws bootstrap`]; | ||
|
||
async run(): Promise<void> { | ||
await initConfig(this, { requireAws: true }); | ||
|
||
await runCommand('pnpm', ['nx', 'run', 'backend:deploy']); | ||
await runCommand('pnpm', ['nx', 'run', 'workers:deploy']); | ||
await runCommand('pnpm', ['nx', 'run', 'webapp:deploy']); | ||
} | ||
} |
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
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,33 @@ | ||
import { Command, Flags } from '@oclif/core'; | ||
|
||
import { initConfig } from '../config/init'; | ||
import { runCommand } from '../lib/runCommand'; | ||
|
||
export default class Deploy extends Command { | ||
static description = 'Starts both backend and frontend'; | ||
|
||
static examples = [`$ <%= config.bin %> <%= command.id %>`]; | ||
|
||
static flags = { | ||
diff: Flags.boolean({ | ||
default: false, | ||
description: | ||
'Perform a dry run and list all changes that would be applied in AWS account', | ||
required: false, | ||
}), | ||
}; | ||
|
||
async run(): Promise<void> { | ||
const { flags } = await this.parse(Deploy); | ||
await initConfig(this, { requireAws: true }); | ||
|
||
const verb = flags.diff ? 'diff' : 'deploy'; | ||
await runCommand('pnpm', [ | ||
'nx', | ||
'run-many', | ||
'--output-style=stream', | ||
`--target=${verb}`, | ||
'--projects=backend,workers,webapp', | ||
]); | ||
} | ||
} |
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,22 @@ | ||
import { Command } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
|
||
export default class InfraBootstrap extends Command { | ||
static description = | ||
'Bootstrap infrastructure in AWS account by creating resources necessary to start working with SaaS ' + | ||
'Boilerplate'; | ||
|
||
static examples = [`<%= config.bin %> <%= command.id %>`]; | ||
|
||
async run(): Promise<void> { | ||
await initConfig(this, { | ||
requireAws: true, | ||
validateEnvStageVariables: false, | ||
}); | ||
|
||
await runCommand('pnpm', ['nx', 'run', 'tools:bootstrap-infra']); | ||
await runCommand('pnpm', ['nx', 'run', 'infra-shared:bootstrap']); | ||
} | ||
} |
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,33 @@ | ||
import { Command, Flags } from '@oclif/core'; | ||
|
||
import { initConfig } from '../../config/init'; | ||
import { runCommand } from '../../lib/runCommand'; | ||
|
||
export default class InfraDeploy extends Command { | ||
static description = | ||
'Deploy infrastructure of a currently selected environment stage to AWS account'; | ||
|
||
static examples = [`$ <%= config.bin %> <%= command.id %>`]; | ||
|
||
static flags = { | ||
diff: Flags.boolean({ | ||
default: false, | ||
description: | ||
'Perform a dry run and list all changes that would be applied', | ||
required: false, | ||
}), | ||
}; | ||
|
||
async run(): Promise<void> { | ||
const { flags } = await this.parse(InfraDeploy); | ||
await initConfig(this, { requireAws: true }); | ||
|
||
const verb = flags.diff ? 'diff' : 'deploy'; | ||
await runCommand('pnpm', ['nx', 'run', `infra-shared:${verb}:global`]); | ||
await runCommand('pnpm', ['nx', 'run', `infra-shared:${verb}:main`]); | ||
await runCommand('pnpm', ['nx', 'run', `infra-shared:${verb}:db`]); | ||
await runCommand('pnpm', ['nx', 'run', `infra-functions:${verb}`]); | ||
await runCommand('pnpm', ['nx', 'run', `infra-shared:${verb}:ci`]); | ||
await runCommand('pnpm', ['nx', 'run', `infra-shared:${verb}:components`]); | ||
} | ||
} |
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
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