0% found this document useful (0 votes)
45 views9 pages

Manual Paramount

This document provides instructions for configuring a web service with Docker on a CentOS 7 VM to retrieve data from a URL on a server. It involves: 1. Creating a CentOS 7 VM in Hyper-V and installing Docker. 2. Configuring the VM networking and IP address. 3. Creating a MySQL user to connect to Docker. 4. Setting up a cron job to run a script that retrieves data from the URL and exports it to a CSV file daily.

Uploaded by

ahmad husein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views9 pages

Manual Paramount

This document provides instructions for configuring a web service with Docker on a CentOS 7 VM to retrieve data from a URL on a server. It involves: 1. Creating a CentOS 7 VM in Hyper-V and installing Docker. 2. Configuring the VM networking and IP address. 3. Creating a MySQL user to connect to Docker. 4. Setting up a cron job to run a script that retrieves data from the URL and exports it to a CSV file daily.

Uploaded by

ahmad husein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Manual configurasi web service dengan docker untuk ambil data dari url server paramount

Spek PC server

1. Windows 10 Pro 64-bit Version 21H2, OS build 19044,1288


2. Processor Inter Core I3-10100 CPU @ 3.60GHz 3.60GHz

1. Create VM di Hyper-V Manager bawaan windows


a. Aktifkan [Hyper-V] dan [Virtual Machine Platform] di [Windows Feature]
b. Open [Hyper-V Manager], ketik di search windows [Hyper]

c. Install VM centos 7 di Hyper-V Manager


i. Di sebelah kiri menu di bawah [Hyper-V Manager] Klik [Desktop windows]
ii. Di menu sebelah kanan Hyper-V, menu [Actions] – klik [New] – [Virtual
Machine]
iii. Pada input [Name] masukan nama VM
iv. Klik Next, Pilih option menu [Generation 1]

v. Klik Next, Pada [Startup memory] masukan [1024]


vi. Klik next, pilih Connection [Nama connection yang dibuat] untuk konek ke host

vii. Klik Next, klik option [Create a virtual hard disk], Name [Biarkan default],
Location [Biarkan default] size ketik [50]
viii. Klik Next, Klik option [Install an operating system from a bootable CD/DV-ROM,
pilih option [Image file (.iso)] klik browser arahkan dimana file .iso installer
centos 7

ix. Klik Finish.


x. Klik kanan mouse, pilih [Connect] untuk melakukan instalasi VM centos 7

xi. Lakukan installasi centos 7 seperti biasa, install centos 7 [Base Environment]
[Minimal Install]
d. Bikin [Virtual Swtich] untuk menghubungkan VM centos ke host
i. Di menu sebelah kanan Hyper-V, menu [Actions] – klik [Virtual Swtich Manager]
ii. Select [New virtual network switch]
iii. Select [External], klik tombol [Create Virtual Switch]

iv. Pada [Name] masukan nama virtual switch, pada option pilih [External
network], select Network yang akan kita pakai, centang [Allow management
operating system to share this network adapter]
e. Setting ip address vm centos 7
i. Masuk ke terminal ketik [cd /etc/sysconfig/network-scripts] enter
ii. Backup file asli configrurasi dengan mengetik di terminal [cp ifcfg-eth0 <spasi>
ifcfg-eth0-bak] enter
iii. Edit file config [ifcfg-eth0] dengan mengetik [vi <spasi> ifcfg-eth0] enter

BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.253
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8

iv. Restart network dengan mengetikan di terminal [systemctl restart network]

f. Install docker di VM centos 7


i. Masuk ke terminal ketik [yum –y update] enter
ii. Setelah selesai proses di atas next ketik [yum install -y yum-utils device-
mapper-persistent-data lvm2] enter
iii. Setelah selesai proses di atas next ketik [yum-config-manager -y --add-repo
https://download.docker.com/linux/centos/docker-ce.repo] enter
iv. Setelah selesai proses di atas next ketik [yum install docker-ce] enter
v. Setelah selesai proses di atas next ketik [systemctl start docker] enter
vi. Setelah selesai proses di atas next ketik [docker version] untuk memastikan
docker sudah aktif

g. Create user mysql agar bisa terkoneksi ke docker


i. Masuk ke mysql di host jalankan script berikut di query

CREATE USER 'hakim'@'%%' IDENTIFIED BY 'sap123';


GRANT ALL PRIVILEGES ON *.* to 'hakim'@'%%' WITH GRANT OPTION;
flush privileges;
h. Create store procedure di mysql ketikan script berikut di query mysql

DELIMITER //
CREATE PROCEDURE spToCsv()
BEGIN
SET @TS = DATE_FORMAT(NOW(),'_%Y_%m_%d_%H_%i_%s');

SET @FOLDER = 'D:/hakim/Paramount/bak/';


SET @PREFIX = 'penghuni';
SET @EXT = '.csv';

SET @CMD = CONCAT("SELECT * FROM update_data INTO OUTFILE


'",@FOLDER,@PREFIX,@TS,@EXT, "' FIELDS ENCLOSED BY '\' TERMINATED BY ','
ESCAPED BY '\"'", " LINES TERMINATED BY '\r\n';");

PREPARE statement FROM @CMD;

EXECUTE statement;
END //

DELIMITER ;

i. Bikin folder “D:/hakim/Paramount/bak/” untuk menyimpan data backup


j. Install cron job centos 7
i. Ketik [yum install cronie] enter
ii. Setelah proses di atas selsesai create crontab, dengan mengetikan [crontab –e]
enter
iii. Tekan tombol [i] pada keyboar
iv. Ketik script berikut [0 3 * * * curl
"http://192.168.0.42:8005/cronDataPenghuni.php]

k. Jalankan docker di VM centos 7


i. Ketik di terminal untuk cek images[docker images]
ii. Ketik di terminal untuk cek container yang run [docker ps]
iii. Ketik di terminal untuk melihat list semua container yang ada baik yang running
atau belum [docker ps –a]
iv. Ketik di terminal [docker start <nama container>] untuk mengaktifkan container
v.

You might also like