Parse Server Local
Photogram was developed with Parse Server, the open source version of the Parse backend that can be deployed to any infrastructure that can run Node.js.
So we need to create our server to connect to our application.
I recommend a local installation to begin development and run some tests before putting the server actually in production, so the first tutorial will be on how you create your Photogram Parse Local Server and then some links to how to do this in the AWS servers , Digital Ocean and other
Requirement NodeJS v5.11.1
I recommend using the 5.11.1 version of NodeJS production, because today is the stable version and tested by us.
If you do not already have NodeJS installed on your machine, follow the steps below to install the NVM (Node Manager Version) and then the 5.11.1 version of NodeJS.
Install NodeJS v5.11.1
- Install Node Version Manager (NVM) and NodeJS v5.11.1
- Windows: https:\/\/github.com\/coreybutler\/nvm-windows
- Ubuntu: wget -qO- https:\/\/raw.githubusercontent.com\/creationix\/nvm\/v0.31.1\/install.sh | bash
- Mac: curl -o- https:\/\/raw.githubusercontent.com\/creationix\/nvm\/v0.31.1\/install.sh | bash
- After install run this command
- nvm install v5.11.1
nvm alias default v5.11.1
exit terminal and access again
Requirement PM2
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
Install PM2
npm install -g pm2
PM2 Wiki
https:\/\/github.com\/Unitech\/pm2
Requirement MongoDB
Parse Server uses MongoDB as the database, so you need to have installed on a machine or use https:\/\/mlab.com\/ service that offers free 500mb to use MongoDB.
Install MongoDB
- mLab http:\/\/docs.mlab.com\/
- MongoDB for Windows
- https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-windows\/
- MongoDB for MacOS
- https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-os-x\/
- MongoDB for Linux
- https:\/\/docs.mongodb.com\/manual\/installation\/
Configure your Photogram Parse Server
Now that you already have NodeJS, PM2 and mongod we will set up the only file needed to start your Photogram Parse Server.
- Enter in server folder and open ecosystem.json and modify with options
Basic options
{
/**
* Application configuration section
* http://pm2.keymetrics.io/docs/usage/application-declaration/
*/
"apps": [
{
"name": "parse-server",
"script": "index.js",
"watch": true,
"merge_logs": true,
"env": {
// Mount path for the server. Defaults to /parse.
"PARSE_MOUNT": "/parse",
// (required) - The connection string for your database, i.e. mongodb://user:[email protected]/dbname.
// Be sure to URL encode your password if your password has special characters.
"DATABASE_URI": "mongodb://localhost:27017/photogram",
// URL to your Parse Server (don't forget to specify http:// or https://).
// This URL will be used when making requests to Parse Server from Cloud Code.
"SERVER_URL": "http://localhost:1337/parse",
// Your apps name. This will appear in the subject and body of the emails that are sent.
"APP_NAME": "Photogram", // (required) - The application id to host with this server instance.
// You can use any arbitrary string. For migrated
"APP_ID": "myAppId",
// (required) - The master key to use for overriding ACL security.
// You can use any arbitrary string. Keep it secret! For migrated apps, this should match your hosted Parse app.
"MASTER_KEY": "myMasterKey",
"MASTER_REST_KEY": "MPhotogramMasterKey",
// Parse Dashboard
"DASHBOARD_URL": "/dashboard",
"DASHBOARD_USER": "admin",
"DASHBOARD_PASSWORD": "admin123",
// (optional) - S3 for Storage Files
// Files are hosted via automaticamentes GridStore Adapter in MongoDB
// If you want to host the files on S3 fill in the form below
//"AWS_ACCESS_KEY_ID": "",
//"AWS_SECRET_ACCESS_KEY": "",
//"BUCKET_NAME": "",
// (optional) - MAILGUN for send Email
"MAILGUN_API_KEY": "key-3a05e956706a4bd579982460b96cf43a",
"MAILGUN_DOMAIN": "https://api.mailgun.net/v3/photogramapp.com",
"MAILGUN_FROM_ADDRESS": "[email protected]",
// Push Notification
"PUSH" :{
"android": {
"apiKey": "AIzaSyCBXV7CnhusYV0172lMsvvDy1zHfr96luk",
"senderId": "285805785383" },
"ios":{
"pfx": "my-push-certificate.p12",
"bundleId": "com.company.myapp",
"production": false
}
}
}
}
]
}
Start Server with PM2
Now that we have our set ecosystem.json file, let's start the PM2 server with the following command.
pm2 start ecosystem.json
Setup Server with Photogram CMS
With the server online open your browser and open the address set in parameterSERVER_URL, (sample: http:\/\/localhost:1337\/#\/auth\/install)
Parse Dashboard
Parse Dashboard is a standalone dashboard for managing your Parse apps. You can use it to manage your Parse Server apps and your apps that are running on Parse.com.
http:\/\/localhost:1337\/dashboard