diff --git a/.gitignore b/.gitignore index 0b32f2b..4bb7d56 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 5cc5986..7c88b62 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/deploy-app.sh b/deploy-app.sh index 85cf666..9a22c74 100755 --- a/deploy-app.sh +++ b/deploy-app.sh @@ -1,6 +1,8 @@ #!/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 @@ -8,8 +10,6 @@ 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 --resource-group myResourceGroup --settings MONGODB_URI="mongodb://:@.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" diff --git a/extension/manifest.json b/extension/manifest.json index b4c9954..f47ceb6 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -6,6 +6,7 @@ "permissions": [ "tabs", "cookies", + "*://rapid-prereview.azurewebsites.net/*", "*://*.prereview.org/*", "http://127.0.0.1/*", "http://localhost/*" diff --git a/get-private.sh b/get-private.sh new file mode 100755 index 0000000..6dd58c7 --- /dev/null +++ b/get-private.sh @@ -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" diff --git a/package.json b/package.json index b536b96..3870b00 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/put-private.sh b/put-private.sh new file mode 100755 index 0000000..f1eba14 --- /dev/null +++ b/put-private.sh @@ -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" diff --git a/src/constants.js b/src/constants.js index 2fd72f2..c65ed39 100644 --- a/src/constants.js +++ b/src/constants.js @@ -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:contact@outbreaksci.prereview.org'; diff --git a/webpack-extension.config.js b/webpack-extension.config.js index c62df7a..2dcb921 100644 --- a/webpack-extension.config.js +++ b/webpack-extension.config.js @@ -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' ) }), diff --git a/webpack.config.js b/webpack.config.js index 2867f70..3ebbf17 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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' ) }),