diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000000..6650bae40f --- /dev/null +++ b/.env.sample @@ -0,0 +1,15 @@ +################## +# PARSE SETTINGS # +################## + +APP_ID=myAppId +MASTER_KEY=myMasterKey + +# SERVER_URL= +# MOUNT= +# SERVER_DATABASE_URI= +# SERVER_CLOUD_CODE_MAIN= +# SERVER_COLLECTION_PREFIX= +# SERVER_FILE_KEY= +# SERVER_FACEBOOK_APP_IDS= +# SERVER_URL= diff --git a/.gitignore b/.gitignore index 8a15aa307e..e753d7b559 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,10 @@ node_modules # Emacs *~ + +# for azk +.azk +.npm + +# .env +.env diff --git a/Azkfile.js b/Azkfile.js new file mode 100644 index 0000000000..5d40d1810c --- /dev/null +++ b/Azkfile.js @@ -0,0 +1,59 @@ +/** + * Documentation: http://docs.azk.io/Azkfile.js + */ +// Adds the systems that shape your system +systems({ + 'parse-server': { + // Dependent systems + depends: ['mongodb'], + // More images: http://images.azk.io + image: {"docker": "azukiapp/node"}, + // Steps to execute before running instances + provision: [ + "cp .env.sample .env", + "npm install" + ], + workdir: "/azk/#{manifest.dir}", + shell: "/bin/bash", + command: ["npm", "start"], + wait: 120, + mounts: { + '/azk/#{manifest.dir}': sync("."), + '/azk/#{manifest.dir}/node_modules': persistent("./node_modules"), + }, + scalable: {"default": 1}, + http: { + domains: [ "#{system.name}.#{azk.default_domain}" ] + }, + ports: { + // exports global variables + http: "3000/tcp", + }, + envs: { + NODE_ENV: "dev", + PORT: "3000", + // DOMAIN will be passed to ParseServer + DOMAIN: "#{system.name}.#{azk.default_domain}", + }, + }, + + 'mongodb': { + image : { docker: 'azukiapp/mongodb' }, + scalable: false, + wait: 120, + mounts: { + '/data/db': persistent('mongodb-#{manifest.dir}'), + }, + ports: { + http: '28017:28017/tcp', + }, + http: { + domains: [ '#{manifest.dir}-#{system.name}.#{azk.default_domain}' ], + }, + export_envs: { + DATABASE_URI: 'mongodb://#{net.host}:#{net.port[27017]}/#{manifest.dir}_development', + }, + }, +}); + +setDefault('parse-server'); diff --git a/README.md b/README.md index f86be4b245..e3a686537d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,18 @@ Read the full Parse Server guide here: https://github.com/ParsePlatform/parse-se ### For Local Development +#### With `Run Project` Button + +Click the button bellow to quickly and safely install this project on your local machine. + +[![Run project](https://s3-sa-east-1.amazonaws.com/assets.azk.io/run-project.png)](http://run.azk.io/start/?repo=run-project/parse-server-example) + +The `Run Project` button employs `azk`, a lightweight open source orchestration tool that will automatically isolate and configure the application's environment for you. + +Learn more about `azk` [here](https://github.com/azukiapp/azk). + +#### Without It + * Make sure you have at least Node 4.3. `node --version` * Clone this repo and change directory to it. * `npm install` @@ -16,6 +28,29 @@ Read the full Parse Server guide here: https://github.com/ParsePlatform/parse-se * You now have a database named "dev" that contains your Parse data * Install ngrok and you can test with devices +### Getting Started With DigitalOcean + +After you run this project locally using [`Run Project` button](#with-run-project-button), deploying to [DigitalOcean](http://digitalocean.com/) is very simple. + +First, be sure you have SSH keys configured in your machine. If you don't have it yet (or if you aren't sure about it), just follow steps 1 and 2 of [this tutorial](https://help.github.com/articles/generating-ssh-keys/). + +Next, put your [personal access token](https://cloud.digitalocean.com/settings/applications) into a `.env` file: + +```bash +$ cd path/to/the/project +$ echo "DEPLOY_API_TOKEN=" >> .env +``` + +Then, just run the following: + +```bash +$ azk deploy +``` + +The `Run Project` button employs `azk`, a lightweight open source orchestration tool that will automatically isolate and configure the application's environment for you. + +Find instructions for further resources (mostly customizations) to deploy to DigitalOcean using `azk` [here](http://docs.azk.io/en/deploy). + ### Getting Started With Heroku + Mongolab Development #### With the Heroku Button @@ -106,6 +141,8 @@ curl -X POST \ http://localhost:1337/parse/functions/hello ``` +Note: change `http://localhost:1337/` to `http://parse-server.dev.azk.io` if you are using `azk`. + Example using it via JavaScript: ```javascript