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