Project ~ Form Builder - rohit120582sharma/Documentation GitHub Wiki

dmg-form-builder-server/form-builder/public

UI Client for Form Builder

Setup

Requirements

  • Nodejs / NPM
  • Sass
  • Apache
  • Grunt
  • Webpack
  • PHP
  • Composer

Mac Steps:

1. Install Global Dependencies

xcode-select --install
sudo npm install -g grunt
sudo npm install -g webpack
sudo npm install -g cordova

2. Setup Git Repository Locally : Git clone

For Mac: Please setup git Repo on the local sub-directory. If setup under root, there might some permission related error encountered in further steps of setup.

git clone https://git.autodesk.com/ACG-Cloud-Services/dmg-form-builder-server.git

3. Form Builder Middleware Dependencies Setup (Optional if middleware setup already done on machine)

Please run below commands in terminal in directory <user>/<work-subdirectory>/dmg-form-builder-server/form-builder/

composer install

4. Form Builder UI Project Dependencies buildup

Please run below commands in terminal in directory <user>/<work-subdirectory>/dmg-form-builder-server/form-builder/public/

npm install
grunt build:web
grunt serve

'grunt build:web' would generate final deployable code, which would be then hosted on your machine via Apache Server. However, during course of development, you might need to repeatedly change code for your feature implementation, and it might not be practical to run 'grunt build:web' repeatedly again & again. In Such scenario, a developer can use,' webpack --watch' command, which would compile all the file(s) in the live mode, and developer would just need to refresh the browser for changes to be visible.

5. Configure Apache Virtual Host

Below steps are required to configure your localhost to run form builder middleware (PHP-Laravel Layer which would be responsible for authentication, login, API Proxying & redirection).

sudo nano /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName local-dmg-form-builder.com
  ServerAlias local-dmg-form-builder.com
  DocumentRoot "/Users/<user>/<work-subdirectory>/dmg-form-builder-server/form-builder/public"
  DirectoryIndex index.php
  AllowEncodedSlashes NoDecode

  <Directory "/Users/<user>/<work-subdirectory>/dmg-form-builder-server/form-builder/public">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
  </Directory> 
</VirtualHost>

6. Setup Local DNS

sudo nano /etc/hosts
127.0.0.1	local-formbuilder.dmg.autodesk.com

7. Check apache configuration

This project has a middle layer which acts as a hosting layer for the application, and as mentioned earlier, handles authentication pass-throughs, redirects & API Proxying. This Layer is designed on PHP-Laravel Configuration and hence PHP Module needs to be enabled for apache if not already done. Below are some some helpful commands to help with the same.

sudo nano /etc/apache2/httpd.conf
  • search for line starting with 'LoadModule php', and if it is commented then please uncomment it. For e.g., #LoadModule php7_module libexec/apache2/libphp7.so --> LoadModule php7_module libexec/apache2/libphp7.so

  • similarily, search for line starting with 'LoadModule rewrite', and if it is commented then please uncomment it. For e.g.. #LoadModule rewrite_module libexec/apache2/mod_rewrite.so --> LoadModule rewrite_module libexec/apache2/mod_rewrite.so

  • Search for 'User', and edit user to be same as the logged in user. (By default it would be _www, which needs to be changed to <username> ).

  • Search for 'Group', and edit group to be same as the logged in user belongs to. (By default it would be _www, which needs to be changed to <groupname> ).

Once this is done, save the changes and exit. Now, we would need to restart the apache server for changes in configuration to take effect.

sudo apachectl restart

8. Load the Website in browser

Open URL http://local-dmg-form-builder.com/ and it should take you to the Form Builder List Page, if you are already logged in to the alpha oxygen environment. If not, it will redirect you to Login Page, from wherein upon successful credentials entry, would callback to the Form Builder List Page.

Trouble Shooting

1. Installing Composer (In case encountered error at step 3)

Composer Would require to be installed in your machine in case it's not already available. You can use below steps on MAC, to install 'Composer' via brew in case it's not available.

You can skip below command if brew is already installed on your machine

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once brew is installed, you would need to install PHP & Composer. Please find below the list of the commands that you would require to run to install Composer.

brew update
brew tap homebrew/dupes
brew tap homebrew/php
brew install php70
brew install mcrypt php70-mcrypt
brew install composer

Helpful Link : https://gist.github.com/shashankmehta/6ff13acd60f449eea6311cba4aae900a

⚠️ **GitHub.com Fallback** ⚠️