-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dev env setup, deployment, debug etc. (#2)
feat: add dev env setup, deployment, debug etc.
- Loading branch information
Showing
38 changed files
with
678 additions
and
141 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,58 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug weekly", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/src/modules/jobs/weekly/debug.js", | ||
"envFile": "${workspaceFolder}/.dev.env", | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug daily", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/src/modules/jobs/daily/debug.js", | ||
"envFile": "${workspaceFolder}/.dev.env", | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug monthly", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/src/modules/jobs/monthly/debug.js", | ||
"envFile": "${workspaceFolder}/.dev.env", | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug complete", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/src/modules/debug-commands/debug-complete.js", | ||
"envFile": "${workspaceFolder}/.dev.env", | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug assign", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/src/modules/debug-commands/debug-assign.js", | ||
"envFile": "${workspaceFolder}/.dev.env", | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -23,6 +23,7 @@ users | |
displayName | ||
numCycleChores | ||
numAllTimeChores | ||
inactive | ||
* currentChore (-> chores) | ||
|
||
chores | ||
|
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,8 @@ | ||
echo $DEV | ||
echo $AWS_PROFILE | ||
rm -rf .aws-sam | ||
yarn | ||
yarn generate-template | ||
yarn register-commands | ||
sam build | ||
sam 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
echo $AWS_PROFILE | ||
|
||
# from https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script | ||
read -p "This will delete EVERYTHING and you will have to re-deploy. All your data will be GONE. Are you sure? (y/n)" -n 1 -r | ||
echo # (optional) move to a new line | ||
if [[ $REPLY =~ ^[Yy]$ ]] | ||
then | ||
cd .. | ||
sam delete | ||
echo "Done with sam delete" | ||
aws cloudformation delete-stack --stack-name sam-app | ||
echo "Done with cloudformation delete-stack" | ||
fi |
File renamed without changes.
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,30 @@ | ||
const dotenv = require("dotenv"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const { create_template_string } = require("./scheduler_role_template"); | ||
dotenv.config({ | ||
path: !!process.env.DEV === true ? "../../.dev.env" : "../../.env", | ||
}); | ||
|
||
console.log( | ||
"generating scheduler role json using AWS account ", | ||
process.env.AWS_ID | ||
); | ||
|
||
if (!process.env.AWS_ID) { | ||
throw "You must define all variables in the .env file (see readme for more details)"; | ||
} | ||
|
||
const main = () => { | ||
const template = create_template_string(); | ||
|
||
fs.writeFileSync( | ||
path.join(__dirname, "scheduler_role.json"), | ||
template, | ||
"utf-8" | ||
); | ||
console.log("File scheduler_role.json generated successfully."); | ||
return; | ||
}; | ||
|
||
main(); |
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,10 @@ | ||
{ | ||
"name": "scheduler", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "Kevin Ulrich", | ||
"license": "MIT", | ||
"dependencies": { | ||
"dotenv": "^16.4.5" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
user_id=$(aws sts get-caller-identity --query 'Account' --output text) | ||
echo $DEV | ||
echo $AWS_PROFILE | ||
echo $user_id | ||
|
||
yarn | ||
node create_scheduler_role.js | ||
aws iam create-role --role-name SchedulerExecutionRole --assume-role-policy-document file://scheduler_role.json | ||
aws iam create-policy --policy-name SchedulerPolicy --policy-document file://scheduler_policy.json | ||
aws iam attach-role-policy --policy-arn arn:aws:iam::${user_id}:policy/SchedulerPolicy --role-name SchedulerExecutionRole |
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,8 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
dotenv@^16.4.5: | ||
version "16.4.5" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" | ||
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== |
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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
exports.getChoreMessage = (chore) => | ||
`**Chore**: ${chore.displayName}\n**Description**: ${chore.description}`; | ||
exports.getChoreMessage = (chore) => { | ||
if (!chore || !chore.displayName || !chore.description) { | ||
return "Chore not found"; | ||
} | ||
return `**Chore**: ${chore.displayName}\n**Description**: ${chore.description}\n**Reviewer**: <@${chore.reviewer}>`; | ||
}; |
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
Oops, something went wrong.