diff --git a/README.md b/README.md index c6a9ad7..5596230 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,6 @@ # Webida Server - Server platform for Web-based IDE [webida-client](https://github.com/webida/webida-client) +- You can find installation/configuration guides in [Webida Server Wiki] (https://github.com/webida/webida-server/wiki) -# Installation & Run - -- [Prerequisites](./doc/prerequisites.md) -- [Quick Installation Guide](./doc/quick-guide.md) -- [Advanced Installation Guide](./doc/advanced-guide.md) - -# this document is now deprecated. see [webida server wiki](https://github.com/webida/webida-server/wiki) +# All documents are moved to [Webida Server Wiki] (https://github.com/webida/webida-server/wiki) diff --git a/doc/advanced-guide.md b/doc/advanced-guide.md deleted file mode 100644 index 2bd06c6..0000000 --- a/doc/advanced-guide.md +++ /dev/null @@ -1,296 +0,0 @@ -# Advanced Installation Guide - -- Do you want to read simpler version? Check [Quick Guide](./quick-guide.md) first. - -## Source Structure - - /doc documents directory - /src source directory - /server server source, configuration and installation scripts - /app app server - /auth auth server (oauth2, ACL and user/group management) - /build build server - /buildjm build job manager server - /common common modules - /conf configurations - /emul emulators - /fs file system server - /notify notification server - /proxy reverse proxy server - /tests QUnit test scripts - /ext 3rd party libraries - update-system-apps.sh update system applications from the repositories for each applications. - -## Dependencies And Setup - -At first, please check the [prerequisites](./prerequisites.md) document. - -### Install Node Dependencies -Our server use various libraries that are provided by npm. These libraries specified in the package.json in "/src/server" directory. -Before running server, these libraries should be installed. You can run "npm install" command at the "/src/server" directory. - - $ git clone git@github.com:webida/webida-server.git - $ cd ./src/server - $ npm install - $ npm install express --save - $ npm install ffi pty.js - -Then, all modules will be installed into node_modules directory. - -### Make Required Directory -Create the default log directory. - - $ mkdir ./src/server/log - -You can change this paths to modify /conf/default-conf.js file - - // default-conf.js - ... - logPath: process.env.WEBIDA_LOG_PATH || path.normalize(__dirname + '/../log'), - ... - fsPath: process.env.WEBIDA_FS_PATH || path.normalize(__dirname + '/../fs/fs'), - ... - -### Initialize Servers - -#### Initialize Auth Server -Our server uses Mysql database which had been already installed in prerequisite step. On this step, you should install the database schema into the database. -The `auth-install.js` which is located in the "/src/server/" creates database and tables into your database. -The following command will do what we described above. - - $ node auth-install.js - -The default database account and password is "webida". You can change database access information to rewrite /src/server/conf/default-conf.js file. - - // default-conf.js - ... - db: { - fsDb: mongoDb + '/webida_fs', - authDb: mongoDb + '/webida_auth', // db name in mongodb for session store - appDb: mongoDb + '/webida_app', - mysqlDb: { - host : 'localhost', - user : 'webida', - password : 'webida', - database : 'webida' - } - }, - ... - -You can query tables from the database that created by auth-install.js. - -#### Initialize App Server - -##### Update system application from GIT - -System application is an our default HTML application. /update-system-apps.sh will update default client HTML application. -Or following command will download & update default application. - - $ /update-system-apps.sh - - # OR - - $ git submodule update --init --recursive - $ git submodule foreach git pull origin master - -##### Install default system application -Our server can serve various HTML Web applications. To serve your own HTML applications, it should be registered into database. -Default system applications specified in /src/server/conf/default-conf.js as following codes: - -default-conf.js - - systemApps: [ - { - id: 'webida-client', - oAuthClientId: 'CLIENT_TO_BE_SET', - oAuthClientSecret: 'CLIENT_SECRET_TO_BE_SET', - redirectUrl: '/auth.html', - domain: 'ide', - appType: 'html', - name: 'Webida IDE', - desc: 'Webida client application for Editing', - status: 'running' - }, - { - id: 'app-dashboard', - oAuthClientId: 'DASHBOARD_CLIENT_ID', - oAuthClientSecret: 'DASHBOARD_CLIENT_SECRET', - redirectUrl: '/pages/auth.html', - domain: '', - appType: 'html', - name: 'Webida Dashboard', - desc: 'Webida client application for management information', - status: 'running' - } - ], - -If you want, you can add your own system application like below: - -default-conf.js - - systemApps: [ - ..., - { - id: 'app-your-own', - oAuthClientId: 'YOUR_APP_CLIENT_TO_BE_SET', - oAuthClientSecret: 'YOUR_APP_CLIENT_SECRET_TO_BE_SET', - redirectUrl: '/auth.html', // redirect path relative with your app root directory. It should start with slash("/"). - domain: 'myapp', - appType: 'html', - name: 'My app', - desc: 'This is my app', - status: 'running' - } - ], - -And run this command. - - $ update-system-apps.sh - -Above command will get submodules from git repository and, run "npm install" & "npm update" command to update submodules of system application. -Then you can access app-your-own by url(http(s)://myapp.webida.mine/). If you use `path` deploy option, the url will be (http(s)://webida.mine:5001/-/myapp/). - - -##### Install system application to your system. -After downloading system application from GIT, system application need to be installed to your host and database. -Following command will do that. - - $ node app-install.js - -app-install.js runs below steps : -* run "npm install" command to install sub modules. -* optimize source codes (compression and minify) -* copy applications to specific file system which specified in default-conf.js. -* register application information to database - -### Setup Linux Container and File System - -#### Configure Linux Container path -There is a section(lxc) for linux container in server config file. -Each attributes in lxc section means as follow : -* useLxc - whether lxc will be used -* confPath - config file path that used when lxc running -* rootfsPath - specified container image path. -* containerNamePrefix - reversed -* userid - userid used in Linux container - -Please refer to lxc section in following sample. - - services: { - .... - .... - fs : { - serviceType: 'fs', - fsPath: process.env.WEBIDA_FS_PATH || path.normalize(__dirname + '/../fs/fs'), - - fsAliasUrlPrefix: '/webida/alias', - /* - * Module name for handling lowlevel linux fs. - * The modules are located in lib/linuxfs directory. - * Currently two filesystems are implemented. - * 'default': Use basic linux fs. Any POSIX fs can be used. This does not support quota. - * 'btrfs': Use Btrfs. This supports quota. - */ - linuxfs: 'default', - /* - * Settings for using LXC(Linux Containers) - */ - lxc: { - useLxc: true, - confPath: path.normalize(__dirname + '/../fs/lxc/webida/webida.conf'), - rootfsPath: path.normalize(__dirname + '/../fs/lxc/webida/rootfs'), - containerNamePrefix: 'webida', - userid: 'webida' - }, - -#### Setup the lxc directory that used in Linux Container -Create or Download rootfs file and move it to `rootfsPath` pre-configured. -If you don't have webida rootfs file, you can create one by reference to [LXC Guide](./lxc-guide.md). - -#### Choosing file system type -You can choose the file system used by our file system server. The default file system doesn't support quota for each user's file system size. -On the above code block, you can specify file system type at "services.fs.linuxfs" section. -Currently, three file Systems are implemented. - -* default: Use basic linux fs. Any POSIX fs can be used. This does not support quota. -* btrfs: Use Btrfs. This supports quota. -* XFS: Use XFS. This supports quota. - -If you want to use QUOTA, then you can choose XFS file system that's what we recommended. -Each modules of file system's implementation are located in src/server/fs/lib/linuxfs directory. - -If you select XFS, then you should prepare XFS file system and also modify configuration file(/src/server/conf/default-conf.js). -Refer to [XFS Guide](./xfs-guide.md) document. - -#### File System Path -Before using XFS file system, that should be mounted to your local file system as XFS. This can be specified in services.fsPath section in above code block. -How to mount XFS file system described at prerequisites. - -Create file system folder which is used each user's file system. - - $ cd src/server/fs - $ mkdir fs - -This path also specified as "fsPath" variable in default-conf.js - -### Setup Reverse Proxy -If you'd like to use reverse proxy for servers, modifying configurations is the only thing you should do before installation. - -conf/default-conf.js - - ... - var useReverseProxy = true; - ... - units: [ 'auth0', 'fs0', 'ntf0', 'conn0', 'buildjm0', 'build0', 'app0', 'proxy0' ], - ... - -Then the default applications is automatically going to see the proxy server. -If you have already installed webida-server, you should uninstall first. Check this [section](#Uninstallation). - - -## Run -### Server runs in single instance -You can simply run all servers with following command. - - $ node unit-manager.js - -Then, unit-manager.js just 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 console. - -Then you can access the default application at [http://webida.mine:5001/](http://webida.mine:5001/) on the browser. - -### Server runs as distributed instance -Our server consist of various servers like auth, fs, app, build, ntf ..so on. -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 default-conf.js in src/server/conf directory. - -Then you can access the default application at [http://webida.mine:5001/](http://webida.mine:5001/) on the browser. - -## Uninstallation - -If you want to cleanup webida-server, you need to clear your db and sources. - -### Cleanup data - -``` -$ cd ./src/server -$ node fs-uninstall.js -$ node app-uninstall.js -$ node auth-uninstall.js -``` - -### Cleanup MysqlDB - -``` -$ mysql -u webida -p -drop database webida; -``` - -### Remove repository directory - -``` -$ rm -rf webida-server -``` \ No newline at end of file diff --git a/doc/lxc-guide.md b/doc/lxc-guide.md deleted file mode 100644 index ec3ca75..0000000 --- a/doc/lxc-guide.md +++ /dev/null @@ -1,150 +0,0 @@ -# LXC guide - -## Create Container for Webida-server - -### Modify LXC Network configurations - -For expanding ip address range assigned to each `lxc-execute`s, it should be required. - -Modify /etc/init/lxc-net.conf file: - - env USE_LXC_BRIDGE="true" - env LXC_BRIDGE="lxcbr0" - env LXC_ADDR="10.0.0.1" - env LXC_NETMASK="255.0.0.0" - env LXC_NETWORK="10.0.0.0/8" - env LXC_DHCP_RANGE="10.0.0.1,10.255.255.254" - env LXC_DHCP_MAX="16000000" - -And also modify /etc/default/lxc-net file: - - LXC_BRIDGE="lxcbr0" - LXC_ADDR="10.0.0.1" - LXC_NETMASK="255.0.0.0" - LXC_NETWORK="10.0.0.0/8" - LXC_DHCP_RANGE="10.0.0.2,10.255.255.254" - LXC_DHCP_MAX="16000000" - -And restart lxc services: - - $ stop lxc - $ restart lxc-net - $ start lxc - -### Create Container - - $ mkdir lxc - $ sudo lxc-create -P ./lxc -t download -n webida -- -d ubuntu -r trusty -a amd64 - -### Install Required Packages - -#### Run container - -``` -$ sudo lxc-start -n webida -f ./lxc/webida/config -``` -#### Open another terminal and attach webida container - -``` -$ sudo lxc-attach -n webida -``` - -#### make user - -``` -root@webida:/# adduser webida --uid 1002 -# password: webida -``` - -#### install - -``` -root@webida:/# apt-get install git git-svn lxc openjdk-7-jdk -root@webida:/# mkdir /fs -``` - -#### create git.sh - -``` -root@webida:/# vi /usr/bin/git.sh -root@webida:/# chmod +x /usr/bin/git.sh -``` - -git.sh -``` -#/bin/bash -AUTH_ID='' -AUTH_PASS='' -ARGS=( ) -#SSH_KEY=$HOME/.userinfo/id_rsa -#UNIQ_KEY=`uuid` -#TMP_SSH=/tmp/.git_ssh.$UNIQ_KEY - -for args in "$@" -do - if [[ "$args" = --authuser* ]] ;then - AUTH_ID=`echo "$args" | cut -d'=' -f2` - elif [[ "$args" = --authpass* ]] ;then - AUTH_PASS=`echo "$args" | cut -d'=' -f2` - else - ARGS=("${ARGS[@]}" "$args") - fi -done - -#if [ -f $SSH_KEY ]; then -# echo "ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $SSH_KEY \$@" > $TMP_SSH -# chmod +x $TMP_SSH -# export GIT_SSH=$TMP_SSH -#fi - -#git Run the git command -if [ ! -z $AUTH_ID ] ;then -#expect -d < \$HOME/.userinfo/id_rsa" -#fi - -``` - -#### stop container - -``` -root@webida:/# exit -$ sudo lxc-stop -n webida -``` - -### Move container to the webida fs server - -``` -$ mv ./lxc/webida/config ./lxc/webida/webida.conf -$ sudo cp -R ./lxc/webida/rootfs /src/server/fs/lxc/webida/ -$ sudo cp ./lxc/webida/webida.conf /src/server/fs/lxc/webida/ -$ vi ~/webida-server/src/server/fs/lxc/webida/webida.conf - -# modify webida.conf -... -lxc.rootfs = /home/webida/webida-server/src/server/fs/lxc/webida/rootfs -... -``` \ No newline at end of file diff --git a/doc/prerequisites.md b/doc/prerequisites.md deleted file mode 100644 index 4ac38d7..0000000 --- a/doc/prerequisites.md +++ /dev/null @@ -1,85 +0,0 @@ -# Prerequisites - -## System Requirements - -Currently, webida server officially supports Ubuntu only (tested on 14.04 64bit) Computer for running the Webida Server, with the following system requirements: - -* UbuntuĀ® 14.04 (64-bit) -* At least dual-core 2 GHz of CPU -* At least 4 GB of RAM memory -* At least (100 GB + number of users * 10 mb) of free disk space Local administrator authority - -## Install Dependencies - -### Install Packages - -Install Ubuntu Packages - -``` -$ sudo apt-get install -y make gcc g++ libattr1-dev lxc openjdk-7-jre -``` - -Install Node.js (tested on version **0.10.26**) - -Download the latest pre-built binary from nodejs website [http://nodejs.org/download](http://nodejs.org/download) and copy it to /usr/local - -``` -$ wget http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-x64.tar.gz -$ tar zxvf node-v0.10.26-linux-x64.tar.gz -$ cd node-v0.10.26-linux-x64 -$ sudo cp -r * /usr/local/ -$ sudo npm install npm -g -``` - -Install grunt-cli nodejs module to system. This is required to minify system apps properly. - -``` -$ sudo npm install grunt-cli -g -``` - -Install git-svn command to system. - -``` -$ sudo apt-get install git-svn -``` - -### Install Database - -Install mysql packages and create the user/database. database name : "webida" mysql account(id/pw) : "webida"/"webida" - -``` -$ sudo apt-get install mysql-server mysql-client -$ sudo mysqladmin -u root create webida -p // create "webida" database -$ sudo mysql -u root -p webida // connect to "webida" database with root account -mysql> GRANT ALL PRIVILEGES ON webida.* TO webida@localhost IDENTIFIED BY 'webida' WITH GRANT OPTION; // create webida account -mysql> exit -``` - -## Server Settings - -Webida servers should be run as webida user with 1002 uid. Run the following command in each servers. - -``` -$ sudo adduser --uid 1002 webida -``` - -If you will use reverse proxy server, webida servers can only be accessed by domain names, not by IP addresses. Set webida server domain names on DNS server. Or set domain names in local /etc/hosts file for tests. - -``` -127.0.0.1 webida.mine -# If you use reverse proxy server, below lines are compulsory. -127.0.0.1 auth.webida.mine -127.0.0.1 fs.webida.mine -127.0.0.1 app.webida.mine -127.0.0.1 deploy.webida.mine -127.0.0.1 jash.webida.mine -127.0.0.1 conn.webida.mine -127.0.0.1 build.webida.mine -127.0.0.1 ntf.webida.mine -127.0.0.1 debug.webida.mine -127.0.0.1 cors.webida.mine -``` - -## LXC Container - -To create and config LXC container, read [Webida LXC Guide](./lxc-guide.md). \ No newline at end of file diff --git a/doc/quick-guide.md b/doc/quick-guide.md deleted file mode 100644 index 5568aca..0000000 --- a/doc/quick-guide.md +++ /dev/null @@ -1,48 +0,0 @@ -# Quick Installation Guide - -At first, please check the [prerequisites](./prerequisites.md) document. - -``` -$ git clone git@github.com:webida/webida-server.git -``` - -Install node dependencies - -``` -# move to "/src/server" directory -$ cd ./src/server -$ npm install -$ npm install express --save -$ npm install ffi pty.js -``` - -Update default system apps - -``` -$ git submodule update --init --recursive -$ git submodule foreach git pull origin master -``` - -Make required directories - -``` -$ mkdir ./log -$ mkdir ./fs/fs -``` - -Initialize database for membership, authorization and apps - -``` -$ node auth-install.js -$ node app-install.js -$ node fs-install.js -``` - -# Run server - -``` -# move to "/src/server/" directory -$ node unit-manager.js -``` - -Then you can access application at [http://webida.mine:5001/](http://webida.mine:5001/) on the browser. diff --git a/doc/xfs-guide.md b/doc/xfs-guide.md deleted file mode 100644 index fed09ef..0000000 --- a/doc/xfs-guide.md +++ /dev/null @@ -1,41 +0,0 @@ -# XFS Guide - -## Prepare XFS storage for user file system - -Create directories for user file system: - - $ sudo mkdir /webida/fs - $ soudo chown webida:webida /webida/fs - -Create and Mount XFS to /webida: - - $ sudo apt-get install xfsprogs - $ sudo mkfs.xfs # create xfs filesystem - $ sudo mount -o pquota /webida/fs # mount with pquota option - $ sudo touch /etc/projects /etc/projid # make pquota related files (?) - $ sudo chgrp webida /etc/projects /etc/projid # Set pquota related files writable (?) - -Check the contents of `/etc/fstab` file: - - # /etc/fstab: static file system information. - # - # Use 'blkid' to print the universally unique identifier for a - # device; this may be used with UUID= as a more robust way to name devices - # that works even if disks are added and removed. See fstab(5). - # - # - # / was on /dev/sda5 during installation - UUID=b854d7a8-e119-40a4-a043-a0fd32edf471 / ext4 errors=remount-ro 0 1 - # swap was on /dev/sda1 during installation - UUID=cd6ada1f-5832-4268-a8d2-3df70a167f41 none swap sw 0 0 - - /dev/sda6 /webida-btrfs btrfs defaults 1 2 - /dev/sda7 /webida xfs defaults, pquota 1 2 - -Modify webida-server configuration file `/src/server/conf/default-conf.js` - - // default-conf.js - - ... - fsPath: process.env.WEBIDA_FS_PATH || '/webida/fs', - ... \ No newline at end of file diff --git a/doc/monitor/dbmon-create.sql b/src/server/db-schema/dbmon-create.sql similarity index 99% rename from doc/monitor/dbmon-create.sql rename to src/server/db-schema/dbmon-create.sql index af47cf2..fdb5d61 100644 --- a/doc/monitor/dbmon-create.sql +++ b/src/server/db-schema/dbmon-create.sql @@ -1,14 +1,11 @@ - /* Script for creating a profiling database */ CREATE DATABASE dbmon; - grant all on dbmon.* TO webida@localhost; - CREATE TABLE profile_inst ( inst_id INT(10) auto_increment primary key, inst_name VARCHAR(30) NOT NULL, diff --git a/doc/monitor/dbmon-remove.sql b/src/server/db-schema/dbmon-remove.sql similarity index 100% rename from doc/monitor/dbmon-remove.sql rename to src/server/db-schema/dbmon-remove.sql diff --git a/src/server/db-schema/webida-server-core-indices.sql b/src/server/db-schema/webida-server-core-indices.sql new file mode 100644 index 0000000..df14a79 --- /dev/null +++ b/src/server/db-schema/webida-server-core-indices.sql @@ -0,0 +1,146 @@ +ALTER TABLE `mem_group_user` +ADD INDEX `mem_group_user_fk_02_idx` (`user_id` ASC); +ALTER TABLE `mem_group_user` +ADD CONSTRAINT `mem_group_user_fk_01` + FOREIGN KEY (`group_id`) + REFERENCES `mem_group` (`group_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, +ADD CONSTRAINT `mem_group_user_fk_02` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `fs_lock` +ADD INDEX `fs_lock_fk_01_idx` (`user_id` ASC), +ADD INDEX `fs_lock_fk_02_idx` (`wfs_id` ASC); +ALTER TABLE `fs_lock` +ADD CONSTRAINT `fs_lock_fk_01` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, +ADD CONSTRAINT `fs_lock_fk_02` + FOREIGN KEY (`wfs_id`) + REFERENCES `fs_wfs` (`wfs_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `fs_wfs` +ADD INDEX `fs_wfs_fk_01_idx` (`owner_id` ASC); +ALTER TABLE `fs_wfs` +ADD CONSTRAINT `fs_wfs_fk_01` + FOREIGN KEY (`owner_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `mem_group` +ADD INDEX `mem_group_fk_01_idx` (`owner_id` ASC); +ALTER TABLE `mem_group` +ADD CONSTRAINT `mem_group_fk_01` + FOREIGN KEY (`owner_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `mem_policy` +ADD INDEX `mem_policy_fk_01_idx` (`owner_id` ASC); +ALTER TABLE `mem_policy` +ADD CONSTRAINT `mem_policy_fk_01` + FOREIGN KEY (`owner_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `mem_policy_subject` +ADD INDEX `mem_policy_subject_fk_02_idx` (`subject_id` ASC); +ALTER TABLE `mem_policy_subject` +ADD CONSTRAINT `mem_policy_subject_fk_01` + FOREIGN KEY (`policy_id`) + REFERENCES `mem_policy` (`policy_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, +ADD CONSTRAINT `mem_policy_subject_fk_02` + FOREIGN KEY (`subject_id`) + REFERENCES `mem_subject` (`subject_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `mem_temp_key` +ADD INDEX `mem_temp_key_fk_01_idx` (`user_id` ASC); +ALTER TABLE `mem_temp_key` +ADD CONSTRAINT `mem_temp_key_fk_01` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `oauth_code` +ADD INDEX `oauth_code_fk_01_idx` (`user_id` ASC); +ALTER TABLE `oauth_code` +ADD CONSTRAINT `oauth_code_fk_01` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `oauth_token` +ADD INDEX `oauth_token_fk_01_idx` (`user_id` ASC); +ALTER TABLE `oauth_token` +ADD CONSTRAINT `oauth_token_fk_01` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `fs_alias` +ADD INDEX `fs_alias_fk_01_idx` (`wfs_id` ASC), +ADD INDEX `fs_alias_fk_02_idx` (`owner_id` ASC); +ALTER TABLE `fs_alias` +ADD CONSTRAINT `fs_alias_fk_01` + FOREIGN KEY (`wfs_id`) + REFERENCES `fs_wfs` (`wfs_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, +ADD CONSTRAINT `fs_alias_fk_02` + FOREIGN KEY (`owner_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `webida_app` +ADD INDEX `webida_app_fk_01_idx` (`owner_id` ASC); +ALTER TABLE `webida_app` +ADD CONSTRAINT `webida_app_fk_01` + FOREIGN KEY (`owner_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `fs_download_link` +ADD INDEX `fs_download_link_fk_01_idx` (`wfs_id` ASC); +ALTER TABLE `fs_download_link` +ADD CONSTRAINT `fs_download_link_fk_01` + FOREIGN KEY (`wfs_id`) + REFERENCES `fs_wfs` (`wfs_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `webida_gcm_info` +ADD INDEX `webida_gcm_info_fk_01_idx` (`user_id` ASC); +ALTER TABLE `webida_gcm_info` +ADD CONSTRAINT `webida_gcm_info_fk_01` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `webida_key_store` +ADD INDEX `webida_key_store_fk_01_idx` (`wfs_id` ASC), +ADD INDEX `webida_key_store_fk_02_idx` (`user_id` ASC); +ALTER TABLE `webida_key_store` +ADD CONSTRAINT `webida_key_store_fk_01` + FOREIGN KEY (`wfs_id`) + REFERENCES `fs_wfs` (`wfs_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, +ADD CONSTRAINT `webida_key_store_fk_02` + FOREIGN KEY (`user_id`) + REFERENCES `mem_user` (`user_id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION; +ALTER TABLE `mem_temp_key` ADD UNIQUE INDEX `mem_temp_key_UNIQUE_01` (`user_id` ASC); +ALTER TABLE `mem_temp_key` ADD UNIQUE INDEX `mem_temp_key_UNIQUE_02` (`key` ASC); +ALTER TABLE `oauth_client` ADD UNIQUE INDEX `oauth_client_UNIQUE_01` (`oauth_client_id` ASC); +ALTER TABLE `mem_user` ADD UNIQUE INDEX `mem_user_UNIQUE_01` (`act_key` ASC); +ALTER TABLE `mem_user` ADD UNIQUE INDEX `mem_user_UNIQUE_02` (`uid` ASC); +ALTER TABLE `mem_user` ADD UNIQUE INDEX `mem_user_UNIQUE_03` (`email` ASC); \ No newline at end of file diff --git a/doc/schema.sql b/src/server/db-schema/webida-server-core-tables.sql similarity index 54% rename from doc/schema.sql rename to src/server/db-schema/webida-server-core-tables.sql index b5604ee..9ad0223 100644 --- a/doc/schema.sql +++ b/src/server/db-schema/webida-server-core-tables.sql @@ -1,3 +1,8 @@ +/* + * usually, installers of each server handles creating DB tables + * so, following SQLs will not work on our DB + */ + CREATE TABLE `mem_user` ( `user_id` VARCHAR(32) NOT NULL, `email` VARCHAR(255) NULL, @@ -173,150 +178,3 @@ CREATE TABLE `sequence` ( `max_seq` INT(10) UNSIGNED NULL DEFAULT 4294967295, `create_time` DATETIME NULL, PRIMARY KEY (`space`)); - -ALTER TABLE `mem_group_user` -ADD INDEX `mem_group_user_fk_02_idx` (`user_id` ASC); -ALTER TABLE `mem_group_user` -ADD CONSTRAINT `mem_group_user_fk_01` - FOREIGN KEY (`group_id`) - REFERENCES `mem_group` (`group_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, -ADD CONSTRAINT `mem_group_user_fk_02` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `fs_lock` -ADD INDEX `fs_lock_fk_01_idx` (`user_id` ASC), -ADD INDEX `fs_lock_fk_02_idx` (`wfs_id` ASC); -ALTER TABLE `fs_lock` -ADD CONSTRAINT `fs_lock_fk_01` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, -ADD CONSTRAINT `fs_lock_fk_02` - FOREIGN KEY (`wfs_id`) - REFERENCES `fs_wfs` (`wfs_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `fs_wfs` -ADD INDEX `fs_wfs_fk_01_idx` (`owner_id` ASC); -ALTER TABLE `fs_wfs` -ADD CONSTRAINT `fs_wfs_fk_01` - FOREIGN KEY (`owner_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `mem_group` -ADD INDEX `mem_group_fk_01_idx` (`owner_id` ASC); -ALTER TABLE `mem_group` -ADD CONSTRAINT `mem_group_fk_01` - FOREIGN KEY (`owner_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `mem_policy` -ADD INDEX `mem_policy_fk_01_idx` (`owner_id` ASC); -ALTER TABLE `mem_policy` -ADD CONSTRAINT `mem_policy_fk_01` - FOREIGN KEY (`owner_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `mem_policy_subject` -ADD INDEX `mem_policy_subject_fk_02_idx` (`subject_id` ASC); -ALTER TABLE `mem_policy_subject` -ADD CONSTRAINT `mem_policy_subject_fk_01` - FOREIGN KEY (`policy_id`) - REFERENCES `mem_policy` (`policy_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, -ADD CONSTRAINT `mem_policy_subject_fk_02` - FOREIGN KEY (`subject_id`) - REFERENCES `mem_subject` (`subject_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `mem_temp_key` -ADD INDEX `mem_temp_key_fk_01_idx` (`user_id` ASC); -ALTER TABLE `mem_temp_key` -ADD CONSTRAINT `mem_temp_key_fk_01` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `oauth_code` -ADD INDEX `oauth_code_fk_01_idx` (`user_id` ASC); -ALTER TABLE `oauth_code` -ADD CONSTRAINT `oauth_code_fk_01` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `oauth_token` -ADD INDEX `oauth_token_fk_01_idx` (`user_id` ASC); -ALTER TABLE `oauth_token` -ADD CONSTRAINT `oauth_token_fk_01` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `fs_alias` -ADD INDEX `fs_alias_fk_01_idx` (`wfs_id` ASC), -ADD INDEX `fs_alias_fk_02_idx` (`owner_id` ASC); -ALTER TABLE `fs_alias` -ADD CONSTRAINT `fs_alias_fk_01` - FOREIGN KEY (`wfs_id`) - REFERENCES `fs_wfs` (`wfs_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, -ADD CONSTRAINT `fs_alias_fk_02` - FOREIGN KEY (`owner_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `webida_app` -ADD INDEX `webida_app_fk_01_idx` (`owner_id` ASC); -ALTER TABLE `webida_app` -ADD CONSTRAINT `webida_app_fk_01` - FOREIGN KEY (`owner_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `fs_download_link` -ADD INDEX `fs_download_link_fk_01_idx` (`wfs_id` ASC); -ALTER TABLE `fs_download_link` -ADD CONSTRAINT `fs_download_link_fk_01` - FOREIGN KEY (`wfs_id`) - REFERENCES `fs_wfs` (`wfs_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `webida_gcm_info` -ADD INDEX `webida_gcm_info_fk_01_idx` (`user_id` ASC); -ALTER TABLE `webida_gcm_info` -ADD CONSTRAINT `webida_gcm_info_fk_01` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `webida_key_store` -ADD INDEX `webida_key_store_fk_01_idx` (`wfs_id` ASC), -ADD INDEX `webida_key_store_fk_02_idx` (`user_id` ASC); -ALTER TABLE `webida_key_store` -ADD CONSTRAINT `webida_key_store_fk_01` - FOREIGN KEY (`wfs_id`) - REFERENCES `fs_wfs` (`wfs_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, -ADD CONSTRAINT `webida_key_store_fk_02` - FOREIGN KEY (`user_id`) - REFERENCES `mem_user` (`user_id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION; -ALTER TABLE `mem_temp_key` ADD UNIQUE INDEX `mem_temp_key_UNIQUE_01` (`user_id` ASC); -ALTER TABLE `mem_temp_key` ADD UNIQUE INDEX `mem_temp_key_UNIQUE_02` (`key` ASC); -ALTER TABLE `oauth_client` ADD UNIQUE INDEX `oauth_client_UNIQUE_01` (`oauth_client_id` ASC); -ALTER TABLE `mem_user` ADD UNIQUE INDEX `mem_user_UNIQUE_01` (`act_key` ASC); -ALTER TABLE `mem_user` ADD UNIQUE INDEX `mem_user_UNIQUE_02` (`uid` ASC); -ALTER TABLE `mem_user` ADD UNIQUE INDEX `mem_user_UNIQUE_03` (`email` ASC); \ No newline at end of file diff --git a/src/system-configs/upstart-configs/proxies/webida-cors-proxy.conf b/src/system-configs/upstart-configs/proxies/webida-cors-proxy.conf index 2ad7b8d..619722b 100644 --- a/src/system-configs/upstart-configs/proxies/webida-cors-proxy.conf +++ b/src/system-configs/upstart-configs/proxies/webida-cors-proxy.conf @@ -14,7 +14,7 @@ setuid webida expect fork env WEBIDA_HOME="/home/webida" -env SERVER_DIR="webida-server/src/server" +env SERVER_DIR="webida-server/ext/CORS-proxy" env LOG="/dev/null" env NODE_ENV='production'