An API component for Employee Scheduling application that makes employee scheduling and management easy, fast and mobile. The UI component for this application can be found here. I wrote a few blog posts about this project and they can be found on my blog.
- Technologies Used
- Features
- Installation & Configuration
- How to Run
- How to Test
- How to Release
- FAQ
- License
- Use ES6/ES7
- Couchbase Database (a highly scalable distributed KV-Store and Document Database) with N1QL queries
- Internationalization and localization with i18n-node-2
- Transactional emails with Nodemailer and SendGrid
- JSON Web Token (JWT) authentication
##Installation & Configuration ###Platform & Tools You need to have installed follow tools on your machine:
- Virtualbox 5.0.6+
- Vagrant 1.7.4+
- Ansible 1.9.4+
- Node.js 4.2.2+
- npm 2.0.0+
###Installation The steps 3 and 8 are only required when you don't have local instance of Couchbase Server 4.0 configured. If you've already configured a local instance of Couchbase Server 4.0 or newer, the application can use this instance as long as you specify the credentials to connect to Couchbase within the application config.js file.
1. Clone or fork this repository:
$ git clone [email protected]:martinmicunda/employee-scheduling-api.git
$ cd employee-scheduling-api
2. Install local dependencies
$ npm install
3. The following command will add a new ubuntu trusty64 box
, and if an existing one is found, it will override it:
$ vagrant box add ubuntu/trusty64 --force
NOTE: This process may take a while, as most Vagrant boxes will be at least 200 MB big.
Verify that box was installed by running the list
subcommand that will list the boxes installed within Vagrant along with the provider that backs the box:
$ vagrant box list
ubuntu/trusty64 (virtualbox, 14.04)
4. The following command will install an ansible roles
for this project, and if an existing one is found, it will override it:
$ ansible-galaxy install franklinkim.docker franklinkim.docker-compose moviedo.nvm --force
Verify that ansible roles were installed by running the list
subcommand that will list the installed roles:
$ ansible-galaxy list
franklinkim.docker, 1.5.0
franklinkim.docker-compose, 1.1.0
moviedo.nvm, v1.1.1
5. Now, run vagrant up
command that will install Docker
, Docker Compose
, NVM
inside of vagrant box:
$ vagrant up
NOTE: Vagrant will provision the virtual machine only once on the first run, any subsequent provisioning must be executed with the
--provision
flag eithervagrant up --provision
orvagrant reload --provision
. The provisioning will re-run also if you destroy the VM and rebuild it withvagrant destroy
andvagrant up
.
6. Once the box is up and running we can ssh into box:
$ vagrant ssh
and run Couchbase Server:
$ cd api
$ docker-compose up db
NOTE: This process may take a while, when you run this command for the first time as it pull couchbase docker image from docker repository.
7. As we are running the Couchbase Server for the first time we need to make sure the server is configured properly before we start any development. The below command will provision Couchbase Server instance:
$ npm run setup
8. Now when we provisioned Couchbase Server instance we can seed this instance with an application data:
$ npm run seed
Finally, open up your browser and navigate to Couchbase admin UI http://localhost:8091 with username: Administrator
and password: password
.
Start the couchbase:
$ vagrant up && vagrant ssh
$ cd api
$ docker-compose up db
Start the server:
$ npm start
NOTE: The dotenv is use as an environment variable manager that loads environment variables from
.env
intoENV
(process.env).
Start the server with nodemon:
$ npm run dev
From time to time you might want to reset and seed data; to achieve this you can run a follow command:
$ npm run seed
1. The following command would permanently removes the default
virtual box from your machine:
$ vagrant destroy
2. The following command will uninstall an ansible roles
for this project:
$ ansible-galaxy uninstall franklinkim.docker franklinkim.docker-compose moviedo.nvm
3. The following command will remove trusty64 box
:
$ vagrant box remove trusty64
###What if I want a fresh install?
If you wish to destroy the default
virtual boxe to make sure you have a fresh start, you can do these steps:
$ vagrant destroy
$ vagrant up
Copyright (c) 2014-2015 Martin Micunda
Source code is open source and released under the GNU GPL v3 license.