Skip to content
Snippets Groups Projects
Commit e77c4163 authored by Adrian Cheng's avatar Adrian Cheng
Browse files
parents 6e6b2328 fce848e0
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,7 @@ Vagrant.configure("2") do |config|
end
back.vm.network "private_network", ip: env['BACKEND_IP']
back.vm.network "forwarded_port", guest: 3306, host: 33061
back.vm.provision "ScriptRunAsVagrantUser", privileged: false, type:"shell", path: "#{env['PROVISION_PATH']}/prov_netcap_back.sh"
end
......
CREATE DATABASE network_latency;
USE network_latency;
CREATE TABLE ping_pong (
id INT AUTO_INCREMENT PRIMARY KEY,
source_ip VARCHAR(20) NOT NULL,
ping_time TIMESTAMP NOT NULL,
pong_time TIMESTAMP NOT NULL,
latency FLOAT NOT NULL
);
\ No newline at end of file
......@@ -9,3 +9,40 @@ echo "Node 16 install successful"
echo "Installing dependencies"
npm i -g @nestjs/cli yarn
# Install MySQL
echo "Installing Oracle MySQL package repo"
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
echo "Installing MySQL 8 Community Server"
sudo yum -y install mysql-community-server
echo "Enabling and starting mysql server"
sudo systemctl start mysqld.service
sudo systemctl enable mysqld.service
echo "Cleaning up security and setting root password to vagrant"
export MYSQLPASS=`sudo grep 'A temporary password' /var/log/mysqld.log |tail -1 | awk '{print $NF}'`
mysql --connect-expired-password --user=root -p$MYSQLPASS <<_EOF_
set password = 'Vagrant123$';
SET GLOBAL validate_password.policy=LOW;
FLUSH PRIVILEGES;
_EOF_
mysql --connect-expired-password --user=root -pVagrant123\$ <<_EOF_
SET GLOBAL validate_password.policy=LOW;
SET GLOBAL validate_password.length=7;
set password = 'vagrant';
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
_EOF_
echo "Creating database schema"
mysql -u root -pvagrant < /vagrant/create_schema.sql
echo "Finished configuring MySQL"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment