Skip to content
Joonghoon Kim edited this page Nov 7, 2015 · 22 revisions

Before installation, read Prerequisites document and prepare everythig. Don't miss setting LXC up

Download Source & Install dependencies

Downloading is easy : just clone webida server repository. Since Webida server uses various npm packages, before running server, these libraries should be installed. You can run "npm install" command at the "/src/server" directory.

$ cd /home/webida
$ git clone git@github.com:webida/webida-server.git
$ cd ./src/server
$ npm install
$ sudo npm install -g webida-server-tools 

Install sqlite3 node module

In some systems, you'll find that npm install command spits warnings with connect-sqlite3, that cannot run node-pre-gyp bundled with the package.

npm WARN package.json webida-server@0.0.41 No repository field.
npm WARN package.json webida-server@0.0.41 No license field.
npm WARN installMany node-pre-gyp was bundled with sqlite3@3.1.1, but bundled package wasn't found in unpacked tree
npm WARN cannot run in wd sqlite3@3.1.1 node-pre-gyp install --fallback-to-build (wd=/home/webida/webida-server/src/server/node_modules/connect-sqlite3/node_modules/sqlite3)

When you see this error, you should install node-pre-gyp and install sqlite3 dependency manually

$ sudo npm install -g node-pre-gyp
$ cd node_modules/connect-sqlite3/node_modules/sqlite3
$ node-pre-gyp install 

Source Structure

Following box shows directory structure cloned via git, webida-server/

/src                source directory
    /server         server source, configuration and installation scripts
        /app        app unit server
        /auth       auth unit server (oauth2, ACL and user/group management)
        /build      build unit server
        /buildjm    build job manager unit server
        /common     common modules
        /conf       configurations
        /emul       emulators
        /fs         file system unit server
        /notify     notification unit server
        /proxy      reverse proxy unit server
        /tests      QUnit test scripts
    /ext            external(3rd party) code that supports running Webida Server
    /system-configs     scripts & resources to configure your system 
update-system-apps.sh   update system applications from the repositories for each applications.

Prepare Directories

Some directories are needed by webida user that stores log, workspace data & other stuffs.

$ su webida 
  (input password)
$ cd /home/webida 
$ mkdir apps 
$ mkdir log
$ mkdir fs
$ mkdir sessions
$ mkdir build
$ exit

Check permissions above directories that webida user has permissions to write. We recommend you to put lxc directory (where you created webida container) & webida-server (cloned git directory) directory in /home/webida, too. After creating all directories, your /home/webida directory may look like this

/webida-server      server source directory
/apps               apps (including system apps) deployed on this server  
/fs                 users' workspaces 
/log                log files Webida server emits  
/lxc                LXC container configuration & root file system for Webida server 
/sessions           http session DB files
/build              intermediate directory for app building jobs  

Create & Edit conf.js

Webida server uses src/server/conf/default-conf.js as configuration file. As the name shows, it's default configuration file. To update Webida server easily, It's better to copy the file into 'real' confiugration file, conf.js.

$ cd webida-server/src/server/conf
$ cp default-conf.js conf.js 

Now you have conf.js. See Configuration guide how & what you have to do with configuration file.

** Before proceeding to next step, check your configuration file has no error or invalid paths. **

$ cd /home/webida/webida-server/src/server/conf
$ node ./conf.js 
 <node should exit without any exception>

Initialize Servers

Auth & FS server requires 'installation' process to initialize Database. App servers need installtion too, to install basic system apps including Webida IDE (Yes, you may want to run this app).

$ cd src/server/
$ node auth-install.js
$ node fs-install.js 
$ ../../update-system-apps.sh 
$ node app-install.js 

** DO NOT RUN app-install.js without running update-system-apps.sh. You should also set proper deployment descriptors in conf.js **

Updating system apps

System apps are our default HTML applications for every Webida users. /update-system-apps.sh will update default client HTML application. Or following command will download & update default application.

$ <source dir>/update-system-apps.sh

# OR

$ git submodule update --init --recursive
$ git submodule foreach git pull origin master

Changing system apps' deployment decriptors in conf.js

As other apps, system apps should be registere in DB with proper oAuth secret & redirect URL. Default system applications deployment descroptors are contained in /src/server/conf/default-conf.js. Since you've copied default-conf.js to conf.js, you shuould set proper descriptors in conf.js file. See Configuration for detail.

Initializing / Re-initializing app server

The app-install.js initialize app-related tables in DB & insert rows for system apps & do some optimization jobs if needed. If something goes wrong, you may want to register system-apps again from scratch. DB tables. In that case, you should run app-uninstall.sh.

$ cd /home/webida/webida-server
$ ./update-system-apps.sh 
$ cd src/server
$ node app-uninstall.sh
$ node app-install.sh

Run Webida Server

Running in single process

You can simply run all servers with following command.

$ cd /home/weibida/webida-server/src/server 
$ sudo -u webida node unit-manager.js

unit-manager.js loads configuration file and run all server instance which specified in the configuration file. In other words, all server runs in single process. and you can see all server's log in single log file, nimbus.log

Running in multiple processes

If you want to run each server as different process, you can specify the server instance name as "svc" when you run server as follow.

$ node unit-manager.js svc=auth0

"auth0" is instance name of service that specified in conf.js in src/server/conf directory. We recommendd you not change the name of each service instances.

Error with connect-sqlite3 module running unit-maniger

Although We're moving to redis cache and will remove server session stores soon, currently we use sqlite3-based session store. Sorry for inconvinience. When node cannot find sqlite3 module, the connect-sqlite3 module is not corretlcy installed via npm. Read [first section](.#Install sqlite3 node module ) and install sqlite3 module manually

Adding upstart configurations

As a sane operator, you may want to run/stop webida server after/before booting/shutting-down your system & want to respawn server process(es) on accidental crash. There are some sample upstart configuration files to install, in src/system-configs/upstart-configs/

To run the webida server in single, all-in-one process, edit webida.conf & copy it to /etc/init. For service-per-process mode, edit & copy files in src/system-configs/upstart-configs/units (You can't install both of them in a same host). Be sure to have right configuration, enabled reverse proxy & proxy unit in webdia server configuration file.

Finally, as for other upstart jobs, you should run initctl to apply new configuration scripts.

$ sudo /sbin/initctl reload-configuration

Uninstallation

If you want to cleanup webida-server, you need to clear your db and all files installed/created by you or webida server. Just remove /home/webida & drop webida database. Or, to reset only, after stopping webida service(s),

$ cd /home/webida/webida-server/src/server
$ node ./app-uninstall.js
$ node ./fs-uninstall.js
$ node ./auth-uninstall.js 
$ cd /home/webida
$ rm -fr ./fs/* ./log/* ./sessions.*

Clone this wiki locally