diff --git a/README.md b/README.md index b4548e6..f138fcb 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ MSQL DB Installation Steps for Linux ubuntu 14.04: - $ sudo apt-get install mysql-server Then look for the file : -- /src/main/resources/db.sql - -- db.sql file contents all step for DB table creation commands. +- /src/main/resources/accountsdb +- accountsdb.sql file is a mysql dump file.we have to import this dump to mysql db server +- > mysql -u -p accounts < accountsdb.sql diff --git a/ansible/vprofile.yml b/ansible/vprofile.yml new file mode 100644 index 0000000..c8d6de6 --- /dev/null +++ b/ansible/vprofile.yml @@ -0,0 +1,39 @@ +--- +- hosts: tomcatservers + become: yes + gather_facts: False + tasks: + + - name: Install EPEL-release + yum: name=epel-release state=present + + + - name: Install java_1.8 + yum: name=java-1.8.0-openjdk.x86_64 state=present + + - name: Install tomcat + yum: name=tomcat state=present + + + - name: Download latest VProfile.war file + get_url: url=http://{{nexusip}}:8081/nexus/content/repositories/VProfile-repo/{{groupid}}/{{time}}/{{build}}/{{vprofile_version}} dest=/tmp/ mode=755 + + - name: Stop tomcat service + service: name=tomcat state=stopped + + - name: Copy artifact to tomcat folder + shell: cp /tmp/{{vprofile_version}} /var/lib/tomcat/webapps + + - name: Delete link to existing vprofile version + file: path=/var/lib/tomcat/webapps/VProfile state=absent + + - name: Start tomcat service + service: name=tomcat state=started + - wait_for: path=/var/lib/tomcat/webapps/{{time}}-{{build}} + + - name: Link latest vprofile version + file: src=/var/lib/tomcat/webapps/{{time}}-{{build}} dest=/var/lib/tomcat/webapps/VProfile state=link + + - name: Stop iptables + service: name=iptables state=stopped + diff --git a/pom.xml b/pom.xml index da1aeb6..332e952 100644 --- a/pom.xml +++ b/pom.xml @@ -2,9 +2,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.visualpathit - VProfile + vprofile war - 1.0 + v1 Visualpathit VProfile Webapp http://maven.apache.org diff --git a/src/main/resources/accountsdb.sql b/src/main/resources/accountsdb.sql new file mode 100644 index 0000000..d224d81 --- /dev/null +++ b/src/main/resources/accountsdb.sql @@ -0,0 +1,104 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64) +-- +-- Host: localhost Database: accounts +-- ------------------------------------------------------ +-- Server version 5.7.18-0ubuntu0.16.10.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `role` +-- + +DROP TABLE IF EXISTS `role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `role` +-- + +LOCK TABLES `role` WRITE; +/*!40000 ALTER TABLE `role` DISABLE KEYS */; +INSERT INTO `role` VALUES (1,'ROLE_USER'); +/*!40000 ALTER TABLE `role` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) DEFAULT NULL, + `userEmail` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES (4,'admin_vp','admin@visualpathit.com','$2a$11$DSEIKJNrgPjG.iCYUwErvOkREtC67mqzQ.ogkZbc/KOW1OPOpZfY6'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_role` +-- + +DROP TABLE IF EXISTS `user_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_role` ( + `user_id` int(11) NOT NULL, + `role_id` int(11) NOT NULL, + PRIMARY KEY (`user_id`,`role_id`), + KEY `fk_user_role_roleid_idx` (`role_id`), + CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_role` +-- + +LOCK TABLES `user_role` WRITE; +/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; +INSERT INTO `user_role` VALUES (4,1); +/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-08-28 10:50:51 diff --git a/src/main/resources/db.sql b/src/main/resources/db.sql deleted file mode 100644 index 0c073d1..0000000 --- a/src/main/resources/db.sql +++ /dev/null @@ -1,53 +0,0 @@ --- ---create a User with a password --- -CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; -GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; - -CREATE DATABASE IF NOT EXISTS `accounts`; -USE `accounts`; --- --- Table structure for table `role` --- - -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `role` --- - -LOCK TABLES `role` WRITE; -INSERT INTO `role` VALUES (1,'ROLE_USER'); -UNLOCK TABLES; - --- --- Table structure for table `user` --- - -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(255) DEFAULT NULL, - `userEmail` varchar(255) DEFAULT NULL, - `password` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; - --- --- Table structure for table `user_role` --- - -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `user_id` int(11) NOT NULL, - `role_id` int(11) NOT NULL, - PRIMARY KEY (`user_id`,`role_id`), - KEY `fk_user_role_roleid_idx` (`role_id`), - CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8;