Tendrl Frontend is a graphical user interface for [Tendrl] (https://github.com/Tendrl), a modern, extensible web-based storage management platform, using RESTFul API to communicate with Tendrl API server.
Tendrl frontend is a static webapp, built from a Node.js project. This document details how to contribute to the project as a developer.
- Experience of webapplication development
- Understanding of JavaScript, CSS, HTML
- Familiarity with Node.js & npm
- Familiarity with angularjs
Make sure you have git
, nodejs
, npm
installed in your system, along with
your favorite code-editor & browser with devtools (latest Mozilla Firefox or
Google Chrome recommended).
Follow your platform's own process to set these up. On a Fedora PC, you'll use
$ sudo dnf install -y git nodejs npm
Fork the https://github.com/Tendrl/tendrl_frontend[upstream repo] to your own GitHub account.
This is required.
You will be working/making changes on your own repo, and create https://help.github.com/articles/about-pull-requests/[pull requests] to submit changes to the upstream. Upon peer-review, those changes will be merged, if everything went well. You should never directly push to the upstream, even if you have write access.
Once forked, you can clone the repo to your workstation for development:
$ git clone [email protected]:GitHubUsername/tendrl_frontend.git
$ cd tendrl_frontend
To communicate with the existing developers, ask for help/clarifications etc.
send an email to [email protected] prepending [Frontend]
in the subject
line. This is the mailing list for Tendrl developers, and to be in the loop you
should subscribe here: https://www.redhat.com/mailman/listinfo/tendrl-devel.
Follow standard frontend development best practices to work on the code. Consult http://taitems.github.io/Front-End-Development-Guidelines/[this] and https://isobar-idev.github.io/code-standards/[this] consolidated guides for further details.
In case of confusion or conflict of opinions, please https://github.com/Tendrl/tendrl_frontend/issues/new[create an issue] to start the discussion.
Within the git cloned source directory, run the following commands to build the app. You should be able to build from the source successfully before making any changes to the source.
$ sudo npm install -g gulp
$ npm install
$ gulp
Upon success of all the steps, you should have the build artifacts in ./dist/
subdirectory.
You can also run gulp dev command. It will add watchers to all files and accordingly dist folder will be updated continuosly.
To run and test the build locally, you can use various static file server over
HTTP. We recommend using http-server
module, however, httpd/nginx etc can as
well be used.
$ npm install -g http-server
$ cd dist
$ http-server # starts the web-server with doc-root as `pwd`
The advantage of using http-server
module is that, it's easy to use it with
another existing server which can handle the request, which the test server is
incapable of serving.
$ http-server -P http://production.server/
You should be able to browse the app, running on test server by visiting http://127.0.0.1:8080 from your browser.
- Make sure to pull from
upstream/master
before starting to work on something - Preferably create a branch, after the pull to work on a specific issue
- Fix one thing per commit - neither more, nor less
- Fixing an issue may require a bunch of commits - that's okay
- Give meaningful commit messages, if necessary add descriptions
- Signing off code isn't mandatory but is recommended
- Do not introduce different line-ending conventions in your code (especially if using non-*nix systems)
- Comment/document your code in a way, any new contributor can understand the concept behind the implementation
- Make sure to write tests for the feature you add
- Make sure not to break tests of other features while working on one
Once you've successfully made some changes, built, ran, tested and pushed to your GitHub remote - then you should submit a pull request for the changes to be applied on the upstream repo.
Use https://help.github.com/articles/about-pull-requests/[GitHub's interface] to create new pull requests. Once submitted, the code will go through some automated tests, integration and peer-reviews.
You might be asked for clarification or requested to update your code depending on the review. You can append new commits to fix those nits on the same branch of your repo, and the pull request should be automatically updated to reflect those changes.
Once approved, your code will be merged with the upstream.
Rejoice!
If you enjoyed contributing to Tendrl frontend, pick up another issue. If you need help, reach out to us on mailing list. If you've successfully submitted a few changes, feel free to ask to be a member of the GitHub org.
May the source be with you.
Tendrl frontend is a static webapp, built from a Node.js project. This document details how to build from the source, and then how to configure the webhost to serve the app.
This is the bare minimal requirements for a VM to be able to run the Tendrl frontend server. However, for performance and efficiency, more resources would be good to avail:
- CPU: 1 core, 1 thread
- RAM: 512 MiB
- Storage: 10GiB
- OS: RHEL 7.x or similar
- httpd or, nginx
Only required if building from source:
Installed with distro's package manager: git
, nodejs
, npm
+
Installed with npm
: gulp
,
To deploy Tendrl frontend, you may want to build from source, or install the package.
- If installing from package, skip the "Building from source" section
- If building from source, likewise, skip "Installing from repo" section
TIP: This entire process should be handled by a bootstrapping script in future.
NOTE: The commands listed here assumes latest version of Fedora in use as the host OS, use proper substitution if your environment differ.
Nothing to do here, jump to next step.
You need to register and activate your subscription with customer portal ID to add repos and install packages. @TODO: process details & guides.
You need to enable EPEL repo with yum install epel-release
Follow along the next steps, and depending on distros, some processes, commands and package names may vary.
First we need the essential packages
$ sudo dnf install -y git nodejs npm
Then we need the frontend source
$ git clone https://github.com/Tendrl/tendrl_frontend.git
$ cd tendrl_frontend
Next we will install the dependencies for the package to build
$ sudo npm install -g gulp
$ npm install
Lastly, the build... which is an one step process, using gulp to automate the underlying steps
$ gulp
Once gulp finishes compiling, the build artifacts will be available in the
dist
subdirectory within the source path.
@TODO: content to be added when package details are available.
In this step, we take the build artifacts and serve them as web contents.
@TODO: if installed from package, depending on which all steps are covered in the process, this section might need updating.
For the server to be able to accept and serve external http requests, we need to configure the firewall.
This isn't required to be the first step (and can be done after installing the webserver), however, this is a common step for whatever webserver we choose to go with up next.
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --reload
First, let's install and start nginx
$ sudo dnf install -y nginx
$ sudo systemctl start nginx
At this point, you should be able to see the default nginx webpage, by visiting
http://<hostname.or.ip.address>/
from your browser.
Now, to serve the app content (instead of the default page) you can take either of the 2 following ways (among many other possible, less desirable ways):
. Easy way: copy over app contents to nginx's default webroot
.. Backup the default pages: $ sudo mv /usr/share/nginx/html /usr/share/nginx/default
.. Copy over the app contents: $ cp -r <source-path>/dist /usr/share/nginx/html
. Right way: follow along https://www.nginx.com/resources/admin-guide/serving-static-content/[nginx's official documentation] on how to configure the server for serving static webapp.
Again, let's install and start Apache first
$ sudo dnf install -y httpd
$ sudo systemctl start httpd
At this point, you should be able to see the default httpd webpage, by visiting
http://<hostname.or.ip.address>/
from your browser.
Now, to serve the app content (instead of the default page) you can take either of the 2 following ways (among many other possible, less desirable ways):
. Easy way: copy over app contents to httpd's default webroot: $ cp -r <source-path>/dist/* /var/www/html/
. Right way: follow along https://httpd.apache.org/docs/trunk/configuring.html[Apache's official documentation] on how to configure the server for serving static webapp.
If everything went well, then browsing http://<hostname.or.ip.address>/
from
your web-browser should give you Tendrl's frontend landing page. Congrats!