Skip to main content

Command Palette

Search for a command to run...

πŸ”§ Day 25 – Manual Stack Setup with Vagrant: Intro & Database Layer

Detailed Guide on Stack Setup and Its Components

Published
β€’2 min read
πŸ”§ Day 25 – Manual Stack Setup with Vagrant: Intro & Database Layer

Kicking off a new DevOps mini-series! Learn how to manually set up a full stack Java project using multi-stage Vagrant VMs. Today, we cover the Vagrant environment, plugin setup, and the full MySQL database configuration.

Welcome to Day 25 of my DevOps Journey in Public! πŸš€

This week, I’m starting a mini-series on how I manually set up a Java-based project stack using Vagrant multi-VMs β€” and then how I plan to automate it with provisioning.


🧱 Stack Overview

We’ll be building and connecting the following services across multiple Vagrant-managed virtual machines:

  • MySQL β†’ SQL database

  • Memcached β†’ Caching service

  • RabbitMQ β†’ Broker/Queue

  • Tomcat β†’ Application server

  • Nginx β†’ Web server


πŸ› οΈ Prerequisites for This Setup

Before getting started, I made sure to install:

  • Oracle VirtualBox

  • Vagrant

  • Git Bash or a Linux terminal

  • Vagrant plugins:

      vagrant plugin install vagrant-hostmanager
      vagrant plugin install vagrant-vbguest
    

πŸ—‚οΈ Project Structure

vprofile-project/
β”œβ”€β”€ vagrant/
β”‚   └── Manual_provisioning/
β”‚       β”œβ”€β”€ Vagrantfile

I cloned the repo and moved into the Manual_provisioning/ directory:

git clone -b main https://github.com/hkhcoder/vprofile-project.git
cd vprofile-project/vagrant/Manual_provisioning
vagrant up

If the VMs failed halfway, I just re-ran vagrant up again.


🐬 Step 1: MySQL (MariaDB) Setup

πŸ” SSH into the DB VM

vagrant ssh db01
sudo -i

🧾 Install MariaDB

yum install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb

πŸ”’ Secure Installation

mysql_secure_installation
# Root password: admin123

πŸ—„οΈ Create DB and User

mysql -u root -padmin123
> CREATE DATABASE accounts;
> GRANT ALL PRIVILEGES ON accounts.* TO 'admin'@'%' IDENTIFIED BY 'admin123';
> FLUSH PRIVILEGES;
> exit

πŸ“¦ Import DB Dump

git clone -b main https://github.com/hkhcoder/vprofile-project.git
cd vprofile-project
mysql -u root -padmin123 accounts < src/main/resources/db_backup.sql

πŸ”₯ Firewall Configuration

systemctl start firewalld
systemctl enable firewalld
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

πŸ“Œ Wrapping Up Day 25

βœ… We’ve:

  • Set up the project environment

  • Installed required plugins

  • Brought up our VMs

  • Installed and configured MariaDB with a test DB and user

Next up? Memcached and RabbitMQ setup in Day 26. See you there! πŸ‘‹

➑️ Follow along the series and give feedback! #LearnInPublic #DevOps #Vagrant

DevOps overview as a beginner

Part 25 of 50

Sharing my journey of learning DevOps as a beginner β€” covering essential tools, cloud setup, CI/CD, Docker, monitoring, and more, step by step with practical examples.

Up next

Day 26: Configuring Memcached & RabbitMQ

Setting Up Memcached and RabbitMQ in a Multi-VM Vagrant Setup