-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy setup #9
Merged
Merged
Deploy setup #9
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c118406
Added deploy step to CircleCI config
rodrei ef3db38
Added downloadSecrets script
rodrei 997c9bc
Extracted deploy.sh from circle config
rodrei 7117cf5
Refactored downloadSecrets script to fetch all pages
rodrei 15ddea9
Added production deploy config to circleci
rodrei e1d3cf6
Added .env.test file
rodrei 63fc44c
Enable tests on CI
rodrei 09c463d
Moving deploy branches configs to ENV vars
rodrei b9a743d
Run flow in CI, ignore config-chain/broken.json
vincemtnz 154548f
Add `flow weak` to lib files, fix some caught errors
vincemtnz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,9 @@ | ||
export AK_API_URL="https://act.sumofus.org/rest/v1" | ||
export MEMBER_SERVICES_SECRET='member-services-secret' | ||
export BRAINTREE_MERCHANT_ID="6ngbwhytbhrz9z2r" | ||
export BRAINTREE_PUBLIC_KEY='public-key' | ||
export BRAINTREE_PRIVATE_KEY='private-key' | ||
export BRAINTREE_ENV=Sandbox | ||
export VCR_MODE=playback | ||
export CHAMPAIGN_URL='https://action-staging.sumofus.org' | ||
export UNSUBSCRIBE_PAGE_NAME=unsubscribe |
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,4 +1,5 @@ | ||
[ignore] | ||
<PROJECT_ROOT>/node_modules/.*config-chain/test/broken.json | ||
|
||
[include] | ||
|
||
|
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,5 @@ | ||
#!/usr/bin/env bash | ||
ENV=$1 | ||
./deploy/downloadSecrets.js "/$ENV/api-services/" > secrets.sh | ||
source secrets.sh | ||
$(npm bin)/serverless deploy -s $ENV --conceal |
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,36 @@ | ||
#!/usr/bin/env node | ||
const getParametersByPath = require('./parametersStoreClient'); | ||
const AWS = require('aws-sdk'); | ||
const commandLineArgs = require('command-line-args'); | ||
|
||
const optionDefinitions = [ | ||
{ name: 'secrets-path', alias: 'p', type: String, defaultOption: true }, | ||
{ name: 'aws-region', alias: 'r', type: String, defaultValue: 'us-west-2' }, | ||
{ name: 'help', alias: 'h' }, | ||
]; | ||
const options = commandLineArgs(optionDefinitions); | ||
|
||
if (options.help !== undefined || !options['secrets-path']) { | ||
console.warn( | ||
`usage: ./downloadSecrets.js secrets-path [Options] | ||
|
||
Options: | ||
-p or --secrets-path PATH | ||
AWS Parameter Store path (Required) | ||
-r or --aws-region REGION | ||
AWS region used to fetch params from (default: us-west-2) | ||
-h or --help | ||
Help` | ||
); | ||
process.exit(1); | ||
} | ||
|
||
getParametersByPath(options['secrets-path'], options['aws-region']) | ||
.then(function(secrets) { | ||
secrets.forEach(function(secret) { | ||
console.log(`export ${secret[0]}='${secret[1]}'`); | ||
}); | ||
}) | ||
.catch(function(error) { | ||
throw error; | ||
}); |
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,37 @@ | ||
const AWS = require('aws-sdk'); | ||
|
||
const getParametersByPath = function(path, awsRegion, nextToken = null) { | ||
const ssm = new AWS.SSM({ region: awsRegion }); | ||
let params = { Path: path }; | ||
if (nextToken !== null) params.NextToken = nextToken; | ||
|
||
return new Promise(function(resolve, reject) { | ||
ssm.getParametersByPath(params, function(err, data) { | ||
if (err) reject(err); | ||
else { | ||
let secrets = parse(data); | ||
if (data.NextToken) { | ||
getParametersByPath(path, awsRegion, data.NextToken).then(function( | ||
nextSecrets | ||
) { | ||
resolve(secrets.concat(nextSecrets)); | ||
}); | ||
} else { | ||
resolve(secrets); | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
function parse(data) { | ||
const secrets = []; | ||
data.Parameters.forEach(function(secret) { | ||
const name = secret.Name.replace(/^.*\//, ''); | ||
const value = secret.Value; | ||
secrets.push([name, value]); | ||
}); | ||
return secrets; | ||
} | ||
|
||
module.exports = getParametersByPath; | ||
This file was deleted.
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
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,3 +1,4 @@ | ||
// @flow weak | ||
import axios from 'axios'; | ||
import { basicAuthToken } from '../../../util/basicAuthToken'; | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @flow weak | ||
import axios from 'axios'; | ||
import { integrationHeaders } from './utils'; | ||
|
||
|
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,3 +1,4 @@ | ||
// @flow weak | ||
import { updateMember } from './member'; | ||
|
||
const { objectContaining } = expect; | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @flow weak | ||
import { getSubscription } from './gocardless'; | ||
|
||
describe('getSubscription', () => { | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rodrei let me know if I'm missing something (I suspect I am), but why aren't we referencing the SSM params directly? eg
DDB_TABLE: ${ssm:/path/to/dynamodbTable}
? https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-variables-using-the-ssm-parameter-store