From 1b4bbe712e19654c00b41bc65244cbd07054ee4b Mon Sep 17 00:00:00 2001 From: Keanu Taufan Date: Thu, 24 Oct 2024 16:41:16 +0700 Subject: [PATCH] task 1-17 excluding 8 and 10 --- ChoChang/13.sh | 3 +++ ChoChang/14.sh | 55 ++++++++++++++++++++++++++++++++++++++ ChoChang/setup.sh | 17 ++++++++++++ DracoMalfoy/07.sh | 4 +++ DracoMalfoy/setup.sh | 7 +++++ Dumbledore/02.sh | 13 +++++++++ Dumbledore/setup.sh | 6 +++++ FiliusFlitwick/13.sh | 3 +++ FiliusFlitwick/14.sh | 54 +++++++++++++++++++++++++++++++++++++ FiliusFlitwick/setup.sh | 15 +++++++++++ Hagrid/13.sh | 38 +++++++++++++++++++++++++++ Hagrid/setup.sh | 5 ++++ HarryPotter/06.sh | 35 ++++++++++++++++++++++++ HarryPotter/setup.sh | 5 ++++ HermioneGranger/06.sh | 37 ++++++++++++++++++++++++++ HermioneGranger/setup.sh | 7 +++++ LunaLovegood/13.sh | 3 +++ LunaLovegood/14.sh | 54 +++++++++++++++++++++++++++++++++++++ LunaLovegood/setup.sh | 15 +++++++++++ McGonagall/01.sh | 44 +++++++++++++++++++++++++++++++ McGonagall/setup.sh | 5 ++++ RonWeasley/06.sh | 35 ++++++++++++++++++++++++ RonWeasley/setup.sh | 5 ++++ SeverusSnape/02.sh | 31 ++++++++++++++++++++++ SeverusSnape/03.sh | 46 ++++++++++++++++++++++++++++++++ SeverusSnape/04.sh | 47 +++++++++++++++++++++++++++++++++ SeverusSnape/05.sh | 57 ++++++++++++++++++++++++++++++++++++++++ SeverusSnape/setup.sh | 7 +++++ SusanBones/15.sh | 5 ++++ SusanBones/16.sh | 5 ++++ SusanBones/17.sh | 7 +++++ SusanBones/setup.sh | 7 +++++ Voldemort/07.sh | 30 +++++++++++++++++++++ Voldemort/09.sh | 33 +++++++++++++++++++++++ Voldemort/11.sh | 45 +++++++++++++++++++++++++++++++ Voldemort/12.sh | 51 +++++++++++++++++++++++++++++++++++ Voldemort/setup.sh | 5 ++++ 37 files changed, 841 insertions(+) create mode 100644 ChoChang/13.sh create mode 100644 ChoChang/14.sh create mode 100644 ChoChang/setup.sh create mode 100644 DracoMalfoy/07.sh create mode 100644 DracoMalfoy/setup.sh create mode 100644 Dumbledore/02.sh create mode 100644 Dumbledore/setup.sh create mode 100644 FiliusFlitwick/13.sh create mode 100644 FiliusFlitwick/14.sh create mode 100644 FiliusFlitwick/setup.sh create mode 100644 Hagrid/13.sh create mode 100644 Hagrid/setup.sh create mode 100644 HarryPotter/06.sh create mode 100644 HarryPotter/setup.sh create mode 100644 HermioneGranger/06.sh create mode 100644 HermioneGranger/setup.sh create mode 100644 LunaLovegood/13.sh create mode 100644 LunaLovegood/14.sh create mode 100644 LunaLovegood/setup.sh create mode 100644 McGonagall/01.sh create mode 100644 McGonagall/setup.sh create mode 100644 RonWeasley/06.sh create mode 100644 RonWeasley/setup.sh create mode 100644 SeverusSnape/02.sh create mode 100644 SeverusSnape/03.sh create mode 100644 SeverusSnape/04.sh create mode 100644 SeverusSnape/05.sh create mode 100644 SeverusSnape/setup.sh create mode 100644 SusanBones/15.sh create mode 100644 SusanBones/16.sh create mode 100644 SusanBones/17.sh create mode 100644 SusanBones/setup.sh create mode 100644 Voldemort/07.sh create mode 100644 Voldemort/09.sh create mode 100644 Voldemort/11.sh create mode 100644 Voldemort/12.sh create mode 100644 Voldemort/setup.sh diff --git a/ChoChang/13.sh b/ChoChang/13.sh new file mode 100644 index 0000000..ac851ce --- /dev/null +++ b/ChoChang/13.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +mysql --host=10.67.4.2 --user=kelompokf01 --password=passwordf01 \ No newline at end of file diff --git a/ChoChang/14.sh b/ChoChang/14.sh new file mode 100644 index 0000000..7e25387 --- /dev/null +++ b/ChoChang/14.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +git clone https://github.com/lodaogos/laravel-jarkom-modul-3.git +mv laravel-jarkom-modul-3 /var/www +cp /var/www/laravel-jarkom-modul-3/.env.example /var/www/laravel-jarkom-modul-3/.env +chown -R www-data.www-data /var/www/laravel-jarkom-modul-3/storage + +sed -i 's/DB_HOST=127.0.0.1/DB_HOST=10.67.4.2/g' /var/www/laravel-jarkom-modul-3/.env +sed -i 's/DB_DATABASE=laravel/DB_DATABASE=dbkelompokf01/g' /var/www/laravel-jarkom-modul-3/.env +sed -i 's/DB_USERNAME=root/DB_USERNAME=kelompokf01/g' /var/www/laravel-jarkom-modul-3/.env +sed -i 's/DB_PASSWORD=/DB_PASSWORD=passwordf01/g' /var/www/laravel-jarkom-modul-3/.env + +service nginx start +service php8.0-fpm start + +cd /var/www/laravel-jarkom-modul-3 && \ + composer update && \ + composer install && \ + php artisan migrate:fresh && \ + php artisan db:seed --class=MusicsTableSeeder && \ + php artisan key:generate && \ + php artisan jwt:secret + + +cat > /etc/nginx/sites-available/default < /etc/resolv.conf + +apt-get update +apt-get install software-properties-common mariadb-client -y +add-apt-repository ppa:ondrej/php + +apt-get update +apt-get install php8.0-mbstring php8.0-xml php8.0-cli php8.0-common php8.0-intl php8.0-opcache php8.0-readline php8.0-mysql php8.0-fpm php8.0-curl unzip wget -y +apt-get install nginx git -y + +wget https://getcomposer.org/download/2.0.13/composer.phar +chmod +x composer.phar +mv composer.phar /usr/bin/composer + +echo "nameserver 10.67.3.3" > /etc/resolv.conf \ No newline at end of file diff --git a/DracoMalfoy/07.sh b/DracoMalfoy/07.sh new file mode 100644 index 0000000..ee41707 --- /dev/null +++ b/DracoMalfoy/07.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Run 3 times +ab -n 1000 -c 100 http://gryffindor.hogwarts.f01.com/ \ No newline at end of file diff --git a/DracoMalfoy/setup.sh b/DracoMalfoy/setup.sh new file mode 100644 index 0000000..7964d9f --- /dev/null +++ b/DracoMalfoy/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "nameserver 192.168.122.1" > /etc/resolv.conf +apt-get update +apt-get install apache2-utils -y + +echo "nameserver 10.67.3.3" > /etc/resolv.conf \ No newline at end of file diff --git a/Dumbledore/02.sh b/Dumbledore/02.sh new file mode 100644 index 0000000..b312727 --- /dev/null +++ b/Dumbledore/02.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cat > /etc/default/isc-dhcp-relay < /etc/sysctl.conf < /etc/nginx/sites-available/default < /etc/resolv.conf + +apt-get update +apt-get install software-properties-common mariadb-client -y +add-apt-repository ppa:ondrej/php + +apt-get update +apt-get install php8.0-mbstring php8.0-xml php8.0-cli php8.0-common php8.0-intl php8.0-opcache php8.0-readline php8.0-mysql php8.0-fpm php8.0-curl unzip wget -y +apt-get install nginx git -y + +wget https://getcomposer.org/download/2.0.13/composer.phar +chmod +x composer.phar +mv composer.phar /usr/bin/composer \ No newline at end of file diff --git a/Hagrid/13.sh b/Hagrid/13.sh new file mode 100644 index 0000000..990874f --- /dev/null +++ b/Hagrid/13.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +service mysql start + +if [ $(echo "SELECT COUNT(*) FROM mysql.user WHERE user = 'kelompokf01';" | mysql | tail -n1) -eq 0 ] +then +cat > inituser.sql < inituser.sql < /etc/mysql/my.cnf < /etc/resolv.conf +apt-get update +apt-get install mariadb-server -y \ No newline at end of file diff --git a/HarryPotter/06.sh b/HarryPotter/06.sh new file mode 100644 index 0000000..a245f60 --- /dev/null +++ b/HarryPotter/06.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +curl -o web.zip https://fs.taufan.dev/public/jarkom/web-modul-3.zip +unzip -d worker web.zip +mv worker /var/www + +service nginx start +service php7.4-fpm start + +cat > /etc/nginx/sites-enabled/default < /etc/resolv.conf +apt-get update +apt-get install unzip php7.4-fpm nginx -y \ No newline at end of file diff --git a/HermioneGranger/06.sh b/HermioneGranger/06.sh new file mode 100644 index 0000000..30c6956 --- /dev/null +++ b/HermioneGranger/06.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +echo "nameserver 192.168.122.1" > /etc/resolv.conf +curl -o web.zip https://fs.taufan.dev/public/jarkom/web-modul-3.zip +unzip -d worker web.zip +mv worker /var/www +echo "nameserver 10.67.3.3" > /etc/resolv.conf + +service nginx start +service php7.4-fpm start + +cat > /etc/nginx/sites-enabled/default < /etc/resolv.conf +apt-get update +apt-get install unzip php7.4-fpm nginx -y + +echo "nameserver 10.67.3.3" > /etc/resolv.conf \ No newline at end of file diff --git a/LunaLovegood/13.sh b/LunaLovegood/13.sh new file mode 100644 index 0000000..ac851ce --- /dev/null +++ b/LunaLovegood/13.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +mysql --host=10.67.4.2 --user=kelompokf01 --password=passwordf01 \ No newline at end of file diff --git a/LunaLovegood/14.sh b/LunaLovegood/14.sh new file mode 100644 index 0000000..ee79a75 --- /dev/null +++ b/LunaLovegood/14.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +git clone https://github.com/lodaogos/laravel-jarkom-modul-3.git +mv laravel-jarkom-modul-3 /var/www +cp /var/www/laravel-jarkom-modul-3/.env.example /var/www/laravel-jarkom-modul-3/.env + +sed -i 's/DB_HOST=127.0.0.1/DB_HOST=10.67.4.2/g' /var/www/laravel-jarkom-modul-3/.env +sed -i 's/DB_DATABASE=laravel/DB_DATABASE=dbkelompokf01/g' /var/www/laravel-jarkom-modul-3/.env +sed -i 's/DB_USERNAME=root/DB_USERNAME=kelompokf01/g' /var/www/laravel-jarkom-modul-3/.env +sed -i 's/DB_PASSWORD=/DB_PASSWORD=passwordf01/g' /var/www/laravel-jarkom-modul-3/.env + +service nginx start +service php8.0-fpm start + +cd /var/www/laravel-jarkom-modul-3 && \ + composer update && \ + composer install && \ + php artisan migrate:fresh && \ + php artisan db:seed --class=MusicsTableSeeder && \ + php artisan key:generate && \ + php artisan jwt:secret + + +cat > /etc/nginx/sites-available/default < /etc/resolv.conf + +apt-get update +apt-get install software-properties-common mariadb-client -y +add-apt-repository ppa:ondrej/php + +apt-get update +apt-get install php8.0-mbstring php8.0-xml php8.0-cli php8.0-common php8.0-intl php8.0-opcache php8.0-readline php8.0-mysql php8.0-fpm php8.0-curl unzip wget -y +apt-get install nginx git -y + +wget https://getcomposer.org/download/2.0.13/composer.phar +chmod +x composer.phar +mv composer.phar /usr/bin/composer \ No newline at end of file diff --git a/McGonagall/01.sh b/McGonagall/01.sh new file mode 100644 index 0000000..c707222 --- /dev/null +++ b/McGonagall/01.sh @@ -0,0 +1,44 @@ +#/bin/bash + +cat > /etc/bind/named.conf.options < /etc/bind/named.conf.local < /etc/bind/hogwarts/hogwarts.f01.com < /etc/resolv.conf +apt-get update +apt-get install bind9 -y \ No newline at end of file diff --git a/RonWeasley/06.sh b/RonWeasley/06.sh new file mode 100644 index 0000000..a245f60 --- /dev/null +++ b/RonWeasley/06.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +curl -o web.zip https://fs.taufan.dev/public/jarkom/web-modul-3.zip +unzip -d worker web.zip +mv worker /var/www + +service nginx start +service php7.4-fpm start + +cat > /etc/nginx/sites-enabled/default < /etc/resolv.conf +apt-get update +apt-get install unzip php7.4-fpm nginx -y \ No newline at end of file diff --git a/SeverusSnape/02.sh b/SeverusSnape/02.sh new file mode 100644 index 0000000..4b08370 --- /dev/null +++ b/SeverusSnape/02.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +cat > /etc/default/isc-dhcp-server < /etc/dhcp/dhcpd.conf < /etc/dhcp/dhcpd.conf < /etc/dhcp/dhcpd.conf < /etc/dhcp/dhcpd.conf < /etc/resolv.conf +apt-get update +apt-get install isc-dhcp-server -y + +echo "nameserver 10.67.3.3" > /etc/resolv.conf \ No newline at end of file diff --git a/SusanBones/15.sh b/SusanBones/15.sh new file mode 100644 index 0000000..c436453 --- /dev/null +++ b/SusanBones/15.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo '{"username":"f01","password":"f01f01"}' > temp.json +ab -n 100 -c 10 -T application/json -p temp.json http://10.67.6.4/api/auth/register +rm temp.json \ No newline at end of file diff --git a/SusanBones/16.sh b/SusanBones/16.sh new file mode 100644 index 0000000..4b9538e --- /dev/null +++ b/SusanBones/16.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo '{"username":"f01","password":"f01f01"}' > temp.json +ab -n 100 -c 10 -T application/json -p temp.json -v 4 http://10.67.6.4/api/auth/login +rm temp.json \ No newline at end of file diff --git a/SusanBones/17.sh b/SusanBones/17.sh new file mode 100644 index 0000000..b97b5e9 --- /dev/null +++ b/SusanBones/17.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [ "$1" ]; then + ab -n 100 -c 10 -T application/json -H "Authorization: Bearer $1" -v 4 http://10.67.6.4/api/me +else + echo "Please provide authorization token as the argument" +fi diff --git a/SusanBones/setup.sh b/SusanBones/setup.sh new file mode 100644 index 0000000..7964d9f --- /dev/null +++ b/SusanBones/setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "nameserver 192.168.122.1" > /etc/resolv.conf +apt-get update +apt-get install apache2-utils -y + +echo "nameserver 10.67.3.3" > /etc/resolv.conf \ No newline at end of file diff --git a/Voldemort/07.sh b/Voldemort/07.sh new file mode 100644 index 0000000..39fcfdc --- /dev/null +++ b/Voldemort/07.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +service nginx start + +cat > /etc/nginx/sites-enabled/default < /etc/nginx/sites-enabled/default < /etc/nginx/sites-enabled/default < /etc/nginx/sites-enabled/default < /etc/resolv.conf +apt-get update +apt-get install nginx apache2-utils -y \ No newline at end of file