[
  {
    "path": ".ebextensions/app.config",
    "content": "option_settings:\n  aws:elasticbeanstalk:application:environment:\n    PARSE_MOUNT: \"/parse\"\n    APP_ID: \"ReplaceWithAppID\"\n    MASTER_KEY: \"ReplaceWithMasterKey\"\n    DATABASE_URI: \"ReplaceWithDatabaseURI\"\n    NODE_ENV: \"production\"\n    SERVER_URL: \"http://myappname.elasticbeanstalk.com/parse\"\n"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directory\n# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git\nnode_modules\n\n# Emacs\n*~\n\n# Vim\n*.swp\n*.swo\n\n*.pem\naccount_key.json\n*.key\n*.crt\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: bash\nservices: docker\n\nenv:\n  - VERSION=latest\n#  - VERSION=2.0.0\n#  - VERSION=2.0.1\n#  - VERSION=2.0.2\n#  - VERSION=2.0.3\n#  - VERSION=2.0.4\n#  - VERSION=2.0.5\n#  - VERSION=2.0.6\n#  - VERSION=2.0.7\n#  - VERSION=2.0.8\n#  - VERSION=2.1.0\n#  - VERSION=2.1.1\n#  - VERSION=2.1.2\n#  - VERSION=2.1.3\n#  - VERSION=2.1.4\n#  - VERSION=2.1.5\n#  - VERSION=2.1.6\n#  - VERSION=2.2.0\n#  - VERSION=2.2.1\n#  - VERSION=2.2.2\n#  - VERSION=2.2.3\n#  - VERSION=2.2.4\n#  - VERSION=2.2.5\n#  - VERSION=2.2.6\n  - VERSION=dev DOCKERDIR=\"dev\"\n\ninstall:\n  - git clone https://github.com/docker-library/official-images.git ~/official-images\n\nbefore_script:\n  - env | sort\n  - C=\":\"\n  - APP_ID=\"appId\"\n  - MASTER_KEY=\"masterKey\"\n  - sed -i 's/\"parse-server\"'$C' \"[^\"]\\+\"/\"parse-server\"'$C' \"'\"$VERSION\"'\"/' package.json\n  - image=\"yongjhih/parse-server:$VERSION\"\n  - dockerdir=\"${DOCKERDIR:-.}\"\n  - echo \"ENV APP_ID $APP_ID\" >> $dockerdir/Dockerfile\n  - echo \"ENV MASTER_KEY $MASTER_KEY\" >> $dockerdir/Dockerfile\n\nscript:\n  - docker build -t \"$image\" \"$dockerdir\"\n  - ~/official-images/test/run.sh \"$image\"\n\nafter_script:\n  - docker images\n\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "ADVANCE.md",
    "content": "## How to use with existing mongodb with DATABASE_URI\n```sh\n$ docker run -d \\\n             -e DATABASE_URI=${DATABASE_URI:-mongodb://mongodb.intra:27017/dev} \\\n             -e APP_ID=${APP_ID}                            \\\n             -e MASTER_KEY=${MASTER_KEY}                    \\\n             -p 1337:1337                                        \\\n             --name parse-server                                 \\\n             yongjhih/parse-server\n```\n\nor with docker-compose:\n\n```sh\n$ wget https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose.yml\n$ DATABASE_URI={mongodb://mongodb.intra:27017/dev} APP_ID={appId} MASTER_KEY={masterKey} docker-compose up\n```\n\n## How to use with existing parse-cloud-code\n### With host folder:\n```sh\n$ docker run -d \\\n             -v ${PARSE_CLOUD:-/home/yongjhih/parse/cloud}:/parse/cloud \\\n             -e DATABASE_URI=${PARSE_DATABASE_URI:-mongodb://mongodb.intra:27017/dev} \\\n             -e APP_ID={appId}         \\\n             -e MASTER_KEY={masterKey} \\\n             -p 1337:1337              \\\n             --link mongo              \\\n             --name parse-server       \\\n             yongjhih/parse-server\n```\n### With volume container:\n```sh\n$ docker create --name parse-cloud-code \\\n                -v /parse/cloud         \\\n                ${DOCKER_PARSE_CLOUD:-yongjhih/parse-cloud-code} echo ls /parse/cloud\n\n$ docker run -d \\\n             --volumes-from parse-cloud-code \\\n             -e DATABASE_URI=${DATABASE_URI:-mongodb://mongodb.intra:27017/dev} \\\n             -e APP_ID=${APP_ID}        \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -p 1337:1337                     \\\n             --link mongo                     \\\n             --name parse-server              \\\n             yongjhih/parse-server\n```\n\n## How to use with custom authentication\n###\n\nYou can add (multiple) custom authentication provider with the environment variables defined below.\n\nMandatory module path: `AUTH_MYAUTH_MODULE=PATH_TO_MODULE`\n\nOptional module option: `AUTH_MYAUTH_MY_OPTION=value`\n\nReplace `MYAUTH` by your custom authentication name __without__ any underscore.\n\nReplace `MY_OPTION` by your custom authentication parameter name.\n\n### Example\n```sh\n$ docker run -d                                \\\n             -e APP_ID=${APP_ID}         \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -e AUTH_MYAUTH_MODULE=${AUTH_MYAUTH_MODULE} \\\n             -e AUTH_MYAUTH_OPTION=${AUTH_MYAUTH_OPTION} \\\n             -e AUTH_MYAUTH_ANOTHER_OPTION=${AUTH_MYAUTH_ANOTHER_OPTION} \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -p 1337:1337                      \\\n             --link mongo                      \\\n             --name parse-server               \\\n             yongjhih/parse-server:dev\n```\n\n## How to specify parse-server version\nSpecify parse-server:2.2.10:\n```sh\n$ docker run -d                                \\\n             -e APP_ID=${APP_ID}         \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -p 1337:1337                      \\\n             --link mongo                      \\\n             --name parse-server               \\\n             yongjhih/parse-server:2.2.10\n```\n\n> ref. https://github.com/ParsePlatform/parse-server/releases\n> ref. https://www.npmjs.com/package/parse-server\n\n## How to specify latest commit of [ParsePlatform/parse-server](https://github.com/ParsePlatform/parse-server) of image\n```sh\n$ docker run -d                                \\\n             -e APP_ID=${APP_ID}         \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -p 1337:1337                      \\\n             --link mongo                      \\\n             --name parse-server               \\\n             yongjhih/parse-server:dev\n```\n## How to start parse dashboard as standalone\nStart up parse-dashboard: https://github.com/yongjhih/docker-parse-dashboard  \nAnd, start up other containers without parse-dashboard:\n\n```sh\n$ APP_ID=YOUR_APP_ID MASTER_KEY=YOUR_MASTER_KEY docker-compose -f docker-compose-without-dashboard.yml up -d\n```\n## How to setup SSL with letsencrypt\n```sh\n$ git clone https://github.com/yongjhih/docker-parse-server\n$ cd docker-parse-server\n\n$ USER1=yongjhih \\\n  USER1_PASSWORD=yongjhih \\\n  PARSE_DASHBOARD_VIRTUAL_HOST=parse.example.com \\\n  PARSE_DASHBOARD_LETSENCRYPT_HOST=parse.example.com \\\n  PARSE_DASHBOARD_LETSENCRYPT_EMAIL=yongjhih@example.com \\\n  PARSE_SERVER_VIRTUAL_HOST=api.example.com \\\n  PARSE_SERVER_LETSENCRYPT_HOST=api.example.com \\\n  PARSE_SERVER_LETSENCRYPT_EMAIL=yongjhih@example.com \\\n  SERVER_URL=https://api.example.com/parse \\\n  APP_ID=YOUR_APP_ID MASTER_KEY=YOUR_MASTER_KEY docker-compose -f docker-compose-le.yml up\n```\n\nOpen your https://parse.example.com/ url and unblock browser protected scripts, that's it.  \nBTW, you can remove unused 80 port after volumes/proxy/certs generated:\n\n```sh\nsed -i -- '/- \"80:80\"/d' docker-compose-le.yml\n```\n\n## How to setup push notification\n```\n$ mkdir volumes/certs\n$ cp /path/your/Certificated.p12 volumes/certs/dev-pfx.p12\n$ cp /path/your/cert.pem volumes/certs/dev-pfx-cert.pem\n$ cp /path/your/key.pem volumes/certs/dev-pfx-key.pem\n$ docker-compose up\n```\n\n## How to setup multi IOS p12\n```\n- APNS_BUNDLES_ID=bundleId1,bundleId2\n- APNS_BUNDLES_P12=/certs/cert1.p12,/certs/cert2.p12\n- APNS_BUNDLES_PROD=isProd1,idProd2\n```\n\nExample :\n```\n- APNS_BUNDLES_ID=com.mydomain.app1,com.mydomain.app2\n- APNS_BUNDLES_P12=/certs/cert-app1.p12,/certs/cert-app2.p12\n- APNS_BUNDLES_PROD=false,false\n   \n```\n\n## How to integrate parse-cloud-code image on GitHub and DockerHub\n1. Fork https://github.com/yongjhih/parse-cloud-code\n2. Add your cloud code into https://github.com/{username}/parse-cloud-code/tree/master/cloud\n3. Create an automated build image on DockerHub for forked {username}/parse-cloud-code repository\n4. `docker pull {username}/parse-cloud-code`\n\nWithout docker-compose:\n\n* Re/create parse-cloud-code volume container: `docker create -v /parse/code --name parse-cloud-code {username}/parse-cloud-code /bin/true`\n* Re/create parse-server container with volume: `docker run -d --volumes-from parse-cloud-code APP_ID={appId} -e MASTER_KEY={masterKey} -p 1337:1337 --link mongo yongjhih/parse-server`\n\nWith docker-compose.yml:\n\n```yml\n# ...\nparse-cloud-code:\n  # ...\n  image: {username}/parse-cloud-code # Specify your parse-cloud-code image\n# ...\n```\n\n```sh\ndocker-compose up\n```\n## How to config Docker\n\n* Specify application ID: `-e APP_ID={appId}`\n* Specify master key: `-e MASTER_KEY={masterKey}`\n* Specify database uri: `-e DATABASE_URI={mongodb://mongodb.intra:27017/dev}`\n* Specify parse-server port on host: `-p {1338}:1337`\n* Specify parse-cloud-code git port on host: `-p {2023}:22`\n* Specify database port on host: `-p {27018}:27017`\n* Specify parse cloud code host folder: `-v {/home/yongjhih/parse/cloud}:/parse/cloud`\n* Specify parse cloud code volume container: `--volumes-from {parse-cloud-code}`\n* Specify parse-server prefix: `-e PARSE_MOUNT={/parse}`\n* Specify parse-server log level: `-e LOG_LEVEL={info}`\n\n## How to config Docker Compose\n\nEnvironment:\n\n```yml\n# ...\nparse-server:\n  # ...\n  environment:\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT # /parse\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n    SERVER_URL: $SERVER_URL\n    MAX_UPLOAD_SIZE: $MAX_UPLOAD_SIZE # 20mb\n    GCM_ID: $GCM_ID\n    GCM_KEY: $GCM_KEY\n    PRODUCTION_PFX: $PRODUCTION_PFX\n    PRODUCTION_PASSPHRASE: $PRODUCTION_PASSPHRASE\n    PRODUCTION_BUNDLE_ID: $PRODUCTION_BUNDLE_ID\n    PRODUCTION_CERT: $PRODUCTION_CERT # prodCert.pem\n    PRODUCTION_KEY: $PRODUCTION_KEY # prodKey.pem\n    DEV_PFX: $DEV_PFX\n    DEV_PASSPHRASE: $DEV_PASSPHRASE\n    DEV_BUNDLE_ID: $DEV_BUNDLE_ID\n    DEV_CERT: $DEV_CERT # devCert.pem\n    DEV_KEY: $DEV_KEY # devKey.pem\n    VERIFY_USER_EMAILS: $VERIFY_USER_EMAILS # false\n    ENABLE_ANON_USERS: $ENABLE_ANON_USERS # true\n    ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # true\n    APP_NAME: $APP_NAME\n    PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL\n    TRUST_PROXY: $TRUST_PROXY # false\n    LOG_LEVEL: $LOG_LEVEL # info\n# ...\n```\n\nRemote parse-cloud-code image:\n\n```yml\n# ...\nparse-cloud-code:\n  # ...\n  image: yongjhih/parse-cloud-code # Specify your parse-cloud-code image\n# ...\n```\n\nor host folder:\n\n```yml\n# ...\nparse-cloud-code:\n  # ...\n  image: yongjhih/parse-server\n  volumes:\n    - /home/yongjhih/parse/cloud:/parse/cloud\n  # ...\n# ...\n```\n\n## How to import ssh-key from github\n```sh\n$ curl https://github.com/yongjhih.keys | docker exec -i parse-server ssh-add-key\n```\n\n## MongoDB alternatives\n\n* ParseServer-1.x verfied Mongo 3.0.8\n* ParseServer-2.x verfied Mongo 3.0.8, 3.2.6\n\n```yml\nimage: mongo:3.2.6\n```\n\n### MongoDB + RocksDB\n\nParse.com perfers Percona binrary of mongo-rocks:\n\n```yml\nimage: yongjhih/mongo-rocks:percona-3.0.8\n```\n\nMongoDB + RocksDB source build:\n\n```yml\nimage: yongjhih/mongo-rocks:3.2.0\n```\n\nAvoid ubuntu-12.04 core dump:\n\n```yml\nimage: yongjhih/mongo-rocks:ubuntu-12.04-3.2.0\n```\n\n# Getting Started With Cloud Services\n## Getting Started With Heroku + Mongolab Development\n### With the Heroku Button\n\n[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)\n\n### Without It\n\n* Clone the repo and change directory to it\n* Log in with the [Heroku Toolbelt](https://toolbelt.heroku.com/) and create an app: `heroku create`\n* Use the [MongoLab addon](https://elements.heroku.com/addons/mongolab): `heroku addons:create mongolab:sandbox`\n* By default it will use a path of /parse for the API routes.  To change this, or use older client SDKs, run `heroku config:set PARSE_MOUNT=/1`\n* Deploy it with: `git push heroku master`\n\n## Getting Started With AWS Elastic Beanstalk\n\n### With the Deploy to AWS Button\n\n<a title=\"Deploy to AWS\" href=\"https://console.aws.amazon.com/elasticbeanstalk/home?region=us-west-2#/newApplication?applicationName=ParseServer&solutionStackName=Node.js&tierName=WebServer&sourceBundleUrl=https://s3.amazonaws.com/elasticbeanstalk-samples-us-east-1/eb-parse-server-sample/parse-server-example.zip\" target=\"_blank\"><img src=\"http://d0.awsstatic.com/product-marketing/Elastic%20Beanstalk/deploy-to-aws.png\" height=\"40\"></a>\n\n### Without It\n\n* Clone the repo and change directory to it\n* Log in with the [AWS Elastic Beanstalk CLI](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html), select a region, and create an app: `eb init`\n* Create an environment and pass in MongoDB URI, App ID, and Master Key: `eb create --envvars DATABASE_URI=<replace with URI>,APP_ID=<replace with Parse app ID>,MASTER_KEY=<replace with Parse master key>`\n\n## Getting Started With Microsoft Azure App Service\n### With the Deploy to Azure Button\n\n[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/)\n\n### Without It\n\nA detailed tutorial is available here:\n[Azure welcomes Parse developers](https://azure.microsoft.com/en-us/blog/azure-welcomes-parse-developers/)\n\n## Getting Started With Google App Engine\n\n1. Clone the repo and change directory to it\n1. Create a project in the [Google Cloud Platform Console](https://console.cloud.google.com/).\n1. [Enable billing](https://console.cloud.google.com/project/_/settings) for your project.\n1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/).\n1. Setup a MongoDB server.  You have a few options:\n  1. Create a Google Compute Engine virtual machine with [MongoDB pre-installed](https://cloud.google.com/launcher/?q=mongodb).\n  1. Use [MongoLab](https://mongolab.com/google/) to create a free MongoDB deployment on Google Cloud Platform.\n1. Modify `app.yaml` to update your environment variables.\n1. Delete `Dockerfile`\n1. Deploy it with `gcloud preview app deploy`\n\nA detailed tutorial is available here:\n[Running Parse server on Google App Engine](https://cloud.google.com/nodejs/resources/frameworks/parse-server)\n\n## Getting Started With Scalingo\n\n### With the Scalingo button\n\n[![Deploy to Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy)\n\n### Without it\n\n* Clone the repo and change directory to it\n* Log in with the [Scalingo CLI](http://cli.scalingo.com/) and create an app: `scalingo create my-parse`\n* Use the [Scalingo MongoDB addon](https://scalingo.com/addons/scalingo-mongodb): `scalingo addons-add scalingo-mongodb free`\n* Setup MongoDB connection string: `scalingo env-set DATABASE_URI='$SCALINGO_MONGO_URL'`\n* By default it will use a path of /parse for the API routes. To change this, or use older client SDKs, run `scalingo env-set PARSE_MOUNT=/1`\n* Deploy it with: `git push scalingo master`\n\n> You can change the server URL in all of the open-source SDKs, but we're releasing new builds which provide initialization time configuration of this property.\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM node:5\n\nENV PARSE_HOME /parse\n\n#ADD . ${PARSE_HOME}\n#ADD *.js ${PARSE_HOME}/\n#ADD *.json ${PARSE_HOME}/\n\nADD package.json ${PARSE_HOME}/\n\nADD jsconfig.json ${PARSE_HOME}/\n\n## deployment is unnecessary\n#ADD app.json ${PARSE_HOME}/app.json # heroku\n#ADD azuredeploy.json ${PARSE_HOME}/azuredeploy.json # azure\n\nENV CLOUD_CODE_HOME ${PARSE_HOME}/cloud\nADD cloud/*.js $CLOUD_CODE_HOME/\n\nWORKDIR $PARSE_HOME\nRUN npm install\n\nADD index.js ${PARSE_HOME}/\n\n## ENV\n#ENV APP_ID myAppId\n#ENV MASTER_KEY myMasterKey\n#ENV DATABASE_URI mongodb://localhost:27017/dev\n#ENV CLOUD_CODE_MAIN ${CLOUD_CODE_HOME}/main.js\n#ENV PARSE_MOUNT /parse\n#ENV COLLECTION_PREFIX\n#ENV CLIENT_KEY\n#ENV REST_API_KEY\n#ENV DOTNET_KEY\n#ENV JAVASCRIPT_KEY\n#ENV DOTNET_KEY\n#ENV FILE_KEY\n#ENV FACEBOOK_APP_IDS \"xx,xxx\"\n#ENV SERVER_URL\n#ENV MAX_UPLOAD_SIZE\n\nENV PORT 1337\n\nEXPOSE $PORT\nVOLUME $CLOUD_CODE_HOME\nENV NODE_PATH .\n\nCMD [\"npm\", \"start\"]\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "README.md",
    "content": "# Docker ❤ Parse\n[![Docker Pulls](https://img.shields.io/docker/pulls/yongjhih/parse-server.svg)](https://hub.docker.com/r/yongjhih/parse-server/)\n[![Docker Stars](https://img.shields.io/docker/stars/yongjhih/parse-server.svg)](https://hub.docker.com/r/yongjhih/parse-server/)\n[![Docker Tag](https://img.shields.io/github/tag/yongjhih/docker-parse-server.svg)](https://hub.docker.com/r/yongjhih/parse-server/tags/)\n[![License](https://img.shields.io/github/license/yongjhih/docker-parse-server.svg)](https://github.com/yongjhih/docker-parse-server/raw/master/LICENSE.txt)\n[![Travis CI](https://img.shields.io/travis/yongjhih/docker-parse-server.svg)](https://travis-ci.org/yongjhih/docker-parse-server)\n[![Gitter Chat](https://img.shields.io/gitter/room/yongjhih/docker-parse-server.svg)](https://gitter.im/yongjhih/docker-parse-server)\n\n## :cloud: One-Click Deploy\n[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)\n[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/)\n[![Deploy to AWS](https://d0.awsstatic.com/product-marketing/Elastic%20Beanstalk/deploy-to-aws.png)](https://console.aws.amazon.com/elasticbeanstalk/home?region=us-west-2#/newApplication?applicationName=ParseServer&solutionStackName=Node.js&tierName=WebServer&sourceBundleUrl=https%3A%2F%2Fs3.amazonaws.com%2Felasticbeanstalk-samples-us-east-1%2Feb-parse-server-sample%2Fparse-server-example.zip)\n[![Deploy to Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy)\n[![Deploy to Docker Cloud](https://github.com/yongjhih/docker-parse-server/raw/master/art/deploy-to-docker-cloud.png)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/yongjhih/docker-parse-server)\n\n## :star: Features\n- [x] Parse Server with MongoDB\n- [x] [Parse Cloud Code](https://github.com/yongjhih/parse-cloud-code) via git with auto rebuild\n- [x] Parse Push Notification : iOS, Android\n- [x] Parse Live Query\n- [x] [Parse Dashboard](https://github.com/yongjhih/docker-parse-dashboard)\n- [x] Tested Docker Image\n- [x] Deploy with Docker\n- [x] Deploy with Docker Compose\n- [x] Deploy with one click\n- [x] GraphQL support `GRAPHQL_SUPPORT=true`, `GRAPHQL_SCHEMA=YOUR_SCHEMA_URL` (default to `./cloud/graphql/schema.js`)\n\n## :tv: Overview\n![Parse Server Diagram](https://github.com/yongjhih/docker-parse-server/raw/master/art/parse-server-diagram.png)\n\n## :see_no_evil: Sneak Preview\n[![Screencast](https://github.com/yongjhih/docker-parse-server/raw/master/art/docker-parse-server.gif)](https://youtu.be/1bYWSPEZL2g)\n\n## :rocket: Deployments\n\n> #### Note\n* If you are upgrading from version below 2.3.0, please see [these recommended steps](https://github.com/ParsePlatform/parse-server/blob/master/2.3.0.md).\n\n### :paperclip: Deploy with Docker\n```sh\n$ docker run -d -p 27017:27017 --name mongo mongo\n\n$ docker run -d                                \\\n             -e APP_ID=${APP_ID}         \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -p 1337:1337                      \\\n             --link mongo                      \\\n             --name parse-server               \\\n             yongjhih/parse-server\n\n$ docker run -d                                \\\n             -p 2022:22                        \\\n             --volumes-from parse-server       \\\n             --name parse-cloud-code-git       \\\n             yongjhih/parse-server:git\n\n# Test parse-server\n$ curl -X POST \\\n  -H \"X-Parse-Application-Id: {appId}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}' \\\n  http://localhost:1337/parse/functions/hello\n\n$ docker run -d \\\n             -e APP_ID=${APP_ID}         \\\n             -e MASTER_KEY=${MASTER_KEY} \\\n             -e SERVER_URL=http://localhost:1337/parse \\\n             -p 4040:4040                      \\\n             --link parse-server               \\\n             --name parse-dashboard            \\\n             yongjhih/parse-dashboard\n\n# The above command will asuume you will later create a ssh \n# and log into the dashboard remotely in production. \n#  However, to see the dashboard instanly using either\n#  localhost:4040 or someip:4040(if hosted somewhere remotely)\n# then you need to add extra option to allowInsecureHTTP like\n# It is also required that you create username and password \n# before accessing the portal else you cant get in\n\n$  docker run -d \\\n        -e PARSE_DASHBOARD_CONFIG='{\"apps\":[{\"appId\":\"<appid>\",\"serverURL\":\"http://localhost:1337/parse\",\"masterKey\":\"<masterkey>\",\"appName\":\"<appname>\"}],\"users\":[{\"user\":\"<username>\",\"pass\":\"<password>\"}]}' \\\n        -e PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1  \\\n        -p 4040:4040                      \\\n        --link parse-server               \\\n        --name parse-dashboard            \\\n        yongjhih/parse-dashboard\n\n```\n### :paperclip: Deploy with Docker Compose\n```sh\n$ wget https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose.yml\n$ APP_ID=YOUR_APP_ID MASTER_KEY=YOUR_MASTER_KEY PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1 SERVER_URL=http://localhost:1337/parse docker-compose up -d\n```\n> #### Note \n* We use `PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1` to allow insecure via development environment.\n> * `$ wget https://github.com/yongjhih/docker-parse-server/raw/master/docker-compose.yml -O - | APP_ID=YOUR_APP_ID MASTER_KEY=YOUR_MASTER_KEY docker-compose up -d -f - # not supported for docker-compose container`\n\n### :paperclip: Deploy to Cloud Services\n* [Heroku + Mongolab Development](ADVANCE.md#getting-started-with-heroku--mongolab-development)\n* [AWS Elastic Beanstalk](ADVANCE.md#getting-started-with-aws-elastic-beanstalk)\n* [Microsoft Azure App Service](ADVANCE.md#getting-started-with-microsoft-azure-app-service)\n* [Google App Engine](ADVANCE.md#getting-started-with-google-app-engine)\n* [Scalingo](ADVANCE.md#getting-started-with-scalingo)\n\n## :zap: Advance topics\n* [How to use with existing mongodb with DATABASE_URI](ADVANCE.md#how-to-use-with-existing-mongodb-with-database_uri)\n* [How to use with existing parse-cloud-code](ADVANCE.md#how-to-use-with-existing-parse-cloud-code)\n* [How to use with custom authentication](ADVANCE.md#how-to-use-with-custom-authentication)\n* [How to specify parse-server version](ADVANCE.md#how-to-specify-parse-server-version)\n* [How to specify latest commit of parse-server](ADVANCE.md#how-to-specify-latest-commit-of-parseplatformparse-server-of-image)\n* [How to start parse dashboard as standalone](ADVANCE.md#how-to-start-parse-dashboard-as-standalone)\n* [How to setup SSL with letsencrypt](ADVANCE.md#how-to-setup-ssl-with-letsencrypt)\n* [How to setup push notification](ADVANCE.md#how-to-setup-push-notification)\n* [How to integrate parse-cloud-code image on GitHub and DockerHub](ADVANCE.md#how-to-integrate-parse-cloud-code-image-on-github-and-dockerhub)\n* [How to config Docker](ADVANCE.md#how-to-config-docker)\n* [How to config Docker Compose](ADVANCE.md#how-to-config-docker-compose)\n* [How to import ssh-key from github](ADVANCE.md#how-to-import-ssh-key-from-github)\n\n## :fire: Server Side Developments\nHow to push cloud code to server  \n[![Screencast - git](https://github.com/yongjhih/docker-parse-server/raw/master/art/docker-parse-server-git.gif)](https://youtu.be/9YwWbiRyPUU)\n```sh\n# This command wil create a SSH keys for you as\n#  ~/.ssh/id_rsa.pub and another private key.\n# you can leave the options balnk by pressing enter.\n\n$ ssh-keygen -t rsa\n\n# If git container name is `parse-cloud-code-git`\n$ docker exec -i parse-cloud-code-git ssh-add-key < ~/.ssh/id_rsa.pub\n\n# port 2022, repo path is `/parse-cloud-code`\n$ git clone ssh://git@localhost:2022/parse-cloud-code\n$ cd parse-cloud-code\n$ echo \"Parse.Cloud.define('hello', function(req, res) { res.success('Hi, git'); });\" > main.js\n$ git add main.js && git commit -m 'Update main.js'\n$ git push origin master\n\n$ curl -X POST \\\n  -H \"X-Parse-Application-Id: ${APP_ID}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}' \\\n  http://localhost:1337/parse/functions/hello\n```\n\n## :iphone: Client Side Developments\nYou can use the REST API, the JavaScript SDK, and any of our open-source SDKs:\n\n### :paperclip: curl example\n```\ncurl -X POST \\\n  -H \"X-Parse-Application-Id: YOUR_APP_ID\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"score\":1337,\"playerName\":\"Sean Plott\",\"cheatMode\":false}' \\\n  http://localhost:1337/parse/classes/GameScore\n\ncurl -X POST \\\n  -H \"X-Parse-Application-Id: YOUR_APP_ID\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}' \\\n  http://localhost:1337/parse/functions/hello\n\ncurl -H \"X-Parse-Application-Id: YOUR_APP_ID\" \\\n     -H \"X-Parse-Master-Key: YOUR_MASTER_KEY\" \\\n     -H \"Content-Type: application/json\" \\\n     http://localhost:1337/parse/serverInfo\n```\n### :paperclip: JavaScript example\n```\nParse.initialize('YOUR_APP_ID','unused');\nParse.serverURL = 'https://whatever.herokuapp.com';\nvar obj = new Parse.Object('GameScore');\nobj.set('score',1337);\nobj.save().then(function(obj) {\n  console.log(obj.toJSON());\n  var query = new Parse.Query('GameScore');\n  query.get(obj.id).then(function(objAgain) {\n    console.log(objAgain.toJSON());\n  }, function(err) {console.log(err); });\n}, function(err) { console.log(err); });\n```\n### :paperclip: Android example\n```\n//in your application class\n\nParse.initialize(new Parse.Configuration.Builder(getApplicationContext())\n        .applicationId(\"YOUR_APP_ID\")\n        .clientKey(\"YOUR_CLIENT_ID\")\n        .server(\"http://YOUR_SERVER_URL/parse/\")   // '/' important after 'parse'\n        .build());\n\n  ParseObject testObject = new ParseObject(\"TestObject\");\n  testObject.put(\"foo\", \"bar\");\n  testObject.saveInBackground();\n\n```\n### :paperclip: iOS example\n```\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:AnyObject]?) -> Bool {\n        let configuration = ParseClientConfiguration {\n            $0.applicationId = \"YOUR_APP_ID\"\n            $0.clientKey = \"YOUR_CLIENT_ID\"\n            $0.server = \"http://YOUR_SERVER_URL/parse\"\n        }\n        Parse.initializeWithConfiguration(configuration)\n    }\n}\n```\n\n### :paperclip: GraphQL\nRun with GraphQL support.\n```shell\nGRAPHQL_SUPPORT=true APP_ID=YOUR_APP_ID MASTER_KEY=YOUR_MASTER_KEY SERVER_URL=http://localhost:1337/parse docker-compose up -d\n```\n> Make sure `./cloud/graphql/schema.js` is pushed to cloud code.  \n> Then navigate to [http://localhost:1337/graphql?query=%7B%0A%20%20hello%0A%7D%0A](http://localhost:1337/graphql?query=%7B%0A%20%20hello%0A%7D%0A)  \n\n![](./art/graphql.png)\n\n## :eyes: See Also\n* https://github.com/ParsePlatform/parse-server\n* http://blog.parse.com/announcements/introducing-parse-server-and-the-database-migration-tool/\n* https://parse.com/docs/server/guide#migrating\n* https://hub.docker.com/r/yongjhih/parse-server/\n* https://github.com/yongjhih/parse-cloud-code\n* https://hub.docker.com/r/yongjhih/parse-cloud-code/\n* https://medium.com/cowbear-coder/migration-of-parse-server-with-docker-part1-87034cc29978\n* https://github.com/yongjhih/docker-parse-dashboard\n* [Docker ❤ Parse](https://medium.com/@katopz/docker-parse-782d27761e24)\n* [DigitalOcean ❤ Parse](https://medium.com/@katopz/digitalocean-parse-e68d8b71e8eb)\n\n## :thumbsup: Contributors & Credits\n[![didierfranc](https://github.com/didierfranc.png?size=40)](https://github.com/didierfranc)\n[![ArnaudValensi](https://github.com/ArnaudValensi.png?size=40)](https://github.com/ArnaudValensi)\n[![gerhardsletten](https://github.com/gerhardsletten.png?size=40)](https://github.com/gerhardsletten)\n[![acinader](https://github.com/acinader.png?size=40)](https://github.com/acinader)\n[![kandelvijaya](https://github.com/kandelvijaya.png?size=40)](https://github.com/kandelvijaya)\n[<img src=\"https://github.com/mjdev.png?size=40\" data-canonical-src=\"https://github.com/mjdev.png?size=40\" width=\"40\" height=\"40\"/>](https://github.com/mjdev)\n[![vitaminwater](https://github.com/vitaminwater.png?size=40)](https://github.com/vitaminwater)\n[<img src=\"https://github.com/euklid.png?size=40\" data-canonical-src=\"https://github.com/euklid.png?size=40\" width=\"40\" height=\"40\"/>](https://github.com/euklid)\n[<img src=\"https://github.com/walkerlee.png?size=40\" data-canonical-src=\"https://github.com/walkerlee.png?size=40\" width=\"40\" height=\"40\"/>](https://github.com/walkerlee)\n[<img src=\"https://github.com/chainkite.png?size=40\" data-canonical-src=\"https://github.com/chainkite.png?size=40\" width=\"40\" height=\"40\"/>](https://github.com/chainkite)\n[![cleever](https://github.com/cleever.png?size=40)](https://github.com/cleever)\n[![katopz](https://github.com/katopz.png?size=40)](https://github.com/katopz)\n"
  },
  {
    "path": "app.json",
    "content": "{\n  \"name\": \"Parse Server\",\n  \"description\": \"A Parse API server using the parse-server module\",\n  \"repository\": \"https://github.com/yongjhih/docker-parse-server\",\n  \"logo\": \"https://avatars0.githubusercontent.com/u/1294580?v=3&s=200\",\n  \"keywords\": [\"node\", \"express\", \"parse\"],\n  \"env\": {\n    \"PARSE_MOUNT\": {\n      \"description\": \"Configure Parse API route.\",\n      \"value\": \"/parse\"\n    },\n    \"APP_ID\": {\n      \"description\": \"A unique identifier for your app.\",\n      \"value\": \"myAppId\"\n    },\n    \"MASTER_KEY\": {\n      \"description\": \"A key that overrides all permissions. Keep this secret.\",\n      \"value\": \"myMasterKey\"\n    },\n    \"SERVER_URL\": {\n      \"description\": \"URL to connect to your Heroku instance (leave as http://localhost)\",\n      \"value\": \"http://localhost/parse\"\n    }\n  },\n  \"image\": \"heroku/nodejs\",\n  \"addons\": [\"mongolab\"]\n}\n"
  },
  {
    "path": "app.yaml",
    "content": "runtime: nodejs\nvm: true\n\nenv_variables:\n  # --REQUIRED--\n  DATABASE_URI: mongodb://localhost:27017/dev\n  APP_ID: <your-app-id>\n  MASTER_KEY: <your-master-key>\n  # --OPTIONAL--\n  # FILE_KEY: <your-file-key>\n  # PARSE_MOUNT: /parse\n  # CLOUD_CODE_MAIN:  "
  },
  {
    "path": "azuredeploy.json",
    "content": "{\n  \"$schema\": \"http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#\",\n  \"contentVersion\": \"1.0.0.0\",\n  \"parameters\": {\n    \"siteName\": {\n      \"type\": \"string\"\n    },\n    \"hostingPlanName\": {\n      \"type\": \"string\"\n    },\n    \"siteLocation\": {\n      \"type\": \"string\"\n    },\n    \"sku\": {\n      \"type\": \"string\",\n      \"allowedValues\": [\n        \"Free\",\n        \"Shared\",\n        \"Basic\",\n        \"Standard\"\n      ],\n      \"defaultValue\": \"Free\"\n    },\n    \"workerSize\": {\n      \"type\": \"string\",\n      \"allowedValues\": [\n        \"0\",\n        \"1\",\n        \"2\"\n      ],\n      \"defaultValue\": \"0\"\n    },\n    \"mongoConnectionString\": {\n      \"type\": \"string\",\n      \"minLength\": 5\n    },\n    \"parseAppId\": {\n      \"type\": \"string\",\n      \"minLength\": 1,\n      \"defaultValue\": \"myAppId\"\n    },\n    \"parseMasterKey\": {\n      \"type\": \"string\",\n      \"minLength\": 1,\n      \"defaultValue\": \"myMasterKey\"\n    },\n    \"parseServerUrl\": {\n      \"type\": \"string\",\n      \"minLength\": 1,\n      \"defaultValue\": \"http://yourappname.azure.com/parse\"\n    },\n    \"repoURL\": {\n      \"type\": \"string\",\n      \"defaultValue\": \"https://github.com/yongjhih/docker-parse-server.git\",\n      \"metadata\": {\n        \"description\": \"The URL for the GitHub repository that contains the project to deploy.\"\n      }\n    },\n    \"branch\": {\n      \"type\": \"string\",\n      \"defaultValue\": \"master\",\n      \"metadata\": {\n        \"description\": \"The branch of the GitHub repository to use.\"\n      }\n    }\n  },\n  \"resources\": [\n    {\n      \"apiVersion\": \"2014-06-01\",\n      \"name\": \"[parameters('hostingPlanName')]\",\n      \"type\": \"Microsoft.Web/serverFarms\",\n      \"location\": \"[parameters('siteLocation')]\",\n      \"properties\": {\n        \"name\": \"[parameters('hostingPlanName')]\",\n        \"sku\": \"[parameters('sku')]\",\n        \"workerSize\": \"[parameters('workerSize')]\",\n        \"numberOfWorkers\": 1\n      }\n    },\n    {\n      \"apiVersion\": \"2014-06-01\",\n      \"name\": \"[parameters('siteName')]\",\n      \"type\": \"Microsoft.Web/Sites\",\n      \"location\": \"[parameters('siteLocation')]\",\n      \"dependsOn\": [\n        \"[concat('Microsoft.Web/serverFarms/', parameters('hostingPlanName'))]\"\n      ],\n      \"tags\": {\n        \"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]\": \"empty\"\n      },\n      \"properties\": {\n        \"name\": \"[parameters('siteName')]\",\n        \"serverFarm\": \"[parameters('hostingPlanName')]\"\n      },\n      \"resources\": [\n        {\n          \"apiVersion\": \"2014-04-01\",\n          \"type\": \"config\",\n          \"name\": \"web\",\n          \"dependsOn\": [\n            \"[concat('Microsoft.Web/Sites/', parameters('siteName'))]\"\n          ],\n          \"properties\": {\n            \"appSettings\": [\n              {\n                \"name\": \"DATABASE_URI\",\n                \"value\": \"[parameters('mongoConnectionString')]\"\n              },\n            {\n            \"name\": \"APP_ID\",\n            \"value\": \"[parameters('parseAppId')]\"\n            },\n            {\n            \"name\": \"MASTER_KEY\",\n            \"value\": \"[parameters('parseMasterKey')]\"\n            },\n            {\n            \"name\": \"SERVER_URL\",\n            \"value\": \"[parameters('parseServerUrl')]\"\n            },\n            {\n                \"name\": \"WEBSITE_NODE_DEFAULT_VERSION\",\n                \"value\": \"4.2.3\"\n            }\n            ]\n          }\n        },\n        {\n          \"apiVersion\": \"2015-04-01\",\n          \"name\": \"web\",\n          \"type\": \"sourcecontrols\",\n          \"dependsOn\": [\n            \"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]\"\n          ],\n          \"properties\": {\n            \"RepoUrl\": \"[parameters('repoURL')]\",\n            \"branch\": \"[parameters('branch')]\",\n            \"IsManualIntegration\": true\n          }\n        }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "cloud/Dockerfile",
    "content": "#FROM scratch\nFROM busybox\n\nADD *.js /parse/cloud/\n\nWORKDIR /parse/cloud\n"
  },
  {
    "path": "cloud/func.js",
    "content": "Parse.Cloud.define('hi', function(req, res) {\n  res.success('Hi');\n});\n"
  },
  {
    "path": "cloud/graphql/schema.js",
    "content": "var graphql = require('graphql')\nvar GraphQLSchema = graphql.GraphQLSchema\nvar GraphQLObjectType = graphql.GraphQLObjectType\nvar GraphQLString = graphql.GraphQLString\n\nmodule.exports = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: 'RootQueryType',\n    fields: {\n      hello: {\n        type: GraphQLString,\n        resolve() {\n          return 'world';\n        }\n      }\n    }\n  })\n});\n"
  },
  {
    "path": "cloud/main.js",
    "content": "\nParse.Cloud.define('hello', function(req, res) {\n  res.success('Hi');\n});\n"
  },
  {
    "path": "dev/Dockerfile",
    "content": "FROM node:latest\n\nENV PARSE_HOME /parse\n\nRUN apt-get update && \\\n    apt-get install -y --no-install-recommends git openssh-server && \\\n    git clone https://github.com/ParsePlatform/parse-server.git $PARSE_HOME && \\\n    apt-get clean && \\\n    rm -rf /var/lib/apt/lists/*\n\n#ADD . ${PARSE_HOME}\n#ADD *.js ${PARSE_HOME}/\n#ADD *.json ${PARSE_HOME}/\n\nENV CLOUD_CODE_HOME ${PARSE_HOME}/cloud\nADD cloud/*.js $CLOUD_CODE_HOME/\n\nWORKDIR $PARSE_HOME\nRUN npm install\n\n## ENV\n#ENV APP_ID myAppId\n#ENV MASTER_KEY myMasterKey\n#ENV DATABASE_URI mongodb://localhost:27017/dev\nENV CLOUD_CODE_MAIN ${CLOUD_CODE_HOME}/main.js\n#ENV PARSE_MOUNT /parse\n#ENV COLLECTION_PREFIX\n#ENV CLIENT_KEY\n#ENV REST_API_KEY\n#ENV DOTNET_KEY\n#ENV JAVASCRIPT_KEY\n#ENV DOTNET_KEY\n#ENV FILE_KEY\n#ENV FACEBOOK_APP_IDS \"xx,xxx\"\n#ENV SERVER_URL http://localhost:1337/parse\n\nENV PORT 1337\n\nEXPOSE $PORT\nVOLUME $CLOUD_CODE_HOME\n\nENV SSH_PORT 2022\nEXPOSE $SSH_PORT\n\nADD ssh-add-key /usr/bin/ssh-add-key\n\nRUN useradd -s /bin/bash git\nRUN echo \"git ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers\n\nRUN mkdir -p /parse-cloud-code && \\\n    chown -R git:git /parse-cloud-code && \\\n    chown -R git:git /parse/cloud\n\nENV TINI_VERSION v0.9.0\nADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini\nADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc\nRUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0527A9B7 && \\\n    gpg --verify /tini.asc && \\\n    chmod a+x /tini\n\nADD docker-entrypoint.sh /\nENTRYPOINT [\"/tini\", \"--\", \"/docker-entrypoint.sh\"]\nCMD [\"npm\", \"start\"]\n"
  },
  {
    "path": "dev/cloud/Dockerfile",
    "content": "#FROM scratch\nFROM busybox\n\nADD *.js /parse/cloud/\n\nWORKDIR /parse/cloud\n"
  },
  {
    "path": "dev/cloud/func.js",
    "content": "Parse.Cloud.define('hi', function(req, res) {\n  res.success('Hi');\n});\n"
  },
  {
    "path": "dev/cloud/graphql/schema.js",
    "content": "var graphql = require('graphql')\nvar GraphQLSchema = graphql.GraphQLSchema\nvar GraphQLObjectType = graphql.GraphQLObjectType\nvar GraphQLString = graphql.GraphQLString\n\nmodule.exports = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: 'RootQueryType',\n    fields: {\n      hello: {\n        type: GraphQLString,\n        resolve() {\n          return 'world';\n        }\n      }\n    }\n  })\n});\n"
  },
  {
    "path": "dev/cloud/main.js",
    "content": "\nParse.Cloud.define('hello', function(req, res) {\n  res.success('Hi');\n});\n"
  },
  {
    "path": "dev/docker-compose.yml",
    "content": "parse-server:\n  #build: .\n  image: yongjhih/parse-server:dev\n  ports:\n    - \"1337:1337\"\n    - \"2022:22\"\n  environment:\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n    SERVER_URL: $SERVER_URL\n    MAX_UPLOAD_SIZE: $MAX_UPLOAD_SIZE\n  links:\n    - mongo\n  volumes_from:\n    - parse-cloud-code\nparse-cloud-code:\n  #build: cloud/.\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\nmongo:\n  image: mongo\n  ports:\n    - \"27017:27017\"\n  volumes_from:\n    - mongo-data\n#  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false --rest --auth\"\n  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false\"\n# ref. http://www.diogogmt.com/running-mongodb-with-docker-and-compose/\nmongo-data:\n  image: mongo\n  volumes:\n    - /data/db\n  command: \"--break-mongo\"\n\nparse-dashboard:\n  image: yongjhih/parse-dashboard\n  links:\n    - parse-server\n  environment:\n    PARSE_SERVER_URL: $PARSE_SERVER_URL\n    PARSE_APP_ID: $PARSE_APP_ID\n    PARSE_MASTER_KEY: $PARSE_MASTER_KEY\n    PARSE_JS_KEY: $PARSE_JS_KEY\n    PARSE_REST_KEY: $PARSE_REST_KEY\n    PARSE_APP_NAME: $PARSE_APP_NAME\n    SERVER_URL: $SERVER_URL\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    APP_NAME: $APP_NAME\n  ports:\n    - \"4040:4040\"\n\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "dev/docker-entrypoint.sh",
    "content": "#!/usr/bin/env bash\n\nset -e\n\n/etc/init.d/ssh start > /dev/null\n\nif [ ! -d /parse-cloud-code ]; then\n    mkdir -p /parse-cloud-code\n\n    git init --bare /parse-cloud-code > /dev/null\n\n    cat << EOF > /parse-cloud-code/hooks/post-receive\n#!/bin/bash\nunset GIT_INDEX_FILE\ngit --work-tree=\"${CLOUD_CODE_HOME}\" clean -df\ngit --work-tree=\"${CLOUD_CODE_HOME}\" checkout -f\nEOF\n\n    chmod a+x /parse-cloud-code/hooks/post-receive > /dev/null\n\n    chown -R git:git /parse-cloud-code > /dev/null\n    chown -R git:git \"$CLOUD_CODE_HOME\" > /dev/null\nfi\n\n# mapping from cli-definitions.js\nexport PARSE_SERVER_APPLICATION_ID=\"${PARSE_SERVER_APPLICATION_ID:-$APP_ID}\"\nexport PARSE_SERVER_MASTER_KEY=\"${PARSE_SERVER_MASTER_KEY:-$MASTER_KEY}\"\nexport PARSE_SERVER_DATABASE_URI=\"${PARSE_SERVER_DATABASE_URI:-$DATABASE_URI}\"\nexport PARSE_SERVER_SERVER_URL=\"${PARSE_SERVER_URL:-$SERVER_URL}\"\nexport PARSE_SERVER_CLIENT_KEY=\"${PARSE_SERVER_CLIENT_KEY:-$CLIENT_KEY}\"\nexport PARSE_SERVER_JAVASCRIPT_KEY=\"${PARSE_SERVER_JAVASCRIPT_KEY:-$JAVASCRIPT_KEY}\"\nexport PARSE_SERVER_REST_API_KEY=\"${PARSE_SERVER_REST_API_KEY:-$REST_API_KEY}\"\nexport PARSE_SERVER_DOT_NET_KEY=\"${PARSE_SERVER_DOT_NET_KEY:-$DOT_NET_KEY}\"\nexport PARSE_SERVER_CLOUD_CODE_MAIN=\"${PARSE_SERVER_CLOUD_CODE_MAIN:-$CLOUD_CODE_MAIN}\"\nexport PARSE_SERVER_PUSH=\"${PARSE_SERVER_PUSH:-$PUSH}\"\nexport PARSE_SERVER_OAUTH_PROVIDERS=\"${PARSE_SERVER_OAUTH_PROVIDERS:-$OAUTH_PROVIDERS}\"\nexport PARSE_SERVER_FILE_KEY=\"${PARSE_SERVER_FILE_KEY:-$FILE_KEY}\"\nexport PARSE_SERVER_FACEBOOK_APP_IDS=\"${PARSE_SERVER_FACEBOOK_APP_IDS:-$FACEBOOK_APP_IDS}\"\nexport PARSE_SERVER_ENABLE_ANON_USERS=\"${PARSE_SERVER_ENABLE_ANON_USERS:-$ENABLE_ANON_USERS}\"\nexport PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION=\"${PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION:-$ALLOW_CLIENT_CLASS_CREATION}\"\nexport PARSE_SERVER_MOUNT_PATH=\"${PARSE_SERVER_MOUNT_PATH:-$PARSE_MOUNT}\"\nexport PARSE_SERVER_DATABASE_ADAPTER=\"${PARSE_SERVER_DATABASE_ADAPTER:-$DATABASE_ADAPTER}\"\nexport PARSE_SERVER_FILES_ADAPTER=\"${PARSE_SERVER_FILES_ADAPTER:-$FILES_ADAPTER}\"\nexport PARSE_SERVER_LOGGER_ADAPTER=\"${PARSE_SERVER_LOGGER_ADAPTER:-$LOGGER_ADAPTER}\"\nexport PARSE_SERVER_MAX_UPLOAD_SIZE=\"${PARSE_SERVER_MAX_UPLOAD_SIZE:-$MAX_UPLOAD_SIZE}\"\n\n# Allow update /parse/cloud via git\nsed -i 's#\"start\": \"./bin/parse-server\"#\"start\": \"nodemon --watch /parse/cloud ./bin/parse-server\"#' package.json > /dev/null\n\nnpm run build > /dev/null 2>&1\nexec \"$@\"\n"
  },
  {
    "path": "dev/run",
    "content": "#!/usr/bin/env bash\n\nimage=\"$1\"\nappId=\"${2:-appId}\"\nmasterKey=\"${3:-mastarKey}\"\n\ndocker run -it                       \\\n           -e APP_ID=$appId          \\\n           -e MASTER_KEY=$masterKey  \\\n           -p 1337:1337              \\\n           -p 2022:22                \\\n           --name parse-server       \\\n           $image\n"
  },
  {
    "path": "dev/ssh-add-key",
    "content": "#!/usr/bin/env bash\n\nset -e\n\nif [ ! -d ~/.ssh/ ]; then\n    mkdir -p ~/.ssh/\nfi\n\nif [ ! -d /home/git/.ssh/ ]; then\n    mkdir -p /home/git/.ssh/\n    touch /home/git/.ssh/authorized_keys\n    chown git:git /home/git/.ssh/authorized_keys\nfi\n\nwhile read line; do\n  echo \"$line\" >> ~/.ssh/authorized_keys\n  echo \"$line\" >> /home/git/.ssh/authorized_keys\ndone\n"
  },
  {
    "path": "docker/git/Dockerfile",
    "content": "FROM debian:jessie\n\nENV DEBIAN_FRONTEND noninteractive\n\nRUN apt-get update && \\\n    apt-get install -y --no-install-recommends git openssh-server && \\\n    apt-get clean && \\\n    rm -rf /var/lib/apt/lists/* && \\\n    sed -i \"s/UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g\" /etc/ssh/sshd_config\n\n# Missing privilege separation directory: /var/run/sshd\n\nENV PORT 22\nEXPOSE $PORT\n\nENV WORKTREE \"/parse/cloud\"\nENV REPO_PATH \"/parse-cloud-code\"\n\nADD ssh-add-key /sbin/\n\nRUN useradd -s /bin/bash git\nRUN echo \"git ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers\n\nADD docker-entrypoint.sh /\nENTRYPOINT [\"/docker-entrypoint.sh\"]\n\nCMD [\"/usr/sbin/sshd\", \"-D\"]\n"
  },
  {
    "path": "docker/git/docker-entrypoint.sh",
    "content": "#!/usr/bin/env bash\n\nset -e\n\nif [ ! -d ${REPO_PATH} ]; then\n    mkdir -p ${REPO_PATH}\n\n    git init --bare ${REPO_PATH} > /dev/null\n\n    cat << EOF > ${REPO_PATH}/hooks/post-receive\n#!/bin/bash\nunset GIT_INDEX_FILE\ngit --work-tree=\"${WORKTREE}\" clean -df\ngit --work-tree=\"${WORKTREE}\" checkout -f\nEOF\n\n    chmod a+x ${REPO_PATH}/hooks/post-receive > /dev/null\n\n    chown -R git:git ${REPO_PATH} > /dev/null\n    chown -R git:git \"$WORKTREE\" > /dev/null\nfi\n\nexec \"$@\"\n"
  },
  {
    "path": "docker/git/ssh-add-key",
    "content": "#!/usr/bin/env bash\n\nset -e\n\nif [ ! -d ~/.ssh/ ]; then\n    mkdir -p ~/.ssh/\nfi\n\nif [ ! -d /home/git/.ssh/ ]; then\n    mkdir -p /home/git/.ssh/\n    touch /home/git/.ssh/authorized_keys\n    chown git:git /home/git/.ssh/authorized_keys\nfi\n\nwhile read line; do\n  echo \"$line\" >> ~/.ssh/authorized_keys\n  echo \"$line\" >> /home/git/.ssh/authorized_keys\ndone\n"
  },
  {
    "path": "docker-compose-le.yml",
    "content": "parse-server:\n  #build: .\n  image: yongjhih/parse-server\n  ports:\n    - \"1337:1337\"\n  environment:\n    PORT: 1337\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT # /parse\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n    SERVER_URL: $SERVER_URL\n    MAX_UPLOAD_SIZE: $MAX_UPLOAD_SIZE # 20mb\n    GCM_ID: $GCM_ID\n    GCM_KEY: $GCM_KEY\n    PRODUCTION_PFX: $PRODUCTION_PFX\n    PRODUCTION_PASSPHRASE: $PRODUCTION_PASSPHRASE\n    PRODUCTION_BUNDLE_ID: $PRODUCTION_BUNDLE_ID\n    PRODUCTION_CERT: $PRODUCTION_CERT # prodCert.pem\n    PRODUCTION_KEY: $PRODUCTION_KEY # prodKey.pem\n    DEV_PFX: $DEV_PFX\n    DEV_PASSPHRASE: $DEV_PASSPHRASE\n    DEV_BUNDLE_ID: $DEV_BUNDLE_ID\n    DEV_CERT: $DEV_CERT # devCert.pem\n    DEV_KEY: $DEV_KEY # devKey.pem\n    VERIFY_USER_EMAILS: $VERIFY_USER_EMAILS # 0\n    EMAIL_MODULE: $EMAIL_MODULE # \"\" or \"parse-server-mailgun-adapter-template\"\n    EMAIL_FROM: $EMAIL_FROM\n    EMAIL_DOMAIN: $EMAIL_DOMAIN\n    EMAIL_API_KEY: $EMAIL_API_KEY\n    EMAIL_DISPLAY_NAME: $EMAIL_DISPLAY_NAME\n    EMAIL_REPLY_TO: $EMAIL_REPLY_TO\n    EMAIL_VERIFICATION_SUBJECT: $EMAIL_VERIFICATION_SUBJECT\n    EMAIL_VERIFICATION_BODY: $EMAIL_VERIFICATION_BODY\n    EMAIL_VERIFICATION_BODY_HTML: $EMAIL_VERIFICATION_BODY_HTML\n    EMAIL_PASSWORD_RESET_SUBJECT: $EMAIL_PASSWORD_RESET_SUBJECT\n    EMAIL_PASSWORD_RESET_BODY: $EMAIL_PASSWORD_RESET_BODY\n    EMAIL_PASSWORD_RESET_BODY_HTML: $EMAIL_PASSWORD_RESET_BODY_HTML\n    ENABLE_ANON_USERS: $ENABLE_ANON_USERS # 1\n    ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # 1\n    PARSE_EXPERIMENTAL_CONFIG_ENABLED: $PARSE_EXPERIMENTAL_CONFIG_ENABLED # 0\n    TESTING: $TESTING # 0\n    APP_NAME: $APP_NAME\n    PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL\n    TRUST_PROXY:      $TRUST_PROXY\n    S3_ACCESS_KEY:    $S3_ACCESS_KEY\n    S3_SECRET_KEY:    $S3_SECRET_KEY\n    S3_BUCKET:        $S3_BUCKET\n    S3_DIRECT:        $S3_DIRECT\n    GCP_PROJECT_ID:   $GCP_PROJECT_ID\n    GCP_KEYFILE_PATH: $GCP_KEYFILE_PATH\n    GCS_BUCKET:       $GCS_BUCKET\n    GCS_DIRECT:       $GCS_DIRECT\n    AZURE_ACCOUNT:    $AZURE_ACCOUNT\n    AZURE_CONTAINER:  $AZURE_CONTAINER\n    AZURE_ACCESS_KEY: $AZURE_ACCESS_KEY\n    AZURE_DIRECT:     $AZURE_DIRECT\n    VIRTUAL_HOST:      $PARSE_SERVER_VIRTUAL_HOST\n    LETSENCRYPT_HOST:  $PARSE_SERVER_LETSENCRYPT_HOST\n    LETSENCRYPT_EMAIL: $PARSE_SERVER_LETSENCRYPT_EMAIL\n    GRAPHQL_SUPPORT:  $GRAPHQL_SUPPORT\n    GRAPHQL_SCHEMA:   $GRAPHQL_SCHEMA\n    LOG_LEVEL:        $LOG_LEVEL\n  links:\n    - mongo\n  volumes_from:\n    - parse-cloud-code\n  volumes:\n    - /parse/cloud\n    - \"./volumes/certs:/certs\"\n\nparse-cloud-code:\n  #build: cloud/.\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\n\ngit:\n  image: yongjhih/parse-server:git\n  ports:\n    - \"2022:22\"\n  environment:\n    PORT: 22\n    #WORKTREE: $GIT_WORKTREE\n    #REPO_PATH: $GIT_REPO_PATH\n  volumes_from:\n    - parse-server\n\nparse-cloud-code:\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\n\nmongo:\n  image: mongo:3.0.8 # ref. https://github.com/ParsePlatform/parse-server/issues/1913\n  ports:\n    - \"27017:27017\"\n  volumes_from:\n    - mongo-data\n#  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false --rest --auth\"\n  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false\"\n# ref. http://www.diogogmt.com/running-mongodb-with-docker-and-compose/\nmongo-data:\n  image: mongo\n  volumes:\n    - /data/db\n  command: \"--break-mongo\"\n\nparse-dashboard:\n  image: yongjhih/parse-dashboard\n  links:\n    - parse-server\n  environment:\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    APP_NAME: $APP_NAME\n    ALLOW_INSECURE_HTTP: $PARSE_DASHBOARD_ALLOW_INSECURE_HTTP\n    USER1: $USER1\n    USER1_PASSWORD: $USER1_PASSWORD\n    PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: $PARSE_DASHBOARD_ALLOW_INSECURE_HTTP\n    SERVER_URL: $SERVER_URL\n    PARSE_DASHBOARD_SERVER_URL: $SERVER_URL\n    PARSE_DASHBOARD_MASTER_KEY: $MASTER_KEY\n    PARSE_DASHBOARD_APP_ID: $APP_ID\n    PARSE_DASHBOARD_APP_NAME: $APP_NAME\n    PARSE_DASHBOARD_USER_ID: $USER1\n    PARSE_DASHBOARD_USER_PASSWORD: $USER1_PASSWORD\n    PARSE_DASHBOARD_CONFIG: $PARSE_DASHBOARD_CONFIG\n    MOUNT_PATH: $PARSE_DASHBOARD_MOUNT_PATH\n    TRUST_PROXY: $PARSE_DASHBOARD_TRUST_PROXY\n    VIRTUAL_HOST:      $PARSE_DASHBOARD_VIRTUAL_HOST\n    LETSENCRYPT_HOST:  $PARSE_DASHBOARD_LETSENCRYPT_HOST\n    LETSENCRYPT_EMAIL: $PARSE_DASHBOARD_LETSENCRYPT_EMAIL\n    PORT: 4040\n  ports:\n    - \"4040:4040\"\n#  volumes:\n#    - \"parse-dashboard-config.json:/src/Parse-Dashboard/parse-dashboard-config.json\"\n\nnginx:\n  image: nginx\n  container_name: nginx\n  ports:\n    - \"80:80\"\n    - \"443:443\"\n  volumes:\n    - \"/etc/nginx/conf.d\"\n    - \"/etc/nginx/vhost.d\"\n    - \"/usr/share/nginx/html\"\n    - \"./volumes/proxy/certs:/etc/nginx/certs:ro\"\nnginx-gen:\n  image: jwilder/docker-gen\n  container_name: nginx-gen\n  volumes:\n    - \"/var/run/docker.sock:/tmp/docker.sock:ro\"\n    - \"./volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro\"\n  volumes_from:\n    - nginx\n  entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -only-exposed -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf\nletsencrypt-nginx-proxy-companion:\n  image: jrcs/letsencrypt-nginx-proxy-companion\n  container_name: letsencrypt-nginx-proxy-companion\n  volumes_from:\n    - nginx\n  volumes:\n    - \"/var/run/docker.sock:/var/run/docker.sock:ro\"\n    - \"./volumes/proxy/certs:/etc/nginx/certs:rw\"\n  environment:\n    - NGINX_DOCKER_GEN_CONTAINER=nginx-gen\n\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "docker-compose-production.yml",
    "content": "parse-server:\n  #build: .\n  image: yongjhih/parse-server\n  ports:\n    - \"1337:1337\"\n  environment:\n    PORT: 1337\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT # /parse\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n    SERVER_URL: $SERVER_URL\n    MAX_UPLOAD_SIZE: $MAX_UPLOAD_SIZE # 20mb\n    GCM_ID: $GCM_ID\n    GCM_KEY: $GCM_KEY\n    PRODUCTION_PFX: $PRODUCTION_PFX\n    PRODUCTION_PASSPHRASE: $PRODUCTION_PASSPHRASE\n    PRODUCTION_BUNDLE_ID: $PRODUCTION_BUNDLE_ID\n    PRODUCTION_CERT: $PRODUCTION_CERT # prodCert.pem\n    PRODUCTION_KEY: $PRODUCTION_KEY # prodKey.pem\n    DEV_PFX: $DEV_PFX\n    DEV_PASSPHRASE: $DEV_PASSPHRASE\n    DEV_BUNDLE_ID: $DEV_BUNDLE_ID\n    DEV_CERT: $DEV_CERT # devCert.pem\n    DEV_KEY: $DEV_KEY # devKey.pem\n    VERIFY_USER_EMAILS: $VERIFY_USER_EMAILS # 0\n    EMAIL_MODULE: $EMAIL_MODULE # \"\" or \"parse-server-mailgun-adapter-template\"\n    EMAIL_FROM: $EMAIL_FROM\n    EMAIL_DOMAIN: $EMAIL_DOMAIN\n    EMAIL_API_KEY: $EMAIL_API_KEY\n    EMAIL_DISPLAY_NAME: $EMAIL_DISPLAY_NAME\n    EMAIL_REPLY_TO: $EMAIL_REPLY_TO\n    EMAIL_VERIFICATION_SUBJECT: $EMAIL_VERIFICATION_SUBJECT\n    EMAIL_VERIFICATION_BODY: $EMAIL_VERIFICATION_BODY\n    EMAIL_VERIFICATION_BODY_HTML: $EMAIL_VERIFICATION_BODY_HTML\n    EMAIL_PASSWORD_RESET_SUBJECT: $EMAIL_PASSWORD_RESET_SUBJECT\n    EMAIL_PASSWORD_RESET_BODY: $EMAIL_PASSWORD_RESET_BODY\n    EMAIL_PASSWORD_RESET_BODY_HTML: $EMAIL_PASSWORD_RESET_BODY_HTML\n    ENABLE_ANON_USERS: $ENABLE_ANON_USERS # 1\n    ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # 1\n    PARSE_EXPERIMENTAL_CONFIG_ENABLED: $PARSE_EXPERIMENTAL_CONFIG_ENABLED # 0\n    TESTING: $TESTING # 0\n    APP_NAME: $APP_NAME\n    PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL\n    TRUST_PROXY: $TRUST_PROXY\n    S3_ACCESS_KEY:    $S3_ACCESS_KEY\n    S3_SECRET_KEY:    $S3_SECRET_KEY\n    S3_BUCKET:        $S3_BUCKET\n    S3_DIRECT:        $S3_DIRECT\n    GCP_PROJECT_ID:   $GCP_PROJECT_ID\n    GCP_KEYFILE_PATH: $GCP_KEYFILE_PATH\n    GCS_BUCKET:       $GCS_BUCKET\n    GCS_DIRECT:       $GCS_DIRECT\n    AZURE_ACCOUNT:    $AZURE_ACCOUNT\n    AZURE_CONTAINER:  $AZURE_CONTAINER\n    AZURE_ACCESS_KEY: $AZURE_ACCESS_KEY\n    AZURE_DIRECT:     $AZURE_DIRECT\n    GRAPHQL_SUPPORT:  $GRAPHQL_SUPPORT\n    GRAPHQL_SCHEMA:   $GRAPHQL_SCHEMA\n    LOG_LEVEL:        $LOG_LEVEL\n  links:\n    - mongo\n  volumes_from:\n    - parse-cloud-code\n  volumes:\n    - /parse/cloud\n    - \"./volumes/certs:/certs\"\n\nparse-cloud-code:\n  #build: cloud/.\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\n\ngit:\n  image: yongjhih/parse-server:git\n  ports:\n    - \"2022:22\"\n  environment:\n    PORT: 22\n    #WORKTREE: $GIT_WORKTREE\n    #REPO_PATH: $GIT_REPO_PATH\n  volumes_from:\n    - parse-server\n\nmongo:\n  image: mongo:3.0.8 # ref. https://github.com/ParsePlatform/parse-server/issues/1913\n  ports:\n    - \"27017:27017\"\n  volumes_from:\n    - mongo-data\n#  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false --rest --auth\"\n  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false\"\n# ref. http://www.diogogmt.com/running-mongodb-with-docker-and-compose/\n\nmongo-data:\n  image: mongo\n  volumes:\n    - /data/db\n  command: \"--break-mongo\"\n\nparse-dashboard:\n  image: yongjhih/parse-dashboard:1.0.18\n  links:\n    - parse-server\n  environment:\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    APP_NAME: $APP_NAME\n    ALLOW_INSECURE_HTTP: $PARSE_DASHBOARD_ALLOW_INSECURE_HTTP\n    USER1: $USER1\n    USER1_PASSWORD: $USER1_PASSWORD\n    PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: $PARSE_DASHBOARD_ALLOW_INSECURE_HTTP\n    SERVER_URL: $SERVER_URL\n    PARSE_DASHBOARD_SERVER_URL: $SERVER_URL\n    PARSE_DASHBOARD_MASTER_KEY: $MASTER_KEY\n    PARSE_DASHBOARD_APP_ID: $APP_ID\n    PARSE_DASHBOARD_APP_NAME: $APP_NAME\n    PARSE_DASHBOARD_USER_ID: $USER1\n    PARSE_DASHBOARD_USER_PASSWORD: $USER1_PASSWORD\n    PARSE_DASHBOARD_CONFIG: $PARSE_DASHBOARD_CONFIG\n    MOUNT_PATH: $PARSE_DASHBOARD_MOUNT_PATH\n    TRUST_PROXY: $PARSE_DASHBOARD_TRUST_PROXY\n    PORT: 4040\n  ports:\n    - \"4040:4040\"\n  command: parse-dashboard\n#  volumes:\n#    - \"parse-dashboard-config.json:/src/Parse-Dashboard/parse-dashboard-config.json\"\n\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "docker-compose-without-dashboard.yml",
    "content": "parse-server:\n  #build: .\n  image: yongjhih/parse-server\n  ports:\n    - \"1337:1337\"\n  environment:\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT # /parse\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n    SERVER_URL: $SERVER_URL\n    MAX_UPLOAD_SIZE: $MAX_UPLOAD_SIZE # 20mb\n    GCM_ID: $GCM_ID\n    GCM_KEY: $GCM_KEY\n    PRODUCTION_PFX: $PRODUCTION_PFX\n    PRODUCTION_PASSPHRASE: $PRODUCTION_PASSPHRASE\n    PRODUCTION_BUNDLE_ID: $PRODUCTION_BUNDLE_ID\n    PRODUCTION_CERT: $PRODUCTION_CERT # prodCert.pem\n    PRODUCTION_KEY: $PRODUCTION_KEY # prodKey.pem\n    DEV_PFX: $DEV_PFX\n    DEV_PASSPHRASE: $DEV_PASSPHRASE\n    DEV_BUNDLE_ID: $DEV_BUNDLE_ID\n    DEV_CERT: $DEV_CERT # devCert.pem\n    DEV_KEY: $DEV_KEY # devKey.pem\n    VERIFY_USER_EMAILS: $VERIFY_USER_EMAILS # 0\n    EMAIL_MODULE: $EMAIL_MODULE # \"\" or \"parse-server-mailgun-adapter-template\"\n    EMAIL_FROM: $EMAIL_FROM\n    EMAIL_DOMAIN: $EMAIL_DOMAIN\n    EMAIL_API_KEY: $EMAIL_API_KEY\n    EMAIL_DISPLAY_NAME: $EMAIL_DISPLAY_NAME\n    EMAIL_REPLY_TO: $EMAIL_REPLY_TO\n    EMAIL_VERIFICATION_SUBJECT: $EMAIL_VERIFICATION_SUBJECT\n    EMAIL_VERIFICATION_BODY: $EMAIL_VERIFICATION_BODY\n    EMAIL_VERIFICATION_BODY_HTML: $EMAIL_VERIFICATION_BODY_HTML\n    EMAIL_PASSWORD_RESET_SUBJECT: $EMAIL_PASSWORD_RESET_SUBJECT\n    EMAIL_PASSWORD_RESET_BODY: $EMAIL_PASSWORD_RESET_BODY\n    EMAIL_PASSWORD_RESET_BODY_HTML: $EMAIL_PASSWORD_RESET_BODY_HTML\n    ENABLE_ANON_USERS: $ENABLE_ANON_USERS # 1\n    ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # 1\n    PARSE_EXPERIMENTAL_CONFIG_ENABLED: $PARSE_EXPERIMENTAL_CONFIG_ENABLED # 0\n    TESTING: $TESTING # 0\n    APP_NAME: $APP_NAME\n    PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL\n    TRUST_PROXY: $TRUST_PROXY\n    S3_ACCESS_KEY:    $S3_ACCESS_KEY\n    S3_SECRET_KEY:    $S3_SECRET_KEY\n    S3_BUCKET:        $S3_BUCKET\n    S3_DIRECT:        $S3_DIRECT\n    GCP_PROJECT_ID:   $GCP_PROJECT_ID\n    GCP_KEYFILE_PATH: $GCP_KEYFILE_PATH\n    GCS_BUCKET:       $GCS_BUCKET\n    GCS_DIRECT:       $GCS_DIRECT\n    AZURE_ACCOUNT:    $AZURE_ACCOUNT\n    AZURE_CONTAINER:  $AZURE_CONTAINER\n    AZURE_ACCESS_KEY: $AZURE_ACCESS_KEY\n    AZURE_DIRECT:     $AZURE_DIRECT\n    GRAPHQL_SUPPORT:  $GRAPHQL_SUPPORT\n    GRAPHQL_SCHEMA:   $GRAPHQL_SCHEMA\n    LOG_LEVEL:        $LOG_LEVEL\n  links:\n    - mongo\n  volumes_from:\n    - parse-cloud-code\n  volumes:\n    - /parse/cloud\n    - \"./volumes/certs:/certs\"\n\nparse-cloud-code:\n  #build: cloud/.\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\n\ngit:\n  image: yongjhih/parse-server:git\n  ports:\n    - \"2022:22\"\n  environment:\n    PORT: 22\n    #WORKTREE: $GIT_WORKTREE\n    #REPO_PATH: $GIT_REPO_PATH\n  volumes_from:\n    - parse-server\n\nmongo:\n  image: mongo:3.0.8 # ref. https://github.com/ParsePlatform/parse-server/issues/1913\n  ports:\n    - \"27017:27017\"\n  volumes_from:\n    - mongo-data\n#  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false --rest --auth\"\n  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false\"\n# ref. http://www.diogogmt.com/running-mongodb-with-docker-and-compose/\n\nmongo-data:\n  image: mongo\n  volumes:\n    - /data/db\n  command: \"--break-mongo\"\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "parse-server:\n  #build: .\n  image: yongjhih/parse-server\n  ports:\n    - \"1337:1337\"\n  environment:\n    PORT: 1337\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT # /parse\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n    SERVER_URL: $SERVER_URL\n    MAX_UPLOAD_SIZE: $MAX_UPLOAD_SIZE # 20mb\n    GCM_ID: $GCM_ID\n    GCM_KEY: $GCM_KEY\n    PRODUCTION_PFX: $PRODUCTION_PFX\n    PRODUCTION_PASSPHRASE: $PRODUCTION_PASSPHRASE\n    PRODUCTION_BUNDLE_ID: $PRODUCTION_BUNDLE_ID\n    PRODUCTION_CERT: $PRODUCTION_CERT # prodCert.pem\n    PRODUCTION_KEY: $PRODUCTION_KEY # prodKey.pem\n    DEV_PFX: $DEV_PFX\n    DEV_PASSPHRASE: $DEV_PASSPHRASE\n    DEV_BUNDLE_ID: $DEV_BUNDLE_ID\n    DEV_CERT: $DEV_CERT # devCert.pem\n    DEV_KEY: $DEV_KEY # devKey.pem\n    VERIFY_USER_EMAILS: $VERIFY_USER_EMAILS # 0\n    EMAIL_MODULE: $EMAIL_MODULE # \"\" or \"parse-server-simple-mailgun-adapter\"\n    EMAIL_FROM: $EMAIL_FROM\n    EMAIL_DOMAIN: $EMAIL_DOMAIN\n    EMAIL_API_KEY: $EMAIL_API_KEY\n    EMAIL_DISPLAY_NAME: $EMAIL_DISPLAY_NAME\n    EMAIL_REPLY_TO: $EMAIL_REPLY_TO\n    EMAIL_VERIFICATION_SUBJECT: $EMAIL_VERIFICATION_SUBJECT\n    EMAIL_VERIFICATION_BODY: $EMAIL_VERIFICATION_BODY\n    EMAIL_PASSWORD_RESET_SUBJECT: $EMAIL_PASSWORD_RESET_SUBJECT\n    EMAIL_PASSWORD_RESET_BODY: $EMAIL_PASSWORD_RESET_BODY\n    ENABLE_ANON_USERS: $ENABLE_ANON_USERS # 1\n    ALLOW_CLIENT_CLASS_CREATION: $ALLOW_CLIENT_CLASS_CREATION # 1\n    PARSE_EXPERIMENTAL_CONFIG_ENABLED: $PARSE_EXPERIMENTAL_CONFIG_ENABLED # 0\n    TESTING: $TESTING # 0\n    APP_NAME: $APP_NAME\n    PUBLIC_SERVER_URL: $PUBLIC_SERVER_URL\n    TRUST_PROXY: $TRUST_PROXY\n    S3_ACCESS_KEY:    $S3_ACCESS_KEY\n    S3_SECRET_KEY:    $S3_SECRET_KEY\n    S3_BUCKET:        $S3_BUCKET\n    S3_DIRECT:        $S3_DIRECT\n    GCP_PROJECT_ID:   $GCP_PROJECT_ID\n    GCP_KEYFILE_PATH: $GCP_KEYFILE_PATH\n    GCS_BUCKET:       $GCS_BUCKET\n    GCS_DIRECT:       $GCS_DIRECT\n    AZURE_ACCOUNT:    $AZURE_ACCOUNT\n    AZURE_CONTAINER:  $AZURE_CONTAINER\n    AZURE_ACCESS_KEY: $AZURE_ACCESS_KEY\n    AZURE_DIRECT:     $AZURE_DIRECT\n    LIVEQUERY_SUPPORT: $LIVEQUERY_SUPPORT\n    LIVEQUERY_CLASSES: $LIVEQUERY_CLASSES\n    GRAPHQL_SUPPORT:  $GRAPHQL_SUPPORT\n    GRAPHQL_SCHEMA:   $GRAPHQL_SCHEMA\n    LOG_LEVEL:        $LOG_LEVEL\n  links:\n    - mongo\n  volumes_from:\n    - parse-cloud-code\n  volumes:\n    - /parse/cloud\n    - \"./volumes/certs:/certs\"\n\nparse-cloud-code:\n  #build: cloud/.\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\n\ngit:\n  image: yongjhih/parse-server:git\n  ports:\n    - \"2022:22\"\n  environment:\n    PORT: 22\n    #WORKTREE: $GIT_WORKTREE\n    #REPO_PATH: $GIT_REPO_PATH\n  volumes_from:\n    - parse-server\n\nmongo:\n  image: mongo:3.0.8 # ref. https://github.com/ParsePlatform/parse-server/issues/1913\n  ports:\n    - \"27017:27017\"\n  volumes_from:\n    - mongo-data\n#  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false --rest --auth\"\n  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false\"\n# ref. http://www.diogogmt.com/running-mongodb-with-docker-and-compose/\n\nmongo-data:\n  image: mongo\n  volumes:\n    - /data/db\n  command: \"--break-mongo\"\n\nparse-dashboard:\n  image: yongjhih/parse-dashboard:1.0.18\n  #image: yongjhih/parse-dashboard\n  links:\n    - parse-server\n  environment:\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    APP_NAME: $APP_NAME\n    ALLOW_INSECURE_HTTP: $PARSE_DASHBOARD_ALLOW_INSECURE_HTTP\n    USER1: $USER1\n    USER1_PASSWORD: $USER1_PASSWORD\n    PARSE_DASHBOARD_ALLOW_INSECURE_HTTP: $PARSE_DASHBOARD_ALLOW_INSECURE_HTTP\n    SERVER_URL: $SERVER_URL\n    PARSE_DASHBOARD_SERVER_URL: $SERVER_URL\n    PARSE_DASHBOARD_MASTER_KEY: $MASTER_KEY\n    PARSE_DASHBOARD_APP_ID: $APP_ID\n    PARSE_DASHBOARD_APP_NAME: $APP_NAME\n    PARSE_DASHBOARD_USER_ID: $USER1\n    PARSE_DASHBOARD_USER_PASSWORD: $USER1_PASSWORD\n    PARSE_DASHBOARD_CONFIG: $PARSE_DASHBOARD_CONFIG\n    MOUNT_PATH: $PARSE_DASHBOARD_MOUNT_PATH\n    TRUST_PROXY: $PARSE_DASHBOARD_TRUST_PROXY\n    PORT: 4040\n  ports:\n    - \"4040:4040\"\n  #command: parse-dashboard\n#  volumes:\n#    - \"parse-dashboard-config.json:/src/Parse-Dashboard/parse-dashboard-config.json\"\n\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "docker-tags",
    "content": "#!/usr/bin/env bash\njson=`curl -s -S \"https://registry.hub.docker.com/v2/repositories/yongjhih/parse-server/tags/\"`\nwhile [ \"$json\" ]; do\n    echo \"$json\" | jq '.results[][\"name\"]'\n    next=`echo \"$json\" | jq -r '.next'`\n    if [[ \"$next\" && \"$next\" != \"null\" ]]; then\n        json=`curl -s -S \"$next\"`\n    else\n        json=\n    fi\ndone | sort 2> /dev/null\n"
  },
  {
    "path": "generate-stackbrew-library.sh",
    "content": "#!/usr/bin/env bash\n\nset -e\n\ncd \"$(dirname \"$(readlink -f \"${BASH_SOURCE[0]}\")\")\"\n\nurl='git://github.com/yongjhih/docker-parse-server'\n\ngenerate-version() {\n\tlocal version=$1\n\n\tcommit=\"$(git log -1 --format='format:%H' \"$version\")\"\n\n\tversionAliases=()\n\tif [ \"$version\" == 'master' ]; then\n\t\techo \"latest: ${url}@${commit} .\"\n\telse\n\t\techo \"${version}: ${url}@${commit} .\"\n\tfi\n}\n\necho '# maintainer: Andrew Chen <yongjhih@gmail.com> (@yongjhih)'\n\nversions=( 2.0.{0..8} 2.1.{0..6} 2.2.{0..22} 2.3.{0..1}  master )\n\nfor version in \"${versions[@]}\"; do\n\tgenerate-version \"$version\"\ndone\n"
  },
  {
    "path": "index.js",
    "content": "#!/usr/bin/env node\n// ref. parse-server/index.js\n// ref. parse-server/bin/parse-server\n\nvar express = require('express');\nvar ParseServer = require('parse-server').ParseServer;\nvar links = require('docker-links').parseLinks(process.env);\nvar fs = require('fs');\nvar AzureStorageAdapter = require('parse-server-azure-storage').AzureStorageAdapter;\n\nvar databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI\n\nif (!databaseUri) {\n    if (links.mongo) {\n        databaseUri = 'mongodb://' + links.mongo.hostname + ':' + links.mongo.port + '/dev';\n    }\n}\n\nif (!databaseUri) {\n    console.log('DATABASE_URI not specified, falling back to localhost.');\n}\n\nvar facebookAppIds = process.env.FACEBOOK_APP_IDS;\n\nif (facebookAppIds) {\n    facebookAppIds = facebookAppIds.split(\",\");\n}\n\nvar gcmId = process.env.GCM_ID;\nvar gcmKey = process.env.GCM_KEY;\n\nvar iosPushConfigs = new Array();\nvar isFile = function(f) {\n    var b = false;\n    try {\n        b = fs.statSync(f).isFile();\n    } catch (e) {\n    }\n    return b;\n}\n\nvar productionBundleId = process.env.PRODUCTION_BUNDLE_ID;\nvar productionPfx = process.env.PRODUCTION_PFX || '/certs/production-pfx.p12';\nproductionPfx = isFile(productionPfx) ? productionPfx : null;\nvar productionCert = process.env.PRODUCTION_CERT || '/certs/production-pfx-cert.pem';\nproductionCert = isFile(productionCert) ? productionCert : null;\nvar productionKey = process.env.PRODUCTION_KEY || '/certs/production-pfx-key.pem';\nproductionKey = isFile(productionKey) ? productionKey : null;\nvar productionPassphrase = process.env.PRODUCTION_PASSPHRASE || null;\nvar productionPushConfig;\nif (productionBundleId && (productionPfx || (productionCert && productionKey))) {\n    productionPushConfig = {\n        pfx: productionPfx,\n        cert: productionCert,\n        key: productionKey,\n        passphrase: productionPassphrase,\n        bundleId: productionBundleId,\n        production: true\n    };\n    iosPushConfigs.push(productionPushConfig);\n}\n\nvar devBundleId = process.env.DEV_BUNDLE_ID;\nvar devPfx = process.env.DEV_PFX || '/certs/dev-pfx.p12';\ndevPfx = isFile(devPfx) ? devPfx : null;\nvar devCert = process.env.DEV_CERT || '/certs/dev-pfx-cert.pem';\ndevCert = isFile(devCert) ? devCert : null;\nvar devKey = process.env.DEV_KEY || '/certs/dev-pfx-key.pem';\ndevKey = isFile(devKey) ? devKey : null;\nvar devPassphrase = process.env.DEV_PASSPHRASE || null;\nvar devPushConfig;\nif (devBundleId && (devPfx || (devCert && devKey))) { // exsiting files if not null\n    devPushConfig = {\n        pfx: devPfx,\n        cert: devCert,\n        key: devKey,\n        passphrase: devPassphrase,\n        bundleId: devBundleId,\n        production: false\n    };\n    iosPushConfigs.push(devPushConfig);\n}\n\nif(process.env.APNS_BUNDLES_ID && process.env.APNS_BUNDLES_P12 && process.env.APNS_BUNDLES_PROD) {\n    var APNSBundlesId = process.env.APNS_BUNDLES_ID.split(',').map(function(entry) {\n        return entry.trim();\n    });\n    var APNSBundlesP12 = process.env.APNS_BUNDLES_P12.split(',').map(function(entry) {\n        return entry.trim();\n    });\n    var APNSBundlesProd = process.env.APNS_BUNDLES_PROD.split(',').map(function(entry) {\n        return entry.trim();\n    });\n    if(APNSBundlesId.length === APNSBundlesP12.length && APNSBundlesP12.length === APNSBundlesProd.length) {\n        for (var i = 0; i < APNSBundlesId.length; i++) {\n            APNSpushConfig = {\n                pfx: APNSBundlesP12[i],\n                bundleId: APNSBundlesId[i],\n                production: (APNSBundlesProd[i] === 'true' ? true : false)\n            };\n            iosPushConfigs.push(APNSpushConfig);\n        }\n    }\n}\n\n\n\nvar pushConfig = {};\nif (gcmId && gcmKey) {\n    pushConfig.android = {\n        senderId: gcmId,\n        apiKey: gcmKey\n    }\n}\nif (iosPushConfigs.length > 0) {\n    pushConfig.ios = iosPushConfigs;\n    //console.log('Multiple iOS push configurations.')\n}\nconsole.log(pushConfig);\n\nvar port = process.env.PORT || 1337;\n// Serve the Parse API on the /parse URL prefix\nvar mountPath = process.env.PARSE_MOUNT || '/parse';\nvar serverURL = process.env.SERVER_URL || 'http://localhost:' + port + mountPath; // Don't forget to change to https if needed\n\nvar S3Adapter = require('parse-server').S3Adapter;\nvar GCSAdapter = require('parse-server').GCSAdapter;\n//var FileSystemAdapter = require('parse-server').FileSystemAdapter;\nvar filesAdapter;\n\nif (process.env.S3_ACCESS_KEY &&\n    process.env.S3_SECRET_KEY &&\n    process.env.S3_BUCKET) {\n    var directAccess = !!+(process.env.S3_DIRECT);\n\n    filesAdapter = new S3Adapter(\n        process.env.S3_ACCESS_KEY,\n        process.env.S3_SECRET_KEY,\n        process.env.S3_BUCKET,\n        {directAccess: directAccess});\n} else if (process.env.GCP_PROJECT_ID &&\n    process.env.GCP_KEYFILE_PATH &&\n    process.env.GCS_BUCKET) {\n    var directAccess = !!+(process.env.GCS_DIRECT);\n\n    filesAdapter = new GCSAdapter(\n        process.env.GCP_PROJECT_ID,\n        process.env.GCP_KEYFILE_PATH,\n        process.env.GCS_BUCKET,\n        {directAccess: directAccess});\n} else if (process.env.AZURE_ACCOUNT &&\n    process.env.AZURE_CONTAINER &&\n    process.env.AZURE_ACCESS_KEY) {\n    var directAccess = !!+(process.env.AZURE_DIRECT);\n\n    filesAdapter = new AzureStorageAdapter(\n        process.env.AZURE_ACCOUNT,\n        process.env.AZURE_CONTAINER,\n        {\n            accessKey: process.env.AZURE_ACCESS_KEY,\n            directAccess: directAccess\n        });\n}\n\nvar emailModule = process.env.EMAIL_MODULE;\nvar verifyUserEmails = !!+(process.env.VERIFY_USER_EMAILS);\nvar emailAdapter;\nif (!emailModule) {\n    verifyUserEmails = false;\n} else {\n    var emailAdapterOptions = {\n        fromAddress: process.env.EMAIL_FROM,\n        domain: process.env.EMAIL_DOMAIN,\n        apiKey: process.env.EMAIL_API_KEY\n    };\n    if (process.env.EMAIL_VERIFICATION_SUBJECT) {\n        emailAdapterOptions.verificationSubject = process.env.EMAIL_VERIFICATION_SUBJECT;\n    }\n    if (process.env.EMAIL_VERIFICATION_BODY) {\n        emailAdapterOptions.verificationBody = process.env.EMAIL_VERIFICATION_BODY;\n    }\n    if (process.env.EMAIL_VERIFICATION_BODY_HTML) {\n        emailAdapterOptions.verificationBodyHTML = fs.readFileSync(process.env.EMAIL_VERIFICATION_BODY_HTML, \"utf8\") || process.env.EMAIL_VERIFICATION_BODY_HTML;\n    }\n    if (process.env.EMAIL_PASSWORD_RESET_SUBJECT) {\n        emailAdapterOptions.passwordResetSubject = process.env.EMAIL_PASSWORD_RESET_SUBJECT;\n    }\n    if (process.env.EMAIL_PASSWORD_RESET_BODY) {\n        emailAdapterOptions.passwordResetBody = process.env.EMAIL_PASSWORD_RESET_BODY;\n    }\n    if (process.env.EMAIL_PASSWORD_RESET_BODY_HTML) {\n        emailAdapterOptions.passwordResetBodyHTML = fs.readFileSync(process.env.EMAIL_PASSWORD_RESET_BODY_HTML, \"utf8\") || process.env.EMAIL_PASSWORD_RESET_BODY_HTML;\n    }\n    emailAdapter = {\n        module: emailModule,\n        options: emailAdapterOptions\n    };\n}\nconsole.log(verifyUserEmails);\nconsole.log(emailModule);\nconsole.log(emailAdapter);\n\nvar enableAnonymousUsers = !!+(process.env.ENABLE_ANON_USERS);\nvar allowClientClassCreation = !!+(process.env.ALLOW_CLIENT_CLASS_CREATION);\n\nvar liveQuery = process.env.LIVEQUERY_SUPPORT;\nconsole.log(\"LIVEQUERY_SUPPORT: \" + liveQuery);\nvar liveQueryParam;\nif(liveQuery) {\n    var liveQueryClasses = process.env.LIVEQUERY_CLASSES.split(',').map(function(entry) {\n        return entry.trim();\n    });\n    console.log(\"LIVEQUERY_CLASSES: \" + liveQueryClasses);\n\n    liveQueryParam = {\n        classNames: liveQueryClasses\n    };\n}\n\nvar databaseOptions = {};\nif (process.env.DATABASE_TIMEOUT) {\n    databaseOptions = {\n        socketTimeoutMS: +(process.env.DATABASE_TIMEOUT)\n    };\n}\n\nvar auth = {};\nfor (var env in process.env) {\n    if (!process.env.hasOwnProperty(env)) {\n        return;\n    }\n\n    var env_parameters = /^AUTH_([^_]*)_(.+)/.exec(env);\n\n    if (env_parameters !== null) {\n        if (typeof auth[env_parameters[1].toLowerCase()] === \"undefined\") {\n            auth[env_parameters[1].toLowerCase()] = {};\n        }\n\n        auth[env_parameters[1].toLowerCase()][env_parameters[2].toLowerCase()] = process.env[env];\n    }\n}\n\nvar api = new ParseServer({\n    databaseURI: databaseUri || 'mongodb://localhost:27017/dev',\n    databaseOptions: databaseOptions,\n    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',\n\n    appId: process.env.APP_ID || 'myAppId',\n    masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!\n    serverURL: serverURL,\n\n    collectionPrefix: process.env.COLLECTION_PREFIX,\n    clientKey: process.env.CLIENT_KEY,\n    restAPIKey: process.env.REST_API_KEY,\n    javascriptKey: process.env.JAVASCRIPT_KEY,\n    dotNetKey: process.env.DOTNET_KEY,\n    fileKey: process.env.FILE_KEY,\n    filesAdapter: filesAdapter,\n\n    auth: auth,\n    facebookAppIds: facebookAppIds,\n    maxUploadSize: process.env.MAX_UPLOAD_SIZE,\n    push: pushConfig,\n    verifyUserEmails: verifyUserEmails,\n    emailAdapter: emailAdapter,\n    enableAnonymousUsers: enableAnonymousUsers,\n    allowClientClassCreation: allowClientClassCreation,\n    //oauth = {},\n    appName: process.env.APP_NAME,\n    publicServerURL: process.env.PUBLIC_SERVER_URL,\n    liveQuery: liveQueryParam,\n    logLevel: process.env.LOG_LEVEL || 'info'\n    //customPages: process.env.CUSTOM_PAGES || // {\n    //invalidLink: undefined,\n    //verifyEmailSuccess: undefined,\n    //choosePassword: undefined,\n    //passwordResetSuccess: undefined\n    //}\n});\n\n//console.log(\"appId: \" + api.appId);\n//console.log(\"masterKey: \" + api.masterKey);\n//console.log(\"cloud: \" + api.cloud);\n//console.log(\"databaseURI: \" + api.databaseURI);\nconsole.log(\"appId: \" + process.env.APP_ID);\nconsole.log(\"masterKey: \" + process.env.MASTER_KEY);\n\nvar app = express();\n\nvar trustProxy = !!+(process.env.TRUST_PROXY || '1'); // default enable trust\nif (trustProxy) {\n    console.log(\"trusting proxy: \" + process.env.TRUST_PROXY);\n    app.enable('trust proxy');\n}\n\napp.use(mountPath, api);\n\n// Parse Server plays nicely with the rest of your web routes\napp.get('/', function(req, res) {\n    res.status(200).send('I dream of being a web site.');\n});\n\n\n\nif(liveQuery) {\n  console.log(\"Starting live query server\");\n  var httpServer = require('http').createServer(app);\n  httpServer.listen(port);\n  console.log('plac');\n  var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);\n} else {\n  app.listen(port, function() {\n    console.log('docker-parse-server running on ' + serverURL + ' (:' + port + mountPath + ')');\n  });\n}\n\n// GraphQL\nvar isSupportGraphQL = process.env.GRAPHQL_SUPPORT;\nvar schemaURL = process.env.GRAPHQL_SCHEMA || './cloud/graphql/schema.js';\n\nconsole.log('isSupportGraphQL :', isSupportGraphQL);\nconsole.log('schemaURL :', schemaURL);\n\nif(isSupportGraphQL){\n    console.log('Starting GraphQL...');\n    \n    var IS_DEVELOPMENT = process.env.NODE_ENV !== 'production';\n\n    function getSchema() {\n        if (IS_DEVELOPMENT) {\n            delete require.cache[require.resolve(schemaURL)];\n        }\n\n        return require(schemaURL);\n    }\n\n    var graphQLHTTP = require('express-graphql');\n    app.use('/graphql', graphQLHTTP(function(request){ return {\n        graphiql: IS_DEVELOPMENT,\n        pretty: IS_DEVELOPMENT,\n        schema: getSchema()\n    }}));\n\n    // TOHAVE : Support custom `./graphql` path and maybe `port`?\n    isSupportGraphQL && console.log('GraphQL running on ' + serverURL.split(port + mountPath).join(port) + '/graphql');\n}\n"
  },
  {
    "path": "jsconfig.json",
    "content": "{\n    \"compilerOptions\": {\n        \"target\": \"ES6\",\n        \"module\": \"commonjs\"\n    }\n}"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"docker-parse-server\",\n  \"version\": \"2.3.1\",\n  \"description\": \"Parse Server as docker container\",\n  \"main\": \"index.js\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/yongjhih/docker-parse-server\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"docker-links\": \"^1.0.2\",\n    \"express\": \"~4.14.x\",\n    \"express-graphql\": \"^0.6.1\",\n    \"graphql\": \"^0.8.2\",\n    \"kerberos\": \"~0.0.x\",\n    \"mongodb\": \"2.2.10\",\n    \"nodemon\": \"^1.11.0\",\n    \"parse\": \"~1.9.2\",\n    \"parse-server\": \"2.3.1\",\n    \"parse-server-azure-storage\": \"^1.1.0\",\n    \"parse-server-mailgun-adapter-template\": \"^1.1.7\"\n  },\n  \"scripts\": {\n    \"start\": \"nodemon --watch /parse/cloud index.js\"\n  },\n  \"engines\": {\n    \"node\": \">=4.3\"\n  }\n}\n"
  },
  {
    "path": "run",
    "content": "#!/usr/bin/env bash\n\nimage=\"$1\"\nappId=\"${2:-appId}\"\nmasterKey=\"${3:-mastarKey}\"\n\ndocker run -it                       \\\n           -e APP_ID=$appId          \\\n           -e MASTER_KEY=$masterKey  \\\n           -p 1337:1337              \\\n           -p 2022:22                \\\n           --name parse-server       \\\n           \"$image\"\n"
  },
  {
    "path": "scalingo.json",
    "content": "{\n  \"name\": \"Parse Server\",\n  \"description\": \"An Parse API server using the parse-server module\",\n  \"repository\": \"https://github.com/yongjhih/docker-parse-server\",\n  \"logo\": \"https://avatars0.githubusercontent.com/u/1294580?v=3&s=200\",\n  \"env\": {\n    \"PARSE_MOUNT\": {\n      \"description\": \"Configure Parse API route.\",\n      \"value\": \"/parse\"\n    },\n    \"APP_ID\": {\n      \"description\": \"A unique identifier for your app.\",\n      \"value\": \"\"\n    },\n    \"MASTER_KEY\": {\n      \"description\": \"A key that overrides all permissions. Keep this secret.\",\n      \"value\": \"\"\n    },\n    \"DATABASE_URI\": {\n      \"description\": \"Connection string for your database.\",\n      \"value\": \"$SCALINGO_MONGO_URL\"\n    }\n  },\n  \"addons\": [\"scalingo-mongodb\"]\n}\n"
  },
  {
    "path": "scripts/docker-ssh-add-key",
    "content": "#!/usr/bin/env bash\n\nif [ ! \"$1\" ]; then\n  echo \"Usage: $0 <name-of-parse-server-container> <ssh-key-file>...\"\n  exit 1\nfi\n\nDOCKER_PARSE_SERVER_NAME=\"$1\"\nshift\n\nif [ ! \"$1\" ]; then\n  echo \"Usage: $0 <name-of-parse-server-container> <ssh-key-file>...\"\n  exit 1\nfi\n\nwhile [ \"$1\" ]; do\n  if [ ! -f \"$1\" ]; then\n    shift\n    continue\n  fi\n\n  docker exec -i parse-server ssh-add-key < \"$1\"\n  shift\ndone\n"
  },
  {
    "path": "tag",
    "content": "#!/usr/bin/env bash\n\nfor i in 2.2.{23..25} 2.2.25-beta.1 2.3.{0..3}; do\n  sed -i '' -e 's/\"parse-server\": \"[^\"]\\+\"/\"parse-server\": \"'\"$i\"'\"/' package.json\n  git commit -am \"Bump to $i\"\n  git tag -f \"$i\"\ndone\n\necho git push origin 2.2.{23..25} 2.2.25-beta.1 2.3.{0..3}\n"
  },
  {
    "path": "test-parse-cloud",
    "content": "#!/usr/bin/env bash\n\ncurl -X POST \\\n-H \"X-Parse-Application-Id: myAppId\" \\\n-H \"Content-Type: application/json\" \\\n-d '{}' \\\nhttp://localhost:1337/parse/functions/hello\n"
  },
  {
    "path": "tutum.yml",
    "content": "haproxy:\n  image: tutum/haproxy\n  #image: dockercloud/haproxy\n  links:\n    - parse-server\n  ports:\n    - \"1337:1337\"\n    - \"2022:22\"\n  restart: always\n  roles:\n    - global\n\nparse-server:\n  #build: .\n  image: yongjhih/parse-server\n  environment:\n    DATABASE_URI: $DATABASE_URI\n    APP_ID: $APP_ID\n    MASTER_KEY: $MASTER_KEY\n    PARSE_MOUNT: $PARSE_MOUNT\n    COLLECTION_PREFIX: $COLLECTION_PREFIX\n    CLIENT_KEY: $CLIENT_KEY\n    REST_API_KEY: $REST_API_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    JAVASCRIPT_KEY: $JAVASCRIPT_KEY\n    DOTNET_KEY: $DOTNET_KEY\n    FILE_KEY: $FILE_KEY\n    FACEBOOK_APP_IDS: $FACEBOOK_APP_IDS\n  links:\n    - mongo\n  volumes_from:\n    - parse-cloud-code\n  restart: always\n\nparse-cloud-code:\n  #build: cloud/.\n  image: yongjhih/parse-cloud-code\n  volumes:\n    - /parse/cloud\n  command: \"ls /parse/cloud\"\n\nmongo:\n  image: mongo:3.0.8 # ref. https://github.com/ParsePlatform/parse-server/issues/1913\n  ports:\n    - \"27017:27017\"\n  volumes_from:\n    - mongo-data\n#  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false --rest --auth\"\n  command: \"--smallfiles --logpath=/dev/null --setParameter failIndexKeyTooLong=false\"\n# ref. http://www.diogogmt.com/running-mongodb-with-docker-and-compose/\n  restart: always\n\nmongo-data:\n  image: mongo\n  volumes:\n    - /data/db\n  command: \"--break-mongo\"\n\n# vim:set et ts=2 sw=2:\n"
  },
  {
    "path": "volumes/proxy/templates/nginx-compose-v2.tmpl",
    "content": "{{ define \"upstream\" }}\n    {{ if .Address }}\n        {{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}}\n        {{ if and .Container.Node.ID .Address.HostPort }}\n            # {{ .Container.Node.Name }}/{{ .Container.Name }}\n            server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }};\n        {{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}}\n        {{ else }}\n            # {{ .Container.Name }}\n            server {{ .Address.IP }}:{{ .Address.Port }};\n        {{ end }}\n    {{ else }}\n        # {{ .Container.Name }}\n        server {{ .Container.IP }} down;\n    {{ end }}\n{{ end }}\n\n# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the\n# scheme used to connect to this server\nmap $http_x_forwarded_proto $proxy_x_forwarded_proto {\n  default $http_x_forwarded_proto;\n  ''      $scheme;\n}\n\n# If we receive Upgrade, set Connection to \"upgrade\"; otherwise, delete any\n# Connection header that may have been passed to this server\nmap $http_upgrade $proxy_connection {\n  default upgrade;\n  '' close;\n}\n\ngzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;\n\nlog_format vhost '$host $remote_addr - $remote_user [$time_local] '\n                 '\"$request\" $status $body_bytes_sent '\n                 '\"$http_referer\" \"$http_user_agent\"';\n\naccess_log off;\n\n{{ if (exists \"/etc/nginx/proxy.conf\") }}\ninclude /etc/nginx/proxy.conf;\n{{ else }}\n# HTTP 1.1 support\nproxy_http_version 1.1;\nproxy_buffering off;\nproxy_set_header Host $http_host;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection $proxy_connection;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;\n{{ end }}\n\nserver {\n    server_name _; # This is just an invalid value which will never trigger on a real hostname.\n    listen 80;\n    access_log /var/log/nginx/access.log vhost;\n    return 503;\n}\n\n{{ if (and (exists \"/etc/nginx/certs/default.crt\") (exists \"/etc/nginx/certs/default.key\")) }}\nserver {\n    server_name _; # This is just an invalid value which will never trigger on a real hostname.\n    listen 443 ssl http2;\n    access_log /var/log/nginx/access.log vhost;\n    return 503;\n\n    ssl_certificate /etc/nginx/certs/default.crt;\n    ssl_certificate_key /etc/nginx/certs/default.key;\n}\n{{ end }}\n\n{{ range $host, $containers := groupByMulti $ \"Env.VIRTUAL_HOST\" \",\" }}\n\nupstream {{ $host }} {\n\n{{ range $index, $value := $containers }}\n\n    {{ $addrLen := len $value.Addresses }}\n    {{/* If only 1 port exposed, use that */}}\n    {{ if eq $addrLen 1 }}\n        {{ with $address := index $value.Addresses 0 }}\n           # {{$value.Name}}\n           server {{ $address.IP }}:{{ $address.Port }};\n        {{ end }}\n\n    {{/* If a VIRTUAL_NETWORK is specified use use its IP */}}\n    {{ else if $value.Env.VIRTUAL_NETWORK }}\n        {{ range $i, $network := $value.Networks }}\n           {{ if eq $network.Name $value.Env.VIRTUAL_NETWORK }}\n   # Container: {{$value.Name}}@{{$network.Name}}\n   server {{ $network.IP }}:{{ $value.Env.VIRTUAL_PORT }};\n           {{ end }}\n        {{ end }}\n\n    {{/* If more than one port exposed, use the one matching VIRTUAL_PORT env var */}}\n    {{ else if $value.Env.VIRTUAL_PORT }}\n        {{ range $i, $address := $value.Addresses }}\n           {{ if eq $address.Port $value.Env.VIRTUAL_PORT }}\n           # {{$value.Name}}\n           server {{ $address.IP }}:{{ $address.Port }};\n           {{ end }}\n        {{ end }}\n\n    {{/* Else default to standard web port 80 */}}\n    {{ else }}\n        {{ range $i, $address := $value.Addresses }}\n            {{ if eq $address.Port \"80\" }}\n            # {{$value.Name}}\n            server {{ $address.IP }}:{{ $address.Port }};\n            {{ end }}\n        {{ end }}\n    {{ end }}\n{{ end }}\n}\n\n{{ $default_host := or ($.Env.DEFAULT_HOST) \"\" }}\n{{ $default_server := index (dict $host \"\" $default_host \"default_server\") $host }}\n\n{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to \"http\" */}}\n{{ $proto := or (first (groupByKeys $containers \"Env.VIRTUAL_PROTO\")) \"http\" }}\n\n{{/* Get the first cert name defined by containers w/ the same vhost */}}\n{{ $certName := (first (groupByKeys $containers \"Env.CERT_NAME\")) }}\n\n{{/* Get the best matching cert  by name for the vhost. */}}\n{{ $vhostCert := (closest (dir \"/etc/nginx/certs\") (printf \"%s.crt\" $host))}}\n\n{{/* vhostCert is actually a filename so remove any suffixes since they are added later */}}\n{{ $vhostCert := replace $vhostCert \".crt\" \"\" -1 }}\n{{ $vhostCert := replace $vhostCert \".key\" \"\" -1 }}\n\n{{/* Use the cert specifid on the container or fallback to the best vhost match */}}\n{{ $cert := (coalesce $certName $vhostCert) }}\n\n{{ if (and (ne $cert \"\") (exists (printf \"/etc/nginx/certs/%s.crt\" $cert)) (exists (printf \"/etc/nginx/certs/%s.key\" $cert))) }}\n\nserver {\n    server_name {{ $host }};\n    listen 80 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n    return 301 https://$host$request_uri;\n}\n\nserver {\n    server_name {{ $host }};\n    listen 443 ssl http2 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n\n    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;\n\n    ssl_prefer_server_ciphers on;\n    ssl_session_timeout 5m;\n    ssl_session_cache shared:SSL:50m;\n\n    ssl_certificate /etc/nginx/certs/{{ (printf \"%s.crt\" $cert) }};\n    ssl_certificate_key /etc/nginx/certs/{{ (printf \"%s.key\" $cert) }};\n\n    {{ if (exists (printf \"/etc/nginx/certs/%s.dhparam.pem\" $cert)) }}\n    ssl_dhparam {{ printf \"/etc/nginx/certs/%s.dhparam.pem\" $cert }};\n    {{ end }}\n\n    add_header Strict-Transport-Security \"max-age=31536000\";\n\n    {{ if (exists (printf \"/etc/nginx/vhost.d/%s\" $host)) }}\n    include {{ printf \"/etc/nginx/vhost.d/%s\" $host }};\n    {{ else if (exists \"/etc/nginx/vhost.d/default\") }}\n    include /etc/nginx/vhost.d/default;\n    {{ end }}\n\n    location / {\n        proxy_pass {{ trim $proto }}://{{ trim $host }};\n        {{ if (exists (printf \"/etc/nginx/htpasswd/%s\" $host)) }}\n        auth_basic  \"Restricted {{ $host }}\";\n        auth_basic_user_file    {{ (printf \"/etc/nginx/htpasswd/%s\" $host) }};\n        {{ end }}\n                {{ if (exists (printf \"/etc/nginx/vhost.d/%s_location\" $host)) }}\n                include {{ printf \"/etc/nginx/vhost.d/%s_location\" $host}};\n                {{ else if (exists \"/etc/nginx/vhost.d/default_location\") }}\n                include /etc/nginx/vhost.d/default_location;\n                {{ end }}\n    }\n}\n{{ else }}\n\nserver {\n    server_name {{ $host }};\n    listen 80 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n\n    {{ if (exists (printf \"/etc/nginx/vhost.d/%s\" $host)) }}\n    include {{ printf \"/etc/nginx/vhost.d/%s\" $host }};\n    {{ else if (exists \"/etc/nginx/vhost.d/default\") }}\n    include /etc/nginx/vhost.d/default;\n    {{ end }}\n\n    location / {\n        proxy_pass {{ trim $proto }}://{{ trim $host }};\n        {{ if (exists (printf \"/etc/nginx/htpasswd/%s\" $host)) }}\n        auth_basic  \"Restricted {{ $host }}\";\n        auth_basic_user_file    {{ (printf \"/etc/nginx/htpasswd/%s\" $host) }};\n        {{ end }}\n                {{ if (exists (printf \"/etc/nginx/vhost.d/%s_location\" $host)) }}\n                include {{ printf \"/etc/nginx/vhost.d/%s_location\" $host}};\n                {{ else if (exists \"/etc/nginx/vhost.d/default_location\") }}\n                include /etc/nginx/vhost.d/default_location;\n                {{ end }}\n    }\n}\n\n{{ if (and (exists \"/etc/nginx/certs/default.crt\") (exists \"/etc/nginx/certs/default.key\")) }}\nserver {\n    server_name {{ $host }};\n    listen 443 ssl http2 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n    return 503;\n\n    ssl_certificate /etc/nginx/certs/default.crt;\n    ssl_certificate_key /etc/nginx/certs/default.key;\n}\n{{ end }}\n\n{{ end }}\n{{ end }}\n"
  },
  {
    "path": "volumes/proxy/templates/nginx.tmpl",
    "content": "{{ define \"upstream\" }}\n    {{ if .Address }}\n        {{/* If we got the containers from swarm and this container's port is published to host, use host IP:PORT */}}\n        {{ if and .Container.Node.ID .Address.HostPort }}\n            # {{ .Container.Node.Name }}/{{ .Container.Name }}\n            server {{ .Container.Node.Address.IP }}:{{ .Address.HostPort }};\n        {{/* If there is no swarm node or the port is not published on host, use container's IP:PORT */}}\n        {{ else }}\n            # {{ .Container.Name }}\n            server {{ .Address.IP }}:{{ .Address.Port }};\n        {{ end }}\n    {{ else }}\n        # {{ .Container.Name }}\n        server {{ .Container.IP }} down;\n    {{ end }}\n{{ end }}\n\n# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the\n# scheme used to connect to this server\nmap $http_x_forwarded_proto $proxy_x_forwarded_proto {\n  default $http_x_forwarded_proto;\n  ''      $scheme;\n}\n\n# If we receive Upgrade, set Connection to \"upgrade\"; otherwise, delete any\n# Connection header that may have been passed to this server\nmap $http_upgrade $proxy_connection {\n  default upgrade;\n  '' close;\n}\n\ngzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;\n\nlog_format vhost '$host $remote_addr - $remote_user [$time_local] '\n                 '\"$request\" $status $body_bytes_sent '\n                 '\"$http_referer\" \"$http_user_agent\"';\n\naccess_log off;\n\n{{ if (exists \"/etc/nginx/proxy.conf\") }}\ninclude /etc/nginx/proxy.conf;\n{{ else }}\n# HTTP 1.1 support\nproxy_http_version 1.1;\nproxy_buffering off;\nproxy_set_header Host $http_host;\nproxy_set_header Upgrade $http_upgrade;\nproxy_set_header Connection $proxy_connection;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;\n{{ end }}\n\nserver {\n    server_name _; # This is just an invalid value which will never trigger on a real hostname.\n    listen 80;\n    access_log /var/log/nginx/access.log vhost;\n    return 503;\n}\n\n{{ if (and (exists \"/etc/nginx/certs/default.crt\") (exists \"/etc/nginx/certs/default.key\")) }}\nserver {\n    server_name _; # This is just an invalid value which will never trigger on a real hostname.\n    listen 443 ssl http2;\n    access_log /var/log/nginx/access.log vhost;\n    return 503;\n\n    ssl_certificate /etc/nginx/certs/default.crt;\n    ssl_certificate_key /etc/nginx/certs/default.key;\n}\n{{ end }}\n\n{{ range $host, $containers := groupByMulti $ \"Env.VIRTUAL_HOST\" \",\" }}\n\nupstream {{ $host }} {\n{{ range $container := $containers }}\n    {{ $addrLen := len $container.Addresses }}\n    {{/* If only 1 port exposed, use that */}}\n    {{ if eq $addrLen 1 }}\n        {{ $address := index $container.Addresses 0 }}\n        {{ template \"upstream\" (dict \"Container\" $container \"Address\" $address) }}\n    {{/* If more than one port exposed, use the one matching VIRTUAL_PORT env var, falling back to standard web port 80 */}}\n    {{ else }}\n        {{ $port := coalesce $container.Env.VIRTUAL_PORT \"80\" }}\n        {{ $address := where $container.Addresses \"Port\" $port | first }}\n        {{ template \"upstream\" (dict \"Container\" $container \"Address\" $address) }}\n    {{ end }}\n{{ end }}\n}\n\n{{ $default_host := or ($.Env.DEFAULT_HOST) \"\" }}\n{{ $default_server := index (dict $host \"\" $default_host \"default_server\") $host }}\n\n{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to \"http\" */}}\n{{ $proto := or (first (groupByKeys $containers \"Env.VIRTUAL_PROTO\")) \"http\" }}\n\n{{/* Get the first cert name defined by containers w/ the same vhost */}}\n{{ $certName := (first (groupByKeys $containers \"Env.CERT_NAME\")) }}\n\n{{/* Get the best matching cert  by name for the vhost. */}}\n{{ $vhostCert := (closest (dir \"/etc/nginx/certs\") (printf \"%s.crt\" $host))}}\n\n{{/* vhostCert is actually a filename so remove any suffixes since they are added later */}}\n{{ $vhostCert := replace $vhostCert \".crt\" \"\" -1 }}\n{{ $vhostCert := replace $vhostCert \".key\" \"\" -1 }}\n\n{{/* Use the cert specifid on the container or fallback to the best vhost match */}}\n{{ $cert := (coalesce $certName $vhostCert) }}\n\n{{ if (and (ne $cert \"\") (exists (printf \"/etc/nginx/certs/%s.crt\" $cert)) (exists (printf \"/etc/nginx/certs/%s.key\" $cert))) }}\n\nserver {\n    server_name {{ $host }};\n    listen 80 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n    return 301 https://$host$request_uri;\n}\n\nserver {\n    server_name {{ $host }};\n    listen 443 ssl http2 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n\n    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;\n\n    ssl_prefer_server_ciphers on;\n    ssl_session_timeout 5m;\n    ssl_session_cache shared:SSL:50m;\n\n    ssl_certificate /etc/nginx/certs/{{ (printf \"%s.crt\" $cert) }};\n    ssl_certificate_key /etc/nginx/certs/{{ (printf \"%s.key\" $cert) }};\n\n    {{ if (exists (printf \"/etc/nginx/certs/%s.dhparam.pem\" $cert)) }}\n    ssl_dhparam {{ printf \"/etc/nginx/certs/%s.dhparam.pem\" $cert }};\n    {{ end }}\n\n    add_header Strict-Transport-Security \"max-age=31536000\";\n\n    {{ if (exists (printf \"/etc/nginx/vhost.d/%s\" $host)) }}\n    include {{ printf \"/etc/nginx/vhost.d/%s\" $host }};\n    {{ else if (exists \"/etc/nginx/vhost.d/default\") }}\n    include /etc/nginx/vhost.d/default;\n    {{ end }}\n\n    location / {\n        proxy_pass {{ trim $proto }}://{{ trim $host }};\n        {{ if (exists (printf \"/etc/nginx/htpasswd/%s\" $host)) }}\n        auth_basic  \"Restricted {{ $host }}\";\n        auth_basic_user_file    {{ (printf \"/etc/nginx/htpasswd/%s\" $host) }};\n        {{ end }}\n                {{ if (exists (printf \"/etc/nginx/vhost.d/%s_location\" $host)) }}\n                include {{ printf \"/etc/nginx/vhost.d/%s_location\" $host}};\n                {{ else if (exists \"/etc/nginx/vhost.d/default_location\") }}\n                include /etc/nginx/vhost.d/default_location;\n                {{ end }}\n    }\n}\n{{ else }}\n\nserver {\n    server_name {{ $host }};\n    listen 80 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n\n    {{ if (exists (printf \"/etc/nginx/vhost.d/%s\" $host)) }}\n    include {{ printf \"/etc/nginx/vhost.d/%s\" $host }};\n    {{ else if (exists \"/etc/nginx/vhost.d/default\") }}\n    include /etc/nginx/vhost.d/default;\n    {{ end }}\n\n    location / {\n        proxy_pass {{ trim $proto }}://{{ trim $host }};\n        {{ if (exists (printf \"/etc/nginx/htpasswd/%s\" $host)) }}\n        auth_basic  \"Restricted {{ $host }}\";\n        auth_basic_user_file    {{ (printf \"/etc/nginx/htpasswd/%s\" $host) }};\n        {{ end }}\n                {{ if (exists (printf \"/etc/nginx/vhost.d/%s_location\" $host)) }}\n                include {{ printf \"/etc/nginx/vhost.d/%s_location\" $host}};\n                {{ else if (exists \"/etc/nginx/vhost.d/default_location\") }}\n                include /etc/nginx/vhost.d/default_location;\n                {{ end }}\n    }\n}\n\n{{ if (and (exists \"/etc/nginx/certs/default.crt\") (exists \"/etc/nginx/certs/default.key\")) }}\nserver {\n    server_name {{ $host }};\n    listen 443 ssl http2 {{ $default_server }};\n    access_log /var/log/nginx/access.log vhost;\n    return 503;\n\n    ssl_certificate /etc/nginx/certs/default.crt;\n    ssl_certificate_key /etc/nginx/certs/default.key;\n}\n{{ end }}\n\n{{ end }}\n{{ end }}\n"
  }
]