├── .deployment ├── .gitignore ├── README.md ├── SECURITY.md ├── cloud └── main.js ├── config.js ├── deploy.cmd ├── index.js ├── local.js ├── package.json └── web.config /.deployment: -------------------------------------------------------------------------------- 1 | [config] 2 | command = deploy.cmd -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | 29 | # Emacs 30 | *~ 31 | 32 | local.js -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Parse Server on Managed Azure Services 2 | 3 | Your parse server is running at `https://.azurewebsites.net/parse`. 4 | 5 | Your parse dashboard is running at `https://.azurewebsites.net/parse-dashboard` 6 | * username: `` 7 | * password: `` 8 | 9 | ### Developing Remotely 10 | 11 | Use Visual Studio Online, a free web app site extension, to modify your deployed site code at `https://.scm.azurewebsites.net/dev`. You may need to install VSO onto your web app via tools->Visual Studio Online. Filewatching is enabled by default, so any changes that you make to your javascript/configuration files will automatically trigger a site restart to pick up the changes. Be careful if you deploy to the site as your remote changes may be overwritten! 12 | 13 | ### Developing Locally 14 | 15 | You can easily interact with the deployed parse server code via git. Clone the web app repository locally with `git clone https://.scm.azurewebsites.net/.git`. Pushing to the remote repository will automatically trigger a deployment. Be careful not to overwrite changes that you have made remotely with a git deployment! 16 | 17 | If you want to setup specific configuration for your app, add it to `config.js` or `local.js`. `local.js` changes will be ignored from git, so it's a good placed to add secrets while developing locally. 18 | 19 | ### Updating Dependencies 20 | 21 | If you want to upgrade to a newer version of parse-server, parse-dashboard, or other modules, there are a few steps: 22 | - set an appsetting WEBSITE_NODE_DEFAULT_VERSION to 6.9.4 23 | - use [kudu console](https://blogs.msdn.microsoft.com/benjaminperkins/2014/03/24/using-kudu-with-windows-azure-web-sites/) to run `npm install @`. 24 | 25 | We recommend testing these upgrades on a development instance or locally before modifying your production site. If you want to move to the next major version of parse-server or parse-dashboard you'll need to modify your site package.json, as `^major.minor.patch` versioning only allows installing a package of the same major version. 26 | 27 | ### Troubleshooting 28 | 29 | Logging specific parse-server configuration: 30 | * Verbose parse-server logging: add an app setting to your web app 'VERBOSE' equal to 'true', or add to your server configuration `verbose: 'true'` 31 | * Database driver logging (very verbose!): add `require('mongodb-core/lib/connection/logger')('dummy', { loggerLevel: 'debug' });` before you initialize parse server 32 | 33 | To see your logs, check: 34 | * The Logs tab of the parse dashboard 35 | * Web App [diagnostic logging](https://azure.microsoft.com/en-us/documentation/articles/web-sites-enable-diagnostic-log/) 36 | 37 | Useful tools: 38 | * F12 developer tools (are the requests to parse server from the dashboard failing?) 39 | * Postman / Fiddler (execute rest calls against parse server / intercept traffic) 40 | * node-inspector (debug your app locally or [remotely](https://blogs.msdn.microsoft.com/waws/2016/04/07/debug-node-js-azure-mobile-apps-with-node-inspector/)) 41 | 42 | ######Parse Dashboard Issues 43 | The parse dashboard used to be located in a site extension with route `https://.scm.azurewebsites.net/parse-dashboard`. 44 | It is now an express app running on the main web site at route `https://.azurewebsites.net/parse-dashboard`. A username (appId) and password (masterKey) are required. 45 | The dashboard can take a long time to load due to cold starts. 46 | 47 | ######Push Issues 48 | The notification hub needs to be at least basic tier in order to send push notifications. 49 | 50 | ######DocDB 51 | There have been known issues with the DocumentDB dropping mongo connections. A server restart will typically fix the problem. We are working to resolve the problem. 52 | 53 | ### Useful Links 54 | * App Links 55 | * Parse Server: `https://.azurewebsites.net/parse` 56 | * Parse Dashboard: `https://:@.azurewebsites.net/parse-dashboard` 57 | * Online Code Editor: `https://.scm.azurewebsites.net/dev` 58 | * Web App Git Repository: `https://.scm.azurewebsites.net/.git` 59 | * Azure Documentation 60 | * [Parse Server on Managed Azure Services](https://azure.microsoft.com/en-us/marketplace/partners/microsoft/parseserver/) 61 | * [Blog Post](https://azure.microsoft.com/en-us/blog/announcing-the-publication-of-parse-server-with-azure-managed-services/) 62 | * Github Repositories 63 | * [parse-server](https://github.com/ParsePlatform/parse-server) 64 | * [parse-dashboard](https://github.com/ParsePlatform/parse-dashboard) 65 | * [parse-server-azure-storage](https://github.com/felixrieseberg/parse-server-azure-storage) 66 | * [parse-server-azure-push](https://github.com/mamaso/parse-server-azure-push) 67 | * [parse-server-azure-config](https://github.com/mamaso/parse-server-azure-config) 68 | * [Deployed app](https://github.com/Azure/parse-server-example) 69 | * Azure Infrastructure 70 | * [Web Apps](https://azure.microsoft.com/en-us/documentation/services/app-service/web/) 71 | * [DocumentDB](https://azure.microsoft.com/en-us/documentation/services/documentdb/) 72 | * [Storage](https://azure.microsoft.com/en-us/documentation/services/storage/) 73 | * [Notification Hubs](https://azure.microsoft.com/en-us/documentation/services/notification-hubs/) 74 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /cloud/main.js: -------------------------------------------------------------------------------- 1 | 2 | Parse.Cloud.define('hello', function(req, res) { 3 | res.success('Hi'); 4 | }); 5 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | server: {}, 3 | dashboard: {}, 4 | storage: {}, 5 | push: {} 6 | } -------------------------------------------------------------------------------- /deploy.cmd: -------------------------------------------------------------------------------- 1 | @if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off 2 | 3 | :: ---------------------- 4 | :: KUDU Deployment Script 5 | :: Version: 1.0.6 6 | :: ---------------------- 7 | 8 | :: Prerequisites 9 | :: ------------- 10 | 11 | :: Verify node.js installed 12 | where node 2>nul >nul 13 | IF %ERRORLEVEL% NEQ 0 ( 14 | echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment. 15 | goto error 16 | ) 17 | 18 | :: Setup 19 | :: ----- 20 | 21 | setlocal enabledelayedexpansion 22 | 23 | SET ARTIFACTS=%~dp0%..\artifacts 24 | 25 | IF NOT DEFINED DEPLOYMENT_SOURCE ( 26 | SET DEPLOYMENT_SOURCE=%~dp0%. 27 | ) 28 | 29 | IF NOT DEFINED DEPLOYMENT_TARGET ( 30 | SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot 31 | ) 32 | 33 | IF NOT DEFINED NEXT_MANIFEST_PATH ( 34 | SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest 35 | 36 | IF NOT DEFINED PREVIOUS_MANIFEST_PATH ( 37 | SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest 38 | ) 39 | ) 40 | 41 | IF NOT DEFINED KUDU_SYNC_CMD ( 42 | :: Install kudu sync 43 | echo Installing Kudu Sync 44 | call npm install kudusync -g --silent 45 | IF !ERRORLEVEL! NEQ 0 goto error 46 | 47 | :: Locally just running "kuduSync" would also work 48 | SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd 49 | ) 50 | goto Deployment 51 | 52 | :: Utility Functions 53 | :: ----------------- 54 | 55 | :SelectNodeVersion 56 | 57 | IF DEFINED KUDU_SELECT_NODE_VERSION_CMD ( 58 | :: The following are done only on Windows Azure Websites environment 59 | call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%" 60 | IF !ERRORLEVEL! NEQ 0 goto error 61 | 62 | IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" ( 63 | SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp" 64 | IF !ERRORLEVEL! NEQ 0 goto error 65 | ) 66 | 67 | IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" ( 68 | SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp" 69 | IF !ERRORLEVEL! NEQ 0 goto error 70 | ) 71 | 72 | IF NOT DEFINED NODE_EXE ( 73 | SET NODE_EXE=node 74 | ) 75 | 76 | SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!" 77 | ) ELSE ( 78 | SET NPM_CMD=npm 79 | SET NODE_EXE=node 80 | ) 81 | 82 | goto :EOF 83 | 84 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 85 | :: Deployment 86 | :: ---------- 87 | 88 | :Deployment 89 | echo Handling node.js deployment. 90 | 91 | :: 1. KuduSync 92 | IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" ( 93 | call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd" 94 | IF !ERRORLEVEL! NEQ 0 goto error 95 | ) 96 | 97 | :: 2. Select node version 98 | call :SelectNodeVersion 99 | 100 | :: 3. Install npm packages. Attempt up to 3 times in the event of failures 101 | IF EXIST "%DEPLOYMENT_TARGET%\package.json" ( 102 | pushd "%DEPLOYMENT_TARGET%" 103 | FOR /L %%A IN (1,1,3) DO ( 104 | call !NPM_CMD! install --production 105 | IF !ERRORLEVEL!==0 goto npmInstallSuccess 106 | IF %%A NEQ 3 SLEEP 5 107 | ) 108 | goto error 109 | :npmInstallSuccess 110 | popd 111 | ) 112 | 113 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 114 | 115 | :: Post deployment stub 116 | IF DEFINED POST_DEPLOYMENT_ACTION call "%POST_DEPLOYMENT_ACTION%" 117 | IF !ERRORLEVEL! NEQ 0 goto error 118 | 119 | goto end 120 | 121 | :: Execute command routine that will echo out when error 122 | :ExecuteCmd 123 | setlocal 124 | set _CMD_=%* 125 | call %_CMD_% 126 | if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_% 127 | exit /b %ERRORLEVEL% 128 | 129 | :error 130 | endlocal 131 | echo An error has occurred during web site deployment. 132 | call :exitSetErrorLevel 133 | call :exitFromFunction 2>nul 134 | 135 | :exitSetErrorLevel 136 | exit /b 1 137 | 138 | :exitFromFunction 139 | () 140 | 141 | :end 142 | endlocal 143 | echo Finished successfully. -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var ParseServer = require('parse-server').ParseServer; 3 | var ParseDashboard = require('parse-dashboard'); 4 | var parseServerConfig = require('parse-server-azure-config'); 5 | var url = require('url'); 6 | 7 | var config = parseServerConfig(__dirname); 8 | 9 | // Modify config as necessary before initializing parse server & dashboard 10 | 11 | var app = express(); 12 | app.use('/public', express.static(__dirname + '/public')); 13 | app.use('/parse', new ParseServer(config.server)); 14 | app.use('/parse-dashboard', ParseDashboard(config.dashboard, true)); 15 | 16 | app.listen(process.env.PORT || url.parse(config.server.serverURL).port, function () { 17 | console.log(`Parse Server running at ${config.server.serverURL}`); 18 | }); -------------------------------------------------------------------------------- /local.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | server: {}, 3 | dashboard: {}, 4 | storage: {}, 5 | push: {} 6 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parse-server-azure-managed", 3 | "version": "1.0.0", 4 | "description": "Parse Server on Azure Managed Services", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/mamaso/parse-server-example" 9 | }, 10 | "license": "MIT", 11 | "dependencies": { 12 | "buffer-shims": "^1.0.0", 13 | "express": "^4.13.4", 14 | "parse-server": "2.3.x", 15 | "parse-dashboard": "^1.0.11", 16 | "parse-server-azure-config": "^1.0.0" 17 | }, 18 | "scripts": { 19 | "start": "node index.js", 20 | "postinstall": "git update-index --skip-worktree local.js & exit 0" 21 | }, 22 | "engines": { 23 | "node": "6.9.4" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /web.config: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 66 | 67 | 68 | 69 | 70 | --------------------------------------------------------------------------------