Ross Gerbasi
06/20/2022, 9:27 PMsst.local.json
haha... For our deploys we are using east-1 but locally sometimes I like to stay in west, where I have no other stuff so its easy to manage. I only know of sst.json
and then package.json
I could add region to my scripts, but both of those are shared files. Any other ways override?Mischa Spiegelmock
06/20/2022, 9:58 PMthdxr
06/20/2022, 11:20 PMthdxr
06/20/2022, 11:21 PMRoss Gerbasi
06/20/2022, 11:52 PMAWS_REGION
locally does it override sst.json
? Still not totally ideal though as I would like to have per project control. Maybe we could provide sst.config.js
that returns the same data as sst.json
at least then I could check envs? 🤷♂️thdxr
06/21/2022, 12:46 AMthdxr
06/21/2022, 12:46 AMthdxr
06/21/2022, 12:46 AMMischa Spiegelmock
06/21/2022, 1:54 AM"deploy:test": "AWS_PROFILE=platform-dev npm run deploy -- --stage test --region eu-west-1 ",
"deploy:prod": "AWS_PROFILE=platform-prod npm run deploy -- --stage prod --region us-east-1 ",
wack because:
1. shit in package.json scripts is unreadable
2. --stage
is a CLI flag but profile is a env var (Serverless lets you specify both as CLI flags)
3. if i want to run other commands (e.g. remove
) on these stages I have to set the profile manually and the scripts don't helpthdxr
06/21/2022, 2:12 AMthdxr
06/21/2022, 2:12 AMthdxr
06/21/2022, 2:12 AMRoss Gerbasi
06/21/2022, 2:14 AMpackage.json
is shared so as soon as another dev on the team wants to test in east-2 they have to muck with it and then remember to revert before check in.Mischa Spiegelmock
06/21/2022, 2:15 AMthdxr
06/21/2022, 2:19 AM.sst/
is kinda where I planned to put all local specific configthdxr
06/21/2022, 2:19 AMMischa Spiegelmock
06/21/2022, 2:20 AMMischa Spiegelmock
06/21/2022, 2:20 AMMischa Spiegelmock
06/21/2022, 2:21 AMMischa Spiegelmock
06/21/2022, 2:22 AMRoss Gerbasi
06/21/2022, 2:23 AM.sst
folder is possible but also a bit odd. Just because it has always seemed to be a "managed" folder, gitignored and controlled by sst. So as a first time dev/clone process if i wanna dev on a different region then whats in sst.json
I would need to create a .sst
folder and add something in it before running start or deployMischa Spiegelmock
06/21/2022, 2:24 AMMischa Spiegelmock
06/21/2022, 2:24 AMRoss Gerbasi
06/21/2022, 2:24 AMsst.config.t/js
seems like a pretty easy winthdxr
06/21/2022, 2:24 AMthdxr
06/21/2022, 2:24 AMthdxr
06/21/2022, 2:24 AMthdxr
06/21/2022, 2:24 AMthdxr
06/21/2022, 2:24 AMMischa Spiegelmock
06/21/2022, 2:25 AMRoss Gerbasi
06/21/2022, 2:25 AMRoss Gerbasi
06/21/2022, 2:25 AMdefineConfig
seems to be the thing if you wanna get completion as wellthdxr
06/21/2022, 2:27 AMRoss Gerbasi
06/21/2022, 2:27 AMimport { defineConfig } from '@serverless-stack/cli'
export default defineConfig({
name: 'my-project',
region: 'us-east-1',
main: 'stacks/index.js',
})
ishthdxr
06/21/2022, 2:27 AMthdxr
06/21/2022, 2:28 AMthdxr
06/21/2022, 2:28 AMRoss Gerbasi
06/21/2022, 2:28 AMdotenv
read whatever they wanna swapRoss Gerbasi
06/21/2022, 2:29 AM.env.local
with a REGION
and plop it in there if it existsRoss Gerbasi
06/21/2022, 2:31 AM.env
file just add ENVIRONMENT
as an env and then just pass in whatever stuff you need.Mischa Spiegelmock
06/21/2022, 2:31 AMMischa Spiegelmock
06/21/2022, 2:32 AMFrank
Ross Gerbasi
06/21/2022, 2:37 AMimport 'dotenv/config'
import { defineConfig } from '@serverless-stack/cli'
const config = {
name: 'my-project',
region: 'us-east-1',
profile: 'my-main-aws-profile',
main: 'stacks/index.js',
}
export default defineConfig(
process.env.ENVIRONMENT === 'test'
? Object.assign(config, {
region: 'us-west-1',
profile: 'my-second-aws-profile',
})
: config,
)
Then something like cross-env ENVIRONMENT=TEST && npx sst deploy
Ross Gerbasi
06/21/2022, 2:37 AMRoss Gerbasi
06/21/2022, 2:39 AMcross-env
if its always a local vs CI/CD thing/ so .env.local
has one environment then maybe .env.prod.local
if you're doing prod deploys elsewhere. I would think the normal .env.$STAGE.local
or .env.$STAGE
would give ya a bunch of optionsMischa Spiegelmock
06/21/2022, 2:40 AMRoss Gerbasi
06/21/2022, 2:41 AM