Vprofile Project Setup Mac M1 M2
Vprofile Project Setup Mac M1 M2
Prerequisite
1. Oracle VM Virtualbox
2. Vagrant
3. Vagrant plugins
Execute below command in your computer to install hostmanager plugin
$ vagrant plugin install vagrant-hostmanager
$ vagrant plugin install vagrant-vbguest
VM SETUP
1. Clone source code.
2. Cd into the repository.
3. Switch to the main branch.
4. cd into vagrant/Manual_provisioning
Bring up vm’s
$ vagrant up
NOTE: Bringing up all the vm’s may take a long time based on various factors.
If vm setup stops in the middle run “vagrant up” command again.
INFO: All the vm’s hostname and /etc/hosts file entries will be automatically updated.
PROVISIONING
Services
Login to the db vm
$ vagrant ssh db01
$ sudo -i
Verify Hosts entry, if entries missing update the it with IP and hostnames
# cat /etc/hosts
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Restart mariadb-server
# systemctl restart mariadb
Starting the firewall and allowing the mariadb to access from port no. 3306
# systemctl start firewalld
# systemctl enable firewalld
# firewall-cmd --get-active-zones
# firewall-cmd --zone=public --add-port=3306/tcp --permanent
# firewall-cmd --reload
# systemctl restart mariadb
2. MEMCACHE SETUP
Verify Hosts entry, if entries missing update the it with IP and hostnames
# cat /etc/hosts
Starting the firewall and allowing the port 11211 to access memcache
# firewall-cmd --add-port=11211/tcp
# firewall-cmd --runtime-to-permanent
# firewall-cmd --add-port=11111/udp
# firewall-cmd --runtime-to-permanent
# sudo memcached -p 11211 -U 11111 -u memcached -d
3.RABBITMQ SETUP
Verify Hosts entry, if entries missing update the it with IP and hostnames
# cat /etc/hosts
Install Dependencies
# curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash
# sudo yum clean all
# sudo yum makecache
# sudo yum install erlang -y
Config Change
# sudo sh -c 'echo "[{rabbit, [{loopback_users, []}]}]." > /etc/rabbitmq/rabbitmq.config'
# sudo rabbitmqctl add_user test test
# sudo rabbitmqctl set_user_tags test administrator
FEDORA Changes
# firewall-cmd --add-port=5671/tcp --permanent
# firewall-cmd --add-port=5672/tcp --permanent
# firewall-cmd --reload
# sudo systemctl restart rabbitmq-server
# reboot
Verify Hosts entry, if entries missing update the it with IP and hostnames
# cat /etc/hosts
Set Repository
# yum install epel-release -y
Install Dependencies
# dnf -y install java-11-openjdk java-11-openjdk-devel
[Service]
User=tomcat
WorkingDirectory=/usr/local/tomcat
Environment=JRE_HOME=/usr/lib/jvm/jre
Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_HOME=/usr/local/tomcat
Environment=CATALINE_BASE=/usr/local/tomcat
ExecStart=/usr/local/tomcat/bin/catalina.sh run
ExecStop=/usr/local/tomcat/bin/shutdown.sh
SyslogIdentifier=tomcat-%i
[Install]
WantedBy=multi-user.target
Enabling the firewall and allowing port 8080 to access the tomcat
# systemctl start firewalld
# systemctl enable firewalld
# firewall-cmd --get-active-zones
# firewall-cmd --zone=public --add-port=8080/tcp --permanent
# firewall-cmd --reload
Update configuration
# cd vprofile-project
# vim src/main/resources/application.properties
# Update file with backend server details
Build code
Run below command inside the repository (vprofile-project)
# mvn install
Deploy artifact
# systemctl stop tomcat
# rm -rf /usr/local/tomcat/webapps/ROOT*
# cp target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT.war
# systemctl start tomcat
# chown tomcat.tomcat /usr/local/tomcat/webapps -R
# systemctl restart tomcat
5.NGINX SETUP
Login to the Nginx vm
$ vagrant ssh web01
$ sudo -i
Verify Hosts entry, if entries missing update the it with IP and hostnames
# cat /etc/hosts
Install nginx
# apt install nginx -y
Restart Nginx
# systemctl restart nginx