Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Commit

Permalink
put and get private using azure blob
Browse files Browse the repository at this point in the history
  • Loading branch information
sballesteros committed Nov 1, 2019
1 parent ccc9a60 commit a6d7e9f
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ extension/popup.css
extension/popup.css.map
extension/popup.js
extension/popup.js.map

deploy-env.private.sh
env.private.sh
*.private.sh
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,14 @@ npm test

We use Azure.

1. install Azure CLI (see https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest)
2. run `az login` to login to the CLI
3. run `./deploy-app.sh` to deploy the app and `./deploy-service.sh` to deploy the service
1. Install Azure CLI (see
https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest)
2. Run `az login` to login to the CLI
3. Get the private files not checked in to GitHub: `./get-private.sh` (if you
later update those files, run `./put-private.sh` to upload them back)
3. Run `./deploy-app.sh` to deploy the app and `./deploy-service.sh` to deploy the service

To see the logs, run `./log-app.sh` or `./log-service.sh`

To seed the production database run: `npm run seed:prod`. Be aware that this
will source the production environment variables.
6 changes: 3 additions & 3 deletions deploy-app.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash

## https://rapid-prereview.azurewebsites.net/
## Deploy to https://rapid-prereview.azurewebsites.net/

./deploy-env.private.sh

## See https://docs.microsoft.com/en-us/azure/app-service/deploy-zip

zip -r app.zip *.json *.js dist/* src/* public/* views/* scripts/* test/*

## See https://docs.microsoft.com/en-us/azure/app-service/containers/configure-language-nodejs

## TODO env variables: az webapp config appsettings set --name <app-name> --resource-group myResourceGroup --settings MONGODB_URI="mongodb://<cosmosdb-name>:<primary-master-key>@<cosmosdb-name>.documents.azure.com:10250/mean?ssl=true"

az webapp config appsettings set --resource-group "rapid-prereview" --name "rapid-prereview" --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true

az webapp config set --resource-group "rapid-prereview" --name "rapid-prereview" --startup-file "npm run start:prod"
Expand Down
1 change: 1 addition & 0 deletions extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"permissions": [
"tabs",
"cookies",
"*://rapid-prereview.azurewebsites.net/*",
"*://*.prereview.org/*",
"http://127.0.0.1/*",
"http://localhost/*"
Expand Down
4 changes: 4 additions & 0 deletions get-private.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

az storage blob download --account-name rapidprereviewprivate --container-name "rapid-prereview-blobs" --name "deploy-env.private.sh" --file "deploy-env.private.sh"
az storage blob download --account-name rapidprereviewprivate --container-name "rapid-prereview-blobs" --name "env.private.sh" --file "env.private.sh"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"start:prod": "node ./dist/server.js",
"start:service": "node ./dist/service.js",
"seed": "babel-node ./scripts/seed.js",
"seed:prod": "source env.private.sh && babel-node ./scripts/seed.js",
"ddocs": "babel-node ./scripts/ddocs.js",
"init": "babel-node ./scripts/init.js",
"harvest": "babel-node ./scripts/harvest.js",
Expand Down
4 changes: 4 additions & 0 deletions put-private.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

az storage blob upload --account-name rapidprereviewprivate --container-name "rapid-prereview-blobs" --name "deploy-env.private.sh" --file "deploy-env.private.sh"
az storage blob upload --account-name rapidprereviewprivate --container-name "rapid-prereview-blobs" --name "env.private.sh" --file "env.private.sh"
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,5 @@ export const CHECK_PREPRINT = 'CHECK_PREPRINT';
export const SESSION_COOKIE = 'SESSION_COOKIE';
export const PREPRINT = 'PREPRINT';
export const TOGGLE_SHELL_TAB = 'TOGGLE_SHELL_TAB';

export const CONTACT_EMAIL_HREF = 'mailto:[email protected]';
4 changes: 2 additions & 2 deletions webpack-extension.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ module.exports = {
'process.env.IS_EXTENSION': true,
'process.env.COOKIE_URL': JSON.stringify(
process.env.NODE_ENV === 'production'
? 'https://oubreaksci.prereview.org'
? 'https://rapid-prereview.azurewebsites.net/' // 'https://oubreaksci.prereview.org'
: 'http://127.0.0.1'
),
'process.env.API_URL': JSON.stringify(
process.env.NODE_ENV === 'production'
? 'https://oubreaksci.prereview.org'
? 'https://rapid-prereview.azurewebsites.net/' // 'https://oubreaksci.prereview.org'
: 'http://127.0.0.1:3000'
)
}),
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = {
'process.env.IS_EXTENSION': false,
'process.env.API_URL': JSON.stringify(
process.env.NODE_ENV === 'production'
? 'https://oubreaksci.prereview.org'
? 'https://rapid-prereview.azurewebsites.net/' // 'https://oubreaksci.prereview.org'
: 'http://127.0.0.1:3000'
)
}),
Expand Down

0 comments on commit a6d7e9f

Please sign in to comment.