g3org3 / betadelte

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Guide - tilidom_node version

Index

  1. Installation
  2. Post-Install
  3. First Run
  4. Creating Users
  5. Super Admin
  6. Make Versions
  7. Common Issues

##Installation You need to install the following software in your server:

##Post-Install ^

  1. Clone repo

    # cd to your destination parent folder
    $ git clone tilidom_node.git
    $ cd tilidom_node
  2. Install npm modules

    $ sudo npm install
  3. Copy config base file

    $ cp config/config.base.js config/config.js
    # or
    $ make config
  4. Edit config/config.js with your custom configurations.

    • change host to server's ip
    • change db name
    • change port
    // config/config.js
    {
    	mongo: {
    		database: 'sampleDb' // <- desire dbname 
    	},
    	local: {
    		port: 1337,           // <- desire port
    		host: '192.168.1.100' // <- server's ip
    	}
    }
  5. Install sails cli

	$ sudo npm install -g sails

Optional software to run your app

$ sudo npm install -g forever
# or
$ sudo npm install -g pm2

##First time starting the app ^

  1. To start the app just type the following command:
    $ sails lift
    # or
    $ node app.js

See common issues if you have any problems...

  1. Go to your favorite web browser and enter your app's server url
    • Example url: http://192.168.1.29:1337

    • Initialize the application

       http://192.168.1.29:1337/initialize
      
    • You've finished installing the app :D

##Creating Users ^ To create a user you need to run an api call user_register

Request

	// example params
	params: {
		username: 'example@domain.com',
		password: 'pass1234',
		accept_terms: 1
	}
	
	// make request
	GET /tilidom/tilidrive-api/user_register

Response

{
    "message": "User was successfully registered",
    "code": 0
}

##Update user to super admin ^

db.users.update(
	{ _id: ObjectId("ID") },
	{
		// userinfo ...
		userType: 'sa'	
	});

##How to make tag versions ^ Before commiting changes!

  • modify config.base.js

     version: {
     	current		: 'v0.2.6', // <= change version
     	description	: 'bug fix: profile image', // <= change description of new version
     	log		: 'logs/version.log'
     },
 # commit changes
 $ commit -m "my commit"
 
 # create tag
 $ make tag
 
 # push changes
 $ git push -u origin master --tags

##Common Issues ^

  • The first time you start your app could crash, because no db was created before. Start again the application and there should not be an error. $ sails lift

  • Trying start the app at port :80 getting errors?

    • you need more priveliges to start your app $ sudo sails lift
  • more soon

About