Category Archives

128 Articles
Konfigurasi CAS 5.1.2
Arsitektur SSO dasar.

Konfigurasi CAS 5.1.2

Apereo CAS (sebelumnya Jasig CAS) banyak dipakai untuk SSO. Cara pemasangannya agak ribet dan sulit. Kebetulan, versi CAS 5.1.2 sekarang sudah menggunakan Spring Boot sebagai dasarnya.

Keuntungan penggunaan Spring Boot adalah Jasig CAS menggunakan banyak keunggulan framework Spring. Misalnya, teknologi Spring Cloud untuk teknologi devops, Spring Web Flow untuk arsitektur layanan mikro (micro service), service discovery, dan konfigurasi melalui YAML. Sehingga, kita bisa memasang infrastruktur SSO melalui CAS tanpa harus mengoding seperti dahulu. Atau, kita bisa mengembangkan layanan yang terpisah dari SSO ala layanan mikro.

Sebelum infrastruktur bertambah rumit, saya ingin memberikan jembatan keledai. Sebab, saya pikir SSO ini agak sulit pada awalnya kalau tidak tahu caranya. Saya harap ketika selesai membaca artikel ini, pembaca ada gambaran bagaimana SSO bisa dikembangkan.

Arsitektur yang dipilih

Arsitektur SSO

Arsitektur SSO dasar.

Ada banyak pilihan, tetapi saya memilih kapabilitas komponen yang bisa diskalakan secara horizontal dan modern. Misalnya, ada banyak pilihan untuk ruang penyimpan tiket (Ticket Storage), tetapi saya memilih Redis karena dia implementasi modern yang banyak dipakai untuk teknologi dewasa ini.

Setiap komponen yang saya pilih ini dapat dikluster. Saya memilih untuk mengembangkan satu layanan per mesin. Nanti kalau sudah mengerti teknologi perawanan, [uhuk colek Utian Ayuba] Anda bisa mengubah setiap ini menjadi konfigurasi devops macam Ansible, Puppet, Chef, Vagrant,  atau apa pun agama Anda.

CAS IdP

CAS IdP adalah mesin utama yang menyediakan profil, otentikasi, dan otorisasi. Semua klien terhubung ke sana.

Cara buat:

CAS IdP Server

CAS Ticket Storage

Secara baku CAS IdP menyimpan tiket sesi pada memori. Namun, untuk arsitektur kluster dan skalabilitas, lebih baik menggunakan Redis. Mengapa Redis? Karena Redis utamanya menggunakan memori.

Untuk peladen Redis tidak perlu dikluster. Lebih baik satu instans Redis yang memakan memori 24 GB dari pada membuat kluster.

Cara buat:

Redis Ticket Storage

CAS Service Storage

Satu situs/sistem/aplikasi yang menggunakan CAS untuk SSO disebut satu layanan (service). Setiap layanan dapat didefinisikan logo, URL, ACL pengguna, dan sebagainya secara granular. Itu semua secara baku disimpan oleh CAS IdP di berkas JSON.

Untuk pengelolaan yang lebih baik, saya memilih PostgreSQL sebagai ruang penyimpan. Pengalaman saya membandingkan PostgreSQL dengan MySQL mengatakan bahwa PostgreSQL rajanya basisdata untuk basisdata perangkat lunak bebas terbuka. Waktu itu saya membandingkan layanan Roundcube Webmail dengan MySQL dan PostgreSQL. Anda sebagai pengguna Webmail UI pasti merasakan bagaimana Webmail UI itu seperti mengakses sistem HTML statik.

Saya, sih, tidak apa kalau ada yang mau menggunakan MongoDB atau yang lainnya. Tetapi saya memilih karena daftar layanan ini tidak perlu kecepatan khusus. Selain itu, daftar layanan butuh untuk tahan banting, saya lebih memilih PostgreSQL. Tentu saja, saya takkan memilih Redis.

Cara buat:

CAS Service Registry

CAS Authentication Provider

Normalnya CAS menggunakan Spring Security dengan login casuser dan sandi Mellon. Tentunya, ini buat yang main-main. Untuk yang lebih serius, gunakan LDAP, basis data, atau bahkan layanan REST.

Penyedia otentikasi CAS dapat lebih dari satu (komposit). Tetapi, untuk kali ini, gunakan saja LDAP.

Cara buat:

CAS Auth LDAP

CAS Service Management Webapp

Aduh, lupa menulis dokumentasi. Silakan simpan URL ini, nanti saya coba tulis. Untuk sementara, langsung saja buat di basisdata. He… he… he….

Studi Kasus: WordPress

Penasaran dengan hasilnya? Langsung saja, buat aplikasi WordPress. Mengapa WordPress? Karena gampang memasangnya. Tinggal pakai plugin WP Cassify, daftarkan URL WP sebagai satu layanan, dan beres!

Cara buat:

WordPress Cassify

TODO:

  • Personalisasi halaman login.
  • Membuat CAS IdP terkluster (lebih dari satu instans)
  • Entahlah….
Aktivasi Windows 10 Edu untuk Universitas Indonesia
Aktivasi Windows

Aktivasi Windows 10 Edu untuk Universitas Indonesia

Terkadang di dunia ini kita tidak dapat memilih apa yang harus kita kerjakan. — anon IT yang dipaksa mengoprek Windoze.

Ketika pemasangan Windows, seharusnya Windows yang sudah dipasang dengan lisensi volum Universitas Indonesia menggunakan DNS mengarah ke ms.ui.ac.id. Namun, ada kalanya DNS tersebut tidak dapat diakses. Misalnya, karena Windows tersebut berjalan sebagai sistem operasi tamu, berada di luar jaringan UI atau dalam NAT, dan lain sebagainya.

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Saya sendiri sudah frustrasi mencari cara mengonfigurasi DNS di Windows. Maklum, terakhir saya pengguna Windows XP. Itu sebabnya, dapat digunakan cara kedua yang lebih familiar.

Jalankan Powershell sebagai administrator

 → ketik “powershell”  klik kanan pada Windows Powershell  Run as administrator

Run Windows Powershell as administrator

Run Windows Powershell as administrator

Operasi selanjutnya dijalankan di dalam Windows Powershell.

Aktivasi Windows

cd \Windows\system32
cscript slmgr.vbs /skms km-01.ms.ui.ac.id
cscript slmgr.vbs /ato

Penjalanan skrip yang pertama adalah mengonfigurasi secara manual KMS UI. Yang kedua adalah menjalankan aktivasi Windows.

Windows Activation on Universitas Indonesia volume license

Windows Activation on Universitas Indonesia volume license

Kalau lisensi Anda belum lisensi Universitas Indonesia, silakan hubungi staf TIK fakultas terdekat. Atau, hubungi Helpdesk DSTI untuk pemanduan pemasangan lisensi. Setahu saya, semua sivitas akademika UI berhak memiliki lisensi Windows asli dan layanan Office 365 dari Universitas Indonesia.

 

Bacaan Lebih Lanjut

Akses Dolphin (Manajer Berkas KDE) ke SMBv2 atau SMBv3
About KDE

Akses Dolphin (Manajer Berkas KDE) ke SMBv2 atau SMBv3

Karena WCry 2.0, protokol SMBv1 sudah tidak berlaku lagi. Kebanyakan peladen berkas sudah berjalan di versi 2 ke atas. Masalahnya, banyak penjelajah berkas masih menggunakan SMBv1 secara baku. Untuk itu, perlu diaktifkan klien versi 2 ke atas.

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Saya pernah membuat sebuah retasan dengan memasang berkas tersebut menggunakan CIFS. Ternyata ada cara yang lebih baik, yakni dengan mengonfigurasi pustaka klien SMB untuk mengaktifkan sampai versi 3.

Caranya:

$ mkdir ~/.smb
$ cat > ~/.smb/smb.conf  << EOF
[global]
    client max protocol = SMB3
EOF

Selesai.

Bacaan Lebih Lanjut

Tutorial Lengkap Patroni PostgreSQL
PostgreSQL database

Tutorial Lengkap Patroni PostgreSQL

Masih ingat tutorial saya tentang Patroni dahulu? Saya akan membuat tulisan lengkap dari nol sampai berjalan. Di akhir tutorial ini Anda bisa membuat kluster Patroni secara manual. Kalau Anda devops dan tertarik menulis resep untuk Ansible, Puppet, dan sejenisnya, saya harap artikel ini bisa menjadi acuan untuk mengerti Patroni.

Mesin-mesin yang Ada

Saya membagi setiap mesin yang digunakan dengan dua IP. Satu subnet IP internal yang digunakan untuk setiap mesin dalam kluster berkomunikasi dan satu subnet IP yang digunakan untuk akses luar. Implementasi fisik dengan menggunakan dua kartu jaringan (atau dua bonding fisik)  yang berbeda. Perbedaan jaringan untuk komunikasi internal dan komunikasi dengan klien ini selain menyediakan keamanan dalam isolasi, juga membuat koneksi internal atau pun eksternal tidak saling mengganggu.

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Untuk mengurangi kompleksitas tutorial ini, saya hanya menyediakan satu mesin HAProxy dan satu mesin etcd. Fokus tulisan ini adalah untuk ketersediaan PostgreSQL. Untuk membuat ketersediaan HAProxy dan etcd akan dibahas lain kali bila ada waktu [baca: kalau tidak malas].

Agar tidak membingungkan, saya selalu mempraktikkan penamaan kluster ditambah dengan prefiks nama aplikasi. Hal ini penting karena di perawanan yang sudah semakin terotomatisasi, kadang kita suka bingung kalau konfigurasi sudah tidak ada lagi.

konfigurasi

Konfigurasi server yang dipakai

Yak, intinya ada 5 mesin untuk tutorial kali ini. Saya menggunakan GNU/Linux Debian 9 karena itu standar sistem operasi UI. Untuk sistem operasi lain saya rasa tidak ada yang berbeda karena kali ini saya tidak menggunakan paket repositori.

Untuk memudahkan, pastikan kelima mesin ini memiliki berkas /etc/hosts yang berisi kelima host.

$ sudo tee -a  /etc/hosts << EOF
192.168.100.1   haproxy0-nyata
192.168.100.2   etcd0-nyata
192.168.100.3   pg1-nyata
192.168.100.4   pg2-nyata
192.168.100.5   pg3-nyata
EOF

Selanjutnya, akan dibuatkan etcd terlebih dahulu sebagai inti yang mengatur kluster.

ETCD

Aplikasi etcd adalah sebuah basisdata konfigurasi yang digunakan status. Aplikasi etcd tidak ada di repositori Debian 9. Saya mengunduh versi terbaru dari CoreOS dan memasang manual.

wget https://github.com/coreos/etcd/releases/download/v3.3.1/etcd-v3.3.1-linux-amd64.tar.gz
tar xvfz etcd-v3.3.1-linux-amd64.tar.gz
sudo cp etcd-v3.3.1-linux-amd64/etcd /usr/local/bin

Konfigurasi

Aplikasi etcd berisi satu binari. Untuk konfigurasi, buat manual.

$ sudo /etc/etcd.conf.yml << EOF
# This is the configuration file for the etcd server.

# Human-readable name for this member.
name: 'etcd0-nyata'

# Path to the data directory.
data-dir: /var/lib/etcd/data

# Path to the dedicated wal directory.
wal-dir: /var/lib/etcd/wal

# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000

# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100

# Time (in milliseconds) for an election to timeout.
election-timeout: 1000

# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0

# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://192.168.100.2:2380

# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://localhost:2379,http://192.168.100.2:2379

# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5

# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5

# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors: 

# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://192.168.100.2:2380

# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://192.168.100.2:2379

# Discovery URL used to bootstrap the cluster.
discovery: 

# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'

# HTTP proxy to use for traffic to discovery service.
discovery-proxy: 

# DNS domain used to bootstrap initial cluster.
discovery-srv: 

# Initial cluster configuration for bootstrapping.
initial-cluster: etcd0-scele=http://192.168.100.2:2380,

# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-nyata-cluster'

# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'

# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false

# Valid values include 'on', 'readonly', 'off'
proxy: 'off'

# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000

# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000

# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000

# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000

# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0

# Enable debug-level logging for etcd.
debug: false

# Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG'.
log-package-levels: 

# Force to create a new one member cluster.
force-new-cluster: true
EOF

Layanan

Agar dapat dijalankan secara sistem, perlu dibuatkan layanan systemd secara manual.

$ sudo tee -a /etc/systemd/system/etcd.service << EOF
[Unit]
Description=etcd key-value store
Documentation=https://github.com/coreos/etcd
After=network.target

[Service]
User=etcd
Group=etcd
Type=notify
ExecStart=/bin/bash --login -c "/usr/local/bin/etcd --config-file /etc/etcd.conf.yml"
Restart=always
RestartSec=10s
LimitNOFILE=40000

[Install]
WantedBy=multi-user.target
EOF

Pengaktifan Layanan etcd

Perhatikan bahwa untuk contoh kali ini saya menggunakan akun etcd dan grup etcd. Praktik aman selalu jalankan layanan sebagai pengguna biasa, bukan root. Buat pengguna baru ini.

sudo adduser --system --home /var/lib/etcd --group etcd

Bagian terakhir dari etcd adalah mengaktifkan dan menjalankan layanan etcd.

sudo systemctl daemon-reload
sudo systemctl enable etcd
sudo systemctl start etcd

Baris daemon-reload adalah agar systemd membaca konfigurasi yang baru saja dibuat. Baris enable untuk mendaftarkan etcd sebagai layanan yang dijalankan otomatis saat mesin baru mulai. Baris terakhir untuk menjalankan layanan etcd.

PostgreSQL

Berbeda dengan tutorial yang lalu, saya akan membuat konfigurasi per mesin agar lebih menggambarkan apa yang terjadi. Sebelum memulai, saya asumsikan bahwa setiap mesin PostgreSQL pengguna root memiliki kunci SSH sehingga antar mesin bisa masuk tanpa kunci.

Cara paling gampang, di salah satu mesin buat kunci.

ssh-keygen -t ecdsa

Lalu, taruh kunci publik dan privat ke root. Saya asumsikan bahwa kita bekerja di mesin pg1-nyata.

# asumsi kerja di mesin pg1-nyata
sudo mkdir /root/.ssh/
sudo cp ~/.ssh/id_ecdsa /root/.ssh/
cat ~/.ssh/id_ecdsa.pub | sudo tee -a /root/.ssh/authorized_keys

# Transfer
scp ~/.ssh/id_ecdsa ~/.ssh/id_ecdsa.pub pg2-nyata:/tmp
scp ~/.ssh/id_ecdsa ~/.ssh/id_ecdsa.pub pg3-nyata:/tmp

# ke mesin pg2-nyata
ssh pg2-nyata
sudo mkdir /root/.ssh/
sudo cp ~/.ssh/id_ecdsa /root/.ssh/
cat ~/.ssh/id_ecdsa.pub | sudo tee -a /root/.ssh/authorized_keys
rm /tmp/id_ecdsa*
exit

# ke mesin pg3-nyata
ssh pg3-nyata
sudo mkdir /root/.ssh/
sudo cp ~/.ssh/id_ecdsa /root/.ssh/
cat ~/.ssh/id_ecdsa.pub | sudo tee -a /root/.ssh/authorized_keys
rm /tmp/id_ecdsa*
exit

Ini saya pasang secara manual. Biasanya untuk Vagrant, Proxmox, dan sejenisnya sudah menyediakan opsi pemasangan kunci SSH di konfigurasi/plugin mereka. Namun, untuk kelengkapan tutorial ini saya tuliskan saja manual. Saya sendiri sebenarnya hanya memasang satu mesin; memasang PostgreSQL; dan baru diklon menjadi dua mesin lainnya.

Pemasangan PostgreSQL

Saya kali ini menggunakan PostgreSQL yang saya kompilasi sendiri. Mengapa? Karena hasil kompilasi lebih irit dan saya mau ada variasi tulisan. Di blog saya ada kok cara-caranya untuk memasang versi repo.

Pemasangan PostgreSQL setiap mesin sama. Untuk memasang paket ketergantungan di setiap mesin jalankan:

sudo apt -y install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev pkg-config libsystemd-dev

Unduh PostgreSQL. Saya memakai versi stabil terbaru, 10.2. Kebetulan juga, saya ada peladen cermin di samping ruangan:

wget http://kambing.ui.ac.id/postgresql/source/v10.2/postgresql-10.2.tar.bz2
tar xvfj postgresql-10.2.tar.bz2
cd postgresql-10.2
sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h
./configure --prefix=/usr --with-icu --with-openssl --with-systemd --enable-thread-safety --docdir=/usr/share/doc/postgresql-10.2 CFLAGS="-O3 -march=native -mtune=native -pipe"
make -j$(nproc)
sudo make install

Saya melakukan optimasi CFLAGS untuk kompilasi. Hal ini karena saya tahu bahwa peladen di tempat saya itu homogen. Tapi, kalau misalnya Anda memasang di penyedia awan, sebaiknya  CFLAGS jangan disertakan.

Selanjutnya pemasangan Patroni.

Patroni

Patroni merupakan skrip Python. Untuk memasang Patroni, pastikan Python PIP dipasang. Saya memilih Python3. Namun, biasanya yang digunakan Python2. Saya memakai Python3 karena saya keren.

sudo apt install python3-pip
sudo pip3 install --upgrade setuptools

Pasang Patroni dan plugin etcd-nya.

sudo pip3 install psycopg2-binary
sudo -E pip3 install patroni[etcd]

Buat pengguna postgres

sudo adduser --system --home /var/lib/postgresql --group postgres

Buatkan layanan sistem.

$ sudo tee /etc/systemd/system/patroni.service << EOF
[Unit]
Description=Runners to orchestrate a high-availability PostgreSQL
After=syslog.target network.target
 
[Service]
Type=simple
 
User=postgres
Group=postgres
 
Environment="PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
ExecStart=/usr/local/bin/patroni /etc/patroni.yml
 
KillMode=process
 
TimeoutSec=30
 
Restart=no
 
[Install]
WantedBy=multi-user.target
EOF

Selanjutnya, buat konfigurasi per mesin.

Konfigurasi Per Mesin

Buat konfigurasi per mesin /etc/patroni.yml

scope: postgres
namespace: /pg-nyata/
name: pg1-nyata
 
restapi:
    listen: 192.168.100.3:8008
    connect_address: 192.168.100.3:8008
 
etcd:
    host: 192.168.100.2:2379
 
bootstrap:
    dcs:
        ttl: 30
        loop_wait: 10
        retry_timeout: 10
        maximum_lag_on_failover: 1048576
        postgresql:
            use_pg_rewind: true
 
    initdb:
    - encoding: UTF8
    - data-checksums
 
    pg_hba:
    - host replication replicator 127.0.0.1/32 md5
    - host replication replicator 192.168.100.3/0 md5
    - host replication replicator 192.168.100.4/0 md5
    - host replication replicator 192.168.100.5/0 md5
    - host all all 0.0.0.0/0 md5
 
    users:
        admin:
            password: aiwaQuaeHuojeuyai2fiemai6Reeneix
            options:
                - createrole
                - createdb
 
postgresql:
    listen: 192.168.100.3:5432
    connect_address: 192.168.100.3:5432
    data_dir: /var/lib/postgresql/10.2-patroni
    pgpass: /tmp/pgpass
    authentication:
        replication:
            username: replicator
            password: zee0ohjisai5ohCohsaegho5gaeN8Xei
        superuser:
            username: postgres
            password: saichae9Aich0xeen2Otethaduphiepo
    parameters:
        unix_socket_directories: '.'
 
tags:
    nofailover: false
    noloadbalance: false
    clonefrom: false
    nosync: false

Contoh konfigurasi yang tertulis untuk mesin pg1-nyata. Untuk pg2-nyata dan pg3-nyata ubah baris ke-3 name dengan nama mesin, dan setiap baris listen dan connect_address dengan IP per mesin.

Contoh perbedaan pg1-nyata dan pg2-nyata.

$ diff pg{1,2}-nyata/etc/patroni.yml -u
--- pg1-nyata/etc/patroni.yml   2018-03-08 10:03:26.502995392 +0700
+++ pg2-nyata/etc/patroni.yml   2018-03-08 10:08:35.869743378 +0700
@@ -1,14 +1,14 @@
 scope: postgres
 namespace: /pg-nyata/
-name: pg1-nyata
- 
+name: pg2-nyata
+
 restapi:
-    listen: 192.168.100.3:8008
-    connect_address: 192.168.100.3:8008
- 
+    listen: 192.168.100.4:8008
+    connect_address: 192.168.100.4:8008
+
 etcd:
     host: 192.168.100.2:2379
- 
+
 bootstrap:
     dcs:
         ttl: 30
@@ -17,28 +17,28 @@
         maximum_lag_on_failover: 1048576
         postgresql:
             use_pg_rewind: true
- 
+
     initdb:
     - encoding: UTF8
     - data-checksums
- 
+
     pg_hba:
     - host replication replicator 127.0.0.1/32 md5
     - host replication replicator 192.168.100.3/0 md5
     - host replication replicator 192.168.100.4/0 md5
     - host replication replicator 192.168.100.5/0 md5
     - host all all 0.0.0.0/0 md5
- 
+
     users:
         admin:
             password: aiwaQuaeHuojeuyai2fiemai6Reeneix
             options:
                 - createrole
                 - createdb
- 
+
 postgresql:
-    listen: 192.168.100.3:5432
-    connect_address: 192.168.100.3:5432
+    listen: 192.168.100.4:5432
+    connect_address: 192.168.100.4:5432
     data_dir: /var/lib/postgresql/10.2-patroni
     pgpass: /tmp/pgpass
     authentication:
@@ -50,7 +50,7 @@
             password: saichae9Aich0xeen2Otethaduphiepo
     parameters:
         unix_socket_directories: '.'
- 
+
 tags:
     nofailover: false
     noloadbalance: false

Semoga dengan ini tidak ada salah ganti atau terlewat.

Pengaktifan Layanan Patroni

Setelah konfigurasi dan unit layanan Patroni terpasang, layanan Patroni sudah bisa dijalankan. Untuk setiap mesin, jalankan:

sudo systemctl daemon-reload
sudo systemctl enable patroni
sudo systemctl start patroni

Satu langkah lagi.

HAProxy

Bagian yang paling mudah saya salin saja, ya, perintahnya.

sudo apt install haproxy

Konfigurasi:

$ sudo tee /etc/haproxy/haproxy.cfg << EOF
global
    maxconn 100
 
defaults
    log global
    mode tcp
    retries 2
    timeout client 30m
    timeout connect 4s
    timeout server 30m
    timeout check 5s
 
listen stats
    mode http
    bind *:7000
    stats enable
    stats uri /
 
listen postgres
    bind *:5000
    option httpchk
    http-check expect status 200
    default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
    server postgresql_192.168.100.3_5432 192.168.100.3:5432 maxconn 100 check port 8008
    server postgresql_192.168.100.4_5432 192.168.100.4:5432 maxconn 100 check port 8008
    server postgresql_192.168.100.5_5432 192.168.100.5:5432 maxconn 100 check port 8008
EOF

Lalu,

sudo systemctl restart haproxy

Selesai.

Bacaan Lebih Lanjut

Optimasi MySQL: Mematikan Query Cache

Optimasi MySQL: Mematikan Query Cache

Universitas Indonesia banyak menggunakan WordPress sebagai backend situs. Sayangnya, WordPress hanya mendukung basisdata MySQL. Untuk itu, kami memilih menggunakan MariaDB. Ada juga, sih, ingin menggunakan Percona, tetapi itu untuk kisah yang lain.

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Saya mendapati bahwa akses WordPress agak lama 1 sampai beberapa detik. Dari hasil baca sana-sini, saya menemukan sepertinya masalahnya ada pada konfigurasi query cache (QCache). Oracle menyarankan QCache dimatikan saja karena tidak mendukung paralelisasi pada mesin multi-core. Bahkan, untuk Oracle versi MySQL 5.6 secara baku mematikan fasilitas ini.

Lalu bagaimana?

Menurut saya, berhubung MariaDB berada di atas ZFS yang sudah ada ZIL dan ARC/L2ARC, mengapa tidak langsung saja pertembolokan diurus oleh sistemberkas?

Akhirnya, saya pun mematikan QCache:

query_cache_size = 0
query_cache_type = OFF

innodb_buffer_pool_instances = 4
innodb_buffer_pool_size = 4G

Sehingga:

MariaDB [(none)]> show global status like 'opened_tables';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Opened_tables | 62803 |
+---------------+-------+
1 row in set (0.00 sec)

MariaDB [(none)]> show global status like 'opened_tables';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Opened_tables | 62803 |
+---------------+-------+
1 row in set (0.00 sec)

MariaDB [(none)]> SHOW VARIABLES LIKE 'have_query_cache';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| have_query_cache | YES   |
+------------------+-------+
1 row in set (0.00 sec)

MariaDB [(none)]> SHOW STATUS LIKE 'Qcache%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| Qcache_free_blocks      | 0     |
| Qcache_free_memory      | 0     |
| Qcache_hits             | 0     |
| Qcache_inserts          | 0     |
| Qcache_lowmem_prunes    | 0     |
| Qcache_not_cached       | 0     |
| Qcache_queries_in_cache | 0     |
| Qcache_total_blocks     | 0     |
+-------------------------+-------+
8 rows in set (0.00 sec)

Indikator kesuksesan saya adalah tabel yang terbuka di MariaDB tidak bertambah atau bertambah dalam jumlah yang sedikit. Hasilnya, situs berjalan dengan baik dan lebih cepat.

Saya tertarik dengan mematikan double buffer pada MariaDB. Fungsi ini dapat digantikan oleh ZFS dengan mekanisme ZIL. Untuk berkas selain ZFS (EXT4) sangat tidak disarankan karena bila MySQL OOM atau mati tiba-tiba, InnoDB bisa langsung rusak. Ya, tapi, berhubung itu untuk situs yang banyak menulis ke basisdata, saya rasa belum perlu.

Bacaan Lebih Lanjut

Perkakas untuk Perangkat Keras Peladen HP

Perkakas untuk Perangkat Keras Peladen HP

Sanggahan

Universitas Indonesia memiliki banyak penyedia (vendor) untuk menyediakan perangkat keras peladen. Ada IBM, HP, dan (Alm.) SUN Microsystem. Kebetulan salah satunya adalah HP. Saya tidak sedang mengiklankan merek tertentu, namun berbagi pengalaman saja.

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Penambahan Repo

Perkakas HP yang lama bernama hpacucli. Sekarang berganti nama menjadi ssacli.

Pertama-tama, pasang repo HP MCP:

echo "deb http://downloads.linux.hpe.com/SDR/repo/mcp stretch/current non-free" | sudo tee /etc/apt/sources.list.d/HP-mcp.list

Tambahkan kunci publik.

wget -O- https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub | sudo apt-key add -

Perbaharui daftar aplikasi.

sudo apt update

Pemasangan Perkakas

Ada banyak perkakas yang disediakan oleh HP, termasuk juga SNMP. Namun, saya hanya tertarik perkakas untuk saya.

sudo apt install ssacli

Uji Coba

Kalau berhasil, maka perintah berikut akan bisa dijalankan.

$ sudo ssacli  ctrl all show

Smart Array P440ar in Slot 0 (Embedded)   (sn: PDNLH0BRH992F5)
Smart Array P441 in Slot 2                (sn: PDNMH0ARH84030)

Saya sengaja tidak mengurangi spasi pada parameter untuk membuktikan saya hanya menyalin perintah dari daftar perintah hpacucli.

Sepatah Kata Terakhir

Sejauh saya mencoba, parameter ssacli sepertinya identik dengan hpacucli. HP juga menyediakan SNMP untuk dapat mengakses kesehatan dan akses peramban. Namun, saya tidak membahasnya di sini karena ada di buku manual.

Repositori juga menyediakan untuk distro GNU/Linux lainnya seperti Ubuntu, Redhat, dan sejenisnya. Silakan lihat di daftar repositori. Saya mengubah URL menjadi HTTPS karena blog ini sensitif terhadap konten tidak aman (HTTP).

Bacaan Lebih Lanjut

Sesi PHP dengan Redis pada PHP 7.2

Sesi PHP dengan Redis pada PHP 7.2

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Saya menggunakan pwgen untuk membuat sandi:

sudo apt install pwgen

Pemasangan

Pasang modul PHP Redis dan peladen Redis.

sudo apt install php-redis redis-server

Karena Anda sering bandel dan main salin saja, maka saya tunjukkan pembuatan sandi yang benar:

export REDIS_PASSWORD=`pwgen 32 1`

Saya asumsikan ada sebuah variabel $REDIS_PASSWORD yang berisi sandi yang benar. Untuk contoh saya, saya gunakan perkakas pwgen untuk menghasilkan sandi 32 karakter. Silakan gunakan sandi sendiri.

Selanjutnya, tambahkan sandi pada Redis:

echo requirepass $REDIS_PASSWORD  | sudo tee -a /etc/redis/redis.conf

dan PHP 7.2:

$ sudo tee /etc/php/7.2/fpm/conf.d/99-redis-session.ini << EOF
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379?auth=$REDIS_PASSWORD"
EOF

Untuk penambahan konfigurasi sebaiknya jangan di berkas php.ini. Gunakan berkas terpisah supaya ketika terjadi pembaharuan Debian tidak menimpa konfigurasi yang sudah dimodifikasi.

Muat ulang Redis dan PHP-FPM:

sudo /etc/init.d/redis-server restart
sudo /etc/init.d/php7-fpm stop && sudo /etc/init.d/php7-fpm start

Selesai.

TIPS #1

Untuk menguji apakah Redis berjalan dengan baik, jalankan:

$ redis-cli  -a $REDIS_PASSWORD  keys '*'
1) "PHPREDIS_SESSION:v61gelc0g2vgv6etgst6q3ipm6"
2) "PHPREDIS_SESSION:a286kiqjskupugblas2g6r85lv"
3) "PHPREDIS_SESSION:di8au2o81r8t299br1fpnedmb3"
4) "PHPREDIS_SESSION:bnfsp1587div8pgvdj3qbfq6fu"
5) "PHPREDIS_SESSION:g43f0qiivi182dmriq1g6qa1ak"
6) "PHPREDIS_SESSION:134bts56qhmvm3v5mpvr9ne3nh"
7) "PHPREDIS_SESSION:da38q9a555m2q55m0b5rtocpne"

 

Bacaan Lebih Lanjut

Pemasangan Docker pada Debian Stretch
Docker

Pemasangan Docker pada Debian Stretch

 “Well, hell! PMP exam topics That’s no excuse for insulting me! You PMP exam topics 300-320 questions pdf are 300-320 questions pdf Ma’s PMP exam topics PMP exam topics own blood son, but did PMP exam topics she take on that time PMP exam topics Tony Fontaine shot you in the leg? 70-532 answer analysis No, she 70-532 answer analysis just 300-320 questions pdf sent for old Doc 70-532 answer analysis Fontaine to dress it and asked the doctor what ailed Tony’s aim. Said she guessed licker was spoiling his marksmanship. Remember how mad that made Tony?”Both boys yelled 70-532 answer analysis with laughter.“Ma’s a card!” said Brent with loving approval. “You can always count on her to do the right thing 300-320 questions pdf and 70-532 answer analysis not embarrass you in front of PMP exam topics folks.”  But Gerald remained Gerald. 300-320 questions pdf His habits PMP exam topics of living and his ideas changed, but his manners he would 300-075 certification exam not change, 300-075 certification exam even had he been 70-532 answer analysis able to change them. He admired 300-320 questions pdf the drawling 300-075 certification exam elegance of the 300-075 certification exam wealthy rice and cotton planters, who rode into Savannah from their moss-hung kingdoms, mounted 70-532 answer analysis on 300-320 questions pdf thoroughbred horses and followed by the carriages of their 300-320 questions pdf equally elegant ladies 70-532 answer analysis and the wagons 300-320 questions pdf of their slaves. But Gerald could never attain elegance. 70-532 answer analysis Their lazy, blurred voices fell pleasantly 300-075 certification exam 300-075 certification exam 300-320 questions pdf on PMP exam topics his PMP exam topics ears, but his 300-075 certification exam PMP exam topics own 300-075 certification exam brisk brogue clung to his tongue. He liked the casual 70-532 answer analysis 300-075 certification exam grace with which they PMP exam topics conducted affairs 300-320 questions pdf of importance, 300-320 questions pdf risking 300-320 questions pdf a fortune, a plantation or a slave 70-532 answer analysis 300-075 certification exam on the 300-075 certification exam turn 70-532 answer analysis of a card and writing off their losses with careless good humor and no more ado than when they scattered 300-320 questions pdf pennies to pickaninnies. But Gerald had known poverty, and PMP exam topics he could never PMP exam topics learn to lose money with 70-532 answer analysis good 300-075 certification exam humor or good 300-320 questions pdf 70-532 answer analysis 300-320 questions pdf grace. They were PMP exam topics a pleasant race, these coastal Georgians, with their soft-voiced, 70-532 answer analysis PMP exam topics quick rages and their charming inconsistencies, and Gerald liked them. But 300-075 certification exam there was a 300-075 certification exam brisk and 70-532 answer analysis restless vitality 300-075 certification exam about the young Irishman, fresh from a country where winds blew wet and chill, where misty swamps held no fevers, that 300-075 certification exam set him apart from these indolent gentle-folk of semi-tropical weather and malarial marshes.

Pasang fitur HTTPS untuk APT:

sudo apt install apt-transport-https

Impor kunci repo:

wget -O- https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -

Tambahkan repo docker.io:

echo "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
    $(lsb_release -cs) \
    stable" | sudo tee /etc/apt/sources.list.d/docker.list

Perbaharui daftar paket repo dan pasang Docker:

sudo apt update && sudo apt install docker-ce

Muat ulang mesin biar aman:

sudo systemctl reboot

Selesai.

Tips #1 Eskalasi Izin Akun Pengguna Biasa

Supaya tidak perlu menjalankan Docker sebagai root, tambahkan izin untuk mengakses Docker dari login Anda. Caranya dengan menambahkan login Anda ke grup docker.

sudo gpasswd -a `whoami` docker
sudo newgrp docker

Tips #2 Pengujian Pemasangan Docker

Uji bila ini semua berhasil:

docker run hello-world

 

Solusi PostgreSQL dengan Patroni
PostgreSQL database

Solusi PostgreSQL dengan Patroni

Tahun baru dan Universitas Indonesia kedatangan peladen baru. Berhubung tim pengembang DSTI UI membuat pengembangan berbasis pelayan-mikro (microservice) dan ada pengembang yang iseng menantang saya menuju Kubernetes, saya pun tertantang membuat tutorial yang mendukung arsitektur tersebut. Kubernetes menyediakan fasilitas skalabilitas untuk menambah dan mengurangi peladen suatu layanan secara otomatis atau bisa diprogram manual.

Cara yang paling mudah untuk menyiapkan infrastruktur adalah dengan mengambil resep dari Ansible Playbook, menggunakan Juju, menggunakan helm, atau pemaket awan menurut keyakinan dan kepercayaan masing-masing. Namun, sebelum itu, saya tertarik untuk membahas bagaimana seandainya bila semua itu dibuat secara manual. Hal ini agar setiap kita dapat memahami bagaimana cara kerja masing-masing komponen yang nantinya diterbitkan dengan satu baris kode.

Tulisan ini sebenarnya mengikuti tutorial dari Linode. Hanya saja, saya menyesuaikan dengan lingkungan UI, Debian Stretch. Sehingga, ada yang saya modifikasi untuk keperluan dan keyakinan saya.

Arsitektur

PostgreSQL HA

PostgreSQL HA dengan 3 node dibalik haproxy

Untuk lingkungan ujicoba, saya membuat 5 mesin VM di VirtualBox dengan menggunakan 2 kartu jaringan (NIC). Satu NIC tipe NAT untuk keluar (standar VirtualBox) dengan DHCP. Satu lagi NIC tipe Jaringan Internal yang digunakan untuk setiap VM berkomunikasi satu sama lain.

pg1:

  • hostname: pg1
  • NIC: 192.0.2.11
  • Memori: 1GB

pg2:

  • hostname: pg2
  • NIC: 192.0.2.12
  • Memori: 1GB

pg3:

  • hostname: pg3
  • NIC: 192.0.2.13
  • Memori: 1GB

haproxy0:

  • hostname: haproxy0
  • NIC: 192.0.2.22
  • Memori: 512MB

etcd0:

  • hostname: etcd0
  • NIC: 192.0.2.21
  • Memori: 1GB

Berhubung komputer saya memiliki memori 32GB, saya agak royal mengalokasikan memori. Untuk keperluan pembelajaran, bisa, kok, dikurangi menjadi 512MB. Tapi, saya belum mencoba.

Sekedar tips untuk pengerjaan pg1 s.d. pg3. Sebaiknya kerjakan saja dulu pg1 lalu setelah rampung, klon dan ubah konfigurasi IP dan hostname sesuai dengan masing-masing mesin.

Konfigurasi Jaringan

Ada dua hal yang perlu dikerjakan:

  1. Konfigurasi IP pada NIC yang digunakan untuk berkomunikasi
  2. Tambahkan daftar hostname.

Konfigurasi IP

Pertama-tama kita perlu tahu NIC yang perlu dikonfigurasi. Debian Stretch sudah tidak lagi menyediakan ifconfig. Cara yang sahih sekarang untuk mengetahui ada antarmuka NIC apa saja yang tersedia:

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 08:00:27:86:ca:c3 brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 08:00:27:20:b1:2b brd ff:ff:ff:ff:ff:ff

Pada konfigurasi VM saya, yang NIC yang perlu dikonfigurasi adalah enp0s8 — punya Anda bisa beda. Untuk menambahkan konfigurasi IP statik umpanya untuk mesin pg1:

$ sudo tee /etc/network/interfaces.d/enp0s8 << EOF
auto enp0s8
allow-hotplug enp0s8
iface enp0s8 inet static
  address 192.0.2.11
  netmask 255.255.255.0
EOF

Gunakan penyunting teks favorit Anda, tapi saya menggunakan cara heker. 😛

Lakukan ini untuk pg2, pg3, haproxy0, dan etcd0 dengan IP mereka masing-masing.

Untuk langsung mengaktifkan konfigurasi jaringan:

$ sudo ifup enp0s8

Lakukan ini di semua mesin.

Konfigurasi Hostname

Untuk VM, sebaiknya untuk setiap VM yang berhubungan dimasukkan namanya ke daftar /etc/hosts. Lakukan ini di semua mesin:

$ sudo tee -a  /etc/hosts << EOF
192.0.2.21      etcd0
192.0.2.22      haproxy0
192.0.2.11      pg1
192.0.2.12      pg2
192.0.2.13      pg3
EOF

Ganti nama hostname, umpanya untuk mesin pg1:

sudo hostnamectl set-hostname pg1

Keluar dari SSH lalu masuk kembali. Kalau tidak, nama sudah berganti tetapi shell Anda masih bernama yang lama.

Pemasangan etcd

TIPS: Pengerjaan yang saya lakukan adalah saya mematikan pg1. Lalu, saya klon dan saya ubah IP dan hostname.

Aplikasi etcd adalah sebuah repositori konfigurasi yang bisa diakses dari jaringan. Dia bisa dibuat kluster, tetapi untuk contoh kali ini dibuatkan satu saja. Saya asumsikan jaringan dan nama sudah terbuat.

Cara terbaik saat ini untuk lingkungan awan adalah menggunakan pemaket snapcraft untuk mendapatkan perangkat lunak terbaru yang stabil. Debian Stretch tidak memasang pemaket ini secara baku. Pasang dulu:

sudo apt update
sudo apt install snapd

Lalu, pasang etcd menggunakan snapcraft:

sudo snap install etcd

Konfigurasi aplikasi berbasis snapcraft ada di /var/snap. Berhubung konfigurasinya panjang, saya sudah sediakan unduhan. Saya jelaskan properti yang penting saja nanti. Cara pasang:

wget -q -O- https://raw.githubusercontent.com/jpmrblood/postgresql-ha-configuration/master/etcd.conf.yml | sudo tee /var/snap/etcd/common/etcd.conf.yml

Beberapa properti yang penting:

  • name: ‘etcd0’ — memberi nama mesin ini. Kalau ada lebih dari satu mesin etcd, pastikan masing-masing unik.
  • data-dir: /var/lib/etcd/data — tempat data etcd. Saya sesuaikan dengan FHS.
  • wal-dir: /var/lib/etcd/wal — tempat penampungan untuk jurnal etcd.
  • listen-peer-urls: http://192.0.2.21:2380 — Alamat TCP/IP untuk mendengarkan permintaan bergabung.
  • listen-client-urls: http://localhost:2379,http://192.0.2.21:2379 — Alamat TCP/IP untuk aplikasi ini beroperasi.
  • initial-advertise-peer-urls: http://192.0.2.21:2380 — Alamat TCP/IP untuk mengiklankan diri sendiri ke etcd yang lain. Saat ini tidak terpakai karena hanya ada satu saja.
  • advertise-client-urls: http://192.0.2.21:2379 — Alamat TCP/IP yang diberitahukan kepada yang lainnya.
  • initial-cluster: etcd0=http://192.0.2.21:2380, — Sejumlah alamat TCP/IP peladen etcd yang tergabung dalam kluster. Kali ini hanya satu.
  • initial-cluster-token: ‘etcd-cluster’ — Nama kluster etcd kita. Maaf kalau kurang kreatif.
  • initial-cluster-state: ‘new’ — Kondisi awal saat pertama kali etcd nanti dijalankan.

Kalau tutorial Linode memuat semua ini dalam variabel lingkungan. Sayangnya, Debian Stretch tidak ada etcd sehingga kita terpaksa memasangnya dari snapcraft.

Sebelum menjalankan etcd, jangan lupa membuat direktori yang dibutuhkan.

sudo mkdir -p /var/lib/etcd/data /var/lib/etcd/wal
sudo snap start etcd

TIPS #1: Kalau mau mencoba dulu, sebelum menggunakan snap start, gunakan snap run untuk menjalankan etcd langsung. Apabila sudah selesai diagnosis, tekan CTRL+C untuk selesai.

Bila sudah benar, maka akan terlihat:

$ snap services
Snap  Service  Startup  Current
etcd  etcd     enabled  active

Bila statusnya sudah aktif, sekarang saatnya memasang PostgreSQL beserta Patroni.

Pemasangan PostgreSQL (pg1, pg2, dan pg3)

Kecuali hostname dan IP, semua pemasangan PostgreSQL identik. Selain itu, saya menggunakan pwgen untuk membuat sandi. Mohon sandi Anda berbeda dengan tutorial ini!

Pasang PostgreSQL

Pasang seperti biasa.

echo "deb http://kambing.ui.ac.id/postgresql/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list
wget --quiet -O - http://kambing.ui.ac.id/postgresql/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt update && sudo apt install postgresql-10

Saya sengaja memilih versi 10. Lebih baru dan keren.

Matikan layanan PostgreSQL karena kita mau menjalankannya dari Patroni:

sudo systemctl disable postgresql

Pasang Patroni

Patroni tersedia di Python PIP. Pasang PIP:

sudo apt install python3-pip
sudo pip3 install --upgrade setuptools

Baru pasang Patroni dan Python-etcd:

sudo pip3 install patroni[etcd]

Selanjutnya, buat konfigurasi Patroni:

$ sudo tee /etc/patroni.yml << EOF
scope: postgres
namespace: /db/
name: pg1

restapi:
    listen: 192.0.2.11:8008
    connect_address: 192.0.2.11:8008

etcd:
    host: 192.0.2.21:2379

bootstrap:
    dcs:
        ttl: 30
        loop_wait: 10
        retry_timeout: 10
        maximum_lag_on_failover: 1048576
        postgresql:
            use_pg_rewind: true

    initdb:
    - encoding: UTF8
    - data-checksums

    pg_hba:
    - host replication replicator 127.0.0.1/32 md5
    - host replication replicator 192.0.2.11/0 md5
    - host replication replicator 192.0.2.12/0 md5
    - host replication replicator 192.0.2.13/0 md5
    - host all all 0.0.0.0/0 md5

    users:
        admin:
            password: ioqu8ohqueh6kai5va0Hoigirae7Xaem
            options:
                - createrole
                - createdb

postgresql:
    listen: 192.0.2.11:5432
    connect_address: 192.0.2.11:5432
    data_dir: /var/lib/postgresql/10/patroni
    pgpass: /tmp/pgpass
    authentication:
        replication:
            username: replicator
            password: shohkaitahsee0er6eXoh0Ohghie2toh
        superuser:
            username: postgres
            password: exuush9shohlail6Cool9eeng3kae5iy
    parameters:
        unix_socket_directories: '.'

tags:
    nofailover: false
    noloadbalance: false
    clonefrom: false
    nosync: false
EOF

Jangan lupa mengganti IP pada setiap baris listen dan connect_address pada mesin pg2 dan pg3 dengan IP masing-masing. Jangan lupa mengganti sandi (password) agar tidak sama dengan tutorial ini!

Siapkan direktori data untuk PostgreSQL versi Patroni:

sudo -u postgres mkdir -p /var/lib/postgresql/10/patroni

Terakhir, pasang unit pelayan systemd Patroni:

$ sudo tee /etc/systemd/system/patroni.service << EOF
[Unit]
Description=Runners to orchestrate a high-availability PostgreSQL
After=syslog.target network.target

[Service]
Type=simple

User=postgres
Group=postgres

Environment="PATH=/usr/lib/postgresql/10/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
ExecStart=/usr/local/bin/patroni /etc/patroni.yml

KillMode=process

TimeoutSec=30

Restart=no

[Install]
WantedBy=multi-user.target
EOF

Daftarkan dan jalankan Patroni:

sudo systemctl daemon-reload
sudo systemctl enable patroni
sudo systemctl start patroni

Kalau sudah benar, maka Patroni akan menjalankan PostgreSQL versinya.

$ systemctl status patroni
● patroni.service - Runners to orchestrate a high-availability PostgreSQL
   Loaded: loaded (/etc/systemd/system/patroni.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-01-26 11:18:14 WIB; 2min 27s ago
 Main PID: 9391 (patroni)
    Tasks: 12 (limit: 4915)
   CGroup: /system.slice/patroni.service
           ├─9391 /usr/bin/python3 /usr/local/bin/patroni /etc/patroni.yml
           ├─9417 postgres -D /var/lib/postgresql/10/patroni --config-file=/var/lib/postgresql/10/patroni/postgresql.conf --max_prepared_transactions=0 --port=5432 --cluster_name=postgres --max_locks_per_transaction
           ├─9420 postgres: postgres: checkpointer process   
           ├─9421 postgres: postgres: writer process   
           ├─9422 postgres: postgres: wal writer process   
           ├─9423 postgres: postgres: autovacuum launcher process   
           ├─9424 postgres: postgres: stats collector process   
           ├─9425 postgres: postgres: bgworker: logical replication launcher   
           └─9430 postgres: postgres: postgres postgres 192.0.2.11(44308) idle

Lakukan ini di pg2 dan pg3. Jangan lupa mengganti IP pada berkas /etc/patroni.yml.

Oh, iya, kalau menggunakan klon, jangan lupa /etc/network/interfaces.d/enp0s8 diubah sesuai dengan IP mesin. Jangan lupa juga ganti hostname.

Terus, kalau misalnya pg2 dan pg3 diklon dari pg1 saat Patroni sudah terkonfigurasi, jangan lupa kosongkan terlebih dahulu direktori data Patroni.

sudo systemctl stop patroni
sudo -u postgres rm -rf /var/lib/postgresql/10/patroni/
sudo -u postgres mkdir /var/lib/postgresql/10/patroni/
sudo systemctl start patroni

Kalau tidak, bisa aneh nanti.

Pemasangan HAProxy

Komponen terakhir yang hendak kita pasang adalah HAProxy. Untungnya, sudah ada paket Debian untuk HAProxy. Pasang seperti biasa:

sudo apt install haproxy

Konfigurasi HAProxy untuk menjadi proksi ketiga mesin  PostgreSQL kita.

$ sudo tee /etc/haproxy/haproxy.cfg << EOF
global
    maxconn 100

defaults
    log global
    mode tcp
    retries 2
    timeout client 30m
    timeout connect 4s
    timeout server 30m
    timeout check 5s

listen stats
    mode http
    bind *:7000
    stats enable
    stats uri /

listen postgres
    bind *:5000
    option httpchk
    http-check expect status 200
    default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions
    server postgresql_192.0.2.11_5432 192.0.2.11:5432 maxconn 100 check port 8008
    server postgresql_192.0.2.12_5432 192.0.2.12:5432 maxconn 100 check port 8008
    server postgresql_192.0.2.13_5432 192.0.2.13:5432 maxconn 100 check port 8008
EOF

Setelah itu, muat ulang HAProxy untuk memuat konfigurasi baru.

sudo systemctl restart haproxy

Saya mengikuti Tutorial Linode untuk membuat port PostgreSQL pada port 5000. Anda bisa saja membuat port 5432. Kebetulan PC saya ada layanan PostgreSQL lain yang jalan pada port itu.

Untuk memonitor, silakan buka peramban Anda pada port 7000.

HAProxy interfacing Patriani's PostgreSQL nodes

HAProxy interfacing Patriani’s PostgreSQL nodes

Hanya ada satu yang hijau/aktif. Kalau tiga-tiganya, kemungkinan Anda mengklon tanpa mengubah konfigurasi dan mengosongkan direktori data PostgreSQL terlebih dahulu.

Selesai.

(Kulshekhar Kabra, 2017)

Daftar Pustaka

Kulshekhar Kabra (2017, September 19). Create a Highly Available PostgreSQL Cluster Using Patroni and HAProxy. Retrieved January 26, 2018 from https://linode.com/docs/databases/postgresql/create-a-highly-available-postgresql-cluster-using-patroni-and-haproxy/.^
Memasang Python 3.6.4 pada Debian dan Turunannya
ID Python

Memasang Python 3.6.4 pada Debian dan Turunannya

Cara sebelumnya menggunakan pyenv, sebuah perkakas yang membantu untuk memasang Python 3. Python 3.6 menyatakan bahwa paket pyenv sudah kedaluwarsa, alias sudah tidak akan dipakai lagi. Ya, sudah, dari pada ada masalah, mari memasang dengan mengompilasi dari kode sumber. Sekalian saja, mengoptimasi pemasangan.

Seperti yang lain, pasang paket yang dibutuhkan:

sudo apt install -y build-essential libbz2-dev libssl-dev libreadline-dev libsqlite3-dev tk-dev libpng-dev libfreetype6-dev

Unduh kode sumber, ekstraksi, dan masuk ke direktori:

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
tar xvfJ Python-3.6.4.tar.xz
cd Python-3.6.4/

Konfigurasi dengan optimasi menyeluruh:

CXX="/usr/bin/g++" CFLAGS="-march=native -mtune=native -pipe" CXXFLAGS=$CFLAGS ./configure --enable-optimizations --with-lto --enable-shared  --with-system-expat --with-system-ffi --with-system-libmpdec --with-ensurepip=yes

Kompilasi:

make -j$(nproc)

Ada sekitar 406 tes yang harus dilewati. Untuk itu, sebaiknya saat kompilasi Anda menyapa keluarga Anda, gebetan Anda, atau pun rekan di sebelah Anda. Ingat! Anda tidak sendirian di dunia ini.

Pasang dengan nama alternatif agar tidak bentrok dengan Python yang telah terpasang di sistem:

sudo make altinstall

Konfigurasi Sebuah Lingkungan Python versi 3.6.4

Cara untuk membuat sebuah lingkungan terisolasi yang didukung oleh Python adalah dengan menggunakan perkakas venv. Perkakas pyenv sudah kedaluwarsa dan tidak disarankan pengembang Python.

Pasang sebuah lingkungan baru:

python3.6m -m venv ~/.local/python-3.6.4

Masukan direktori lingkungan lokal tersebut ke PATH dan simpan di ~/.bashrc agar tersimpan PATH baru tersebut.

echo "PATH=~/.local/python-3.6.4/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

Jalankan Python versi 3.6.4

Untuk menjalankan Python yang sudah terpasang:

source activate

Untuk mematikan — mengembalikan ke Python versi sistem:

source deactivate

Selesai.

Memasang Python 3 Terbaru di Debian dan Turunannya
ID Python

Memasang Python 3 Terbaru di Debian dan Turunannya

Debian menyertakan Python 3 versi 3.5 yang sebenarnya cukup untuk digunakan. Namun, untuk menambah khasanah dan tulisan di blog ini, saya berusaha menulis cara memasang Python versi terbaru. Siapa tahu ada yang berminat. Apalagi, Python menjadi seksi semenjak banyak pustaka seperti Numpy dan Pandas untuk pengolahan data besar.

Paket yang Diperlukan

Pasang pengembangan paket yang diperlukan:

sudo apt install -y build-essential libbz2-dev libssl-dev libreadline-dev \
                         libsqlite3-dev tk-dev libpng-dev libfreetype6-dev  -y

Pasang paket GIT karena perkakas untuk memasang memerlukan akses GIT:

sudo apt install git

Perkakas pyenv

Perkakas pyenv adalah sebuah perkakas yang bisa memasang berbagai versi Python dan mengaktifkannya sesuai selera.

 wget -O- https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer  | bash

Perkakas pyenv akan memasang skrip yang dibutuhkan untuk memasang Python. Setelah memasang pyenv, tambahkan tiga baris berikut ke ~/.bashrc dengan penyunting teks favorit Anda.

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Untuk bisa langsung mengaktifkan, langsung jalankan:

source ~/.bashrc

Pemasangan Python

Setelah perkakas pemasang selesai dipasang, langsung saja pasang Python 3 terbaru:

pyenv install 3.6.4

Setelah selesai pemasangan, kasih nama lingkungan Python versi 3.6.4 itu agar nanti kalau butuh versi ini gampang diaktifkan.

pyenv virtualenv 3.6.4 versi_3.6.4

Versi Global

Sampai baris ini, bila kita mengetik:

$ python --version
Python 2.7.13

akan terlihat versi baku untuk pengguna yang aktif adalah Python 2.7.13 (Debian Stretch). Agar versi yang telah dikompilasi menjadi versi yang baku, jalankan:

pyenv global versi_3.6.4

Selesai.

Bacaan Lebih Lanjut

WordPress 4.9.1 dengan PHP 7.2

WordPress 4.9.1 dengan PHP 7.2

Saya biasanya kalau mau memperbaharui WordPress selalu menunggu versi minor .1 atau lebih. Soalnya, suka ada perilaku tak terduga kalau versi mayor baru terbit. Kali ini, WordPress 4.9.1 sudah terbit.

Menurut situsnya, WordPress merekomendasikan penggunaan PHP 7.2. Saya sendiri baru tahu kalau sudah ada PHP 7.2. Pantas saja WordPress berhenti di versi 4.8.4 pada beberapa peladen.

Saatnya memasang PHP 7.2!

Pemasangan PHP 7.2

Saya pernah membahas tentang PHP 7.1+ di artikel terdahulu. Jadi, ini sekedar mengulang saja.

Aktifkan modul APT untuk mengakses repo berbasis HTTPS dan beberapa paket lainnya.

sudo apt-get install apt-transport-https lsb-release ca-certificates

Aktifkan repo Suri.

wget -O- https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ jessie main" | sudo tee -a /etc/apt/sources.list.d/php-sury.list
sudo apt update

Lalu, pasang PHP 7.2 untuk menggantikan PHP 5.

sudo apt install php7.2-fpm php7.2-curl php7.2-gd php7.2-imagick php7.2-json php7.2-mysql php7.2-readline php-redis php7.2-xml php7.2-mbstring php7.2-zip php7.2-mysql

Kalau hanya sekedar php-fpm, yang terpasang bakal versi 7.1. Harus secara eksplisit disebutkan versi 7.2.

Selanjutnya, menyalin konfigurasi fpm dari /etc/php5/fpm/pool.d ke /etc/php/7.2/fpm/pool.d untuk setiap pool.

Saya sejauh ini tidak ada masalah.

Fungsi Yang Mulai Ditinggalkan

Nampaknya PHP7 dan terbaru hendak dibuat menjadi domain yang ketat (strict typecast). Mungkin pengembang PHP ingin menjadikan PHP sebagai bahasa yang lebih aman. Kalau saya melihat log, biasanya akan diprotes bentuk akses senarai (array). Saya mendapati fungsi count() terutama yang paling sering dicatat.

count(): Parameter must be an array or an object that implements Countable in ...

Ada orang-orang yang memutuskan untuk kembali ke PHP 7.1. Tapi saya tidak! Agar sesuai dengan PHP7.2 dan terbaru, misalnya ada variabel:

count($elements[‘#value’])

count ( $elements )

Diubah dengan menambahkan uji tipe senarai :

is_array ( $elements ) && count ( $elements )

Atau, saat diubah menjadi tipe senarai:

$elements = ( array ) $source->getElements();

Penyebab ini semua kalau saya lihat di kode sumber WordPress adalah biasanya karena penggunaan variabel global.

Untung saja, untuk yang lain pun WordPress dan plugin-nya sudah cukup bersahabat.

Bacaan Lebih Lanjut

Melihat Laporan DMARC

Melihat Laporan DMARC

Dengan semakin ganasnya SPAM dan bisnis surel, Universitas Indonesia pun selalu memperbaharui konfigurasi surel agar selalu aman dan nyaman. Selama inisaya hanya menerapkan SPF, DKIM, ADSP, DMARC dan lain sebagainya ke sub domain UI. Kali ini, untuk domain global UI, DMARC pun diterapkan.

Saya membuka kotak pandora! Ternyata ada domain-domain di bawah UI yang masih perlu dikonfigurasi. Misalnya, untuk domain yang berbasis Google Apps (GMail), saya menerapkan minimum konfigurasi SPF dan DMARC. Namun, ini semua harus ditambahkan satu persatu.

Beruntung, DMARC menyediakan mekanisme laporan berkala yang bisa dipakai oleh UI untuk melihat bagaimana domainnya digunakan ke tempat lain. Laporan DMARC berformat XML. Untuk ini, saya menuliskan cara saya membaca XML tersebut dengan perkakas yang sudah ada.

Saya malas membuat pencacah sendiri. Untungnya, Dave dari TechSneeze menyediakan perkakas kecil untuk itu. Ada dua bagian yang perlu dipasang, pencacah dan pembaca. Berhubung saya tiba-tiba jadi malas menulis, saya percepat saja.

Basisdata

Pencacah ini memasukkan XML ke dalam basisdata. Basisdata MySQL ini digunakan untuk menyimpan hasil proses pelaporan DMARC. Mari buat sebuah basisdata:

sudo mysql --defaults-file=/etc/mysql/debian.cnf -e "create database opendmarc;"
sudo mysql --defaults-file=/etc/mysql/debian.cnf -e "grant all privileges on opendmarc.* to 'opendmarc'@'localhost' identified by 'p4$sW0Rd';"
sudo mysql --defaults-file=/etc/mysql/debian.cnf -e "flush privileges;"

Jangan lupa mengganti sandi dengan yang benar!

Pencacah

Pasang paket-paket pendukung.

sudo apt-get install libmail-imapclient-perl libmime-tools-perl libxml-simple-perl \
libclass-dbi-mysql-perl libio-socket-inet6-perl libio-socket-ip-perl libperlio-gzip-perl \
libmail-mbox-messageparser-perl unzip

Unduh dan masuk ke direktori.

git clone https://github.com/techsneeze/dmarcts-report-parser.git
cd dmarcts-report-parser

Salin berkas dmarcts-report-parser.conf.sample menjadi dmarcts-report-parser.conf yang akan dipakai sebagai konfigurasi. Ubah login MySQL di berkas tersebut.

$dbname = 'opendmarc';
$dbuser = 'opendmarc';
$dbpass = 'p4$sW0Rd';

Sudah bisa digunakan. Cara saya menggunakannya:

zcat /tmp/linkedin.com\!ui.ac.id\!1513036800\!1513123200\!chips.xml.gz | ./dmarcts-report-parser.pl -x -

Saya suka cara seperti ini. Kalau misalnya semua berkas laporan ditaruh di sebuah direktori, maka tinggal:

for report in `find /tmp/reports/ -type f `; do zcat $report | ./dmarcts-report-parser.pl -x - ; done

Kalau membaca konfigurasi, perkakas ini bisa membaca dari IMAP. Tetapi saya belum mencobanya.

Pembaca

Salin GIT:

rm -rf /var/www/html
git clone https://github.com/techsneeze/dmarcts-report-viewer.git html
sudo mv html /var/www
sudo chown -R 33:33 /var/www/html

Pasang PHP-FPM dan NGINX. Berkas utamanya ada di /var/www/html. Saya terlalu malas untuk mengonfigurasi. Tapi, ini kira-kira konfigurasi saya:

cat >> /etc/nginx/sites-enabled/default << EOF
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?$query_string;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php7.0-cgi alone:
                #fastcgi_pass 127.0.0.1:9000;
                # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}
EOF

Jangan lupa dmarcts-report-viewer-config.php.sample menjadi dmarcts-report-viewer-config.php dan ubah $dbname, $dbuser, dan $dbpass seperti konfigurasi pencacah.

Silakan diubah sesuai selera. Nanti kalau sudah selesai, bisa dilihat di peramban:

DMARC Report

DMARC Report

Kalau saya tidak sedang sibuk dan malas menulis, saya akan mencoba membagikan bagaimana mengonfigurasi SPF, DKIM, ADSP, DMARC dan lain sebagainya. Kalau ingat, ya…. Tak janji.

Bacaan Lebih Lanjut

Memasang Enterprise Single Sign-On – CAS  (Sebelumnya Jasig CAS)

Memasang Enterprise Single Sign-On – CAS (Sebelumnya Jasig CAS)

SSO merupakan sebuah konsep yang sebenarnya digunakan di portal korporasi. Namun, pada perkembangannya, justru organisasi pendidikan tinggi mengadopsinya juga untuk login yang terfederasi. Contoh pengguna SSO yang terfederasi untuk perguruan tinggi adalah eduroam.

Saya mau membuat sebuah solusi SSO menggunakan Jasig CAS. Ada, sih, versi lain seperti SUN CAS, Google Accounts, atau WSO2 Identity Provider. Tapi, saya memilih CAS karena sudah lama digunakan di UI dan saya malas mencari yang lain.

Berhubung tulisan ini panjang, langsung saja saya berikan asumsi berikut:

  • Debian Strecth masih kosong.
  • CAS berdiri sendiri (standalone) dengan Jetty.
  • Sertifikat SSL sudah ditandatangani oleh pihak ketiga.
  • Iman yang teguh.

Langsung saja persiapan sistem.

Persiapan Sistem

Sebelum memasang CAS, persiapkan sistem terlebih dahulu.

Memasang JDK 8

Saya percaya isi lisensi, lebih baik dilewati saja:

echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

Agar dapat memasang sertifikat dari Webupd8, pastikan untuk memasang dirmgr (khusus Stretch):

sudo apt install dirmngr

Tambahkan repo Pemasang Oracle Java.

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo apt update

Pasang Oracle JDK8 dan paket unlimited JCE. Paket JCE berfungsi untuk mengaktifkan fungsi enkripsi yang lebih tinggi dari standar enkripsi yang disediakan oleh Oracle Java.

sudo apt install oracle-java8-installer oracle-java8-unlimited-jce-policy -y

Selesai untuk Java.

Menyiapkan Direktori yang Perlu

Sayangnya, sebelum CAS terpasang, ada yang harus dipersiapkan. Hal ini karena konfigurasi CAS masih terkode langsung dan tersebar di konfigurasi sehingga lebih baik untuk pemula mengikuti direktori konfigurasi standar.

Yang saya maksud adalah membuat direktori /etc/cas yang dimiliki oleh pengguna. Bisa saja dijalankan sebagai root langsung. Namun, lebih baik Anda berhenti membaca tulisan ini dan cari pekerjaan yang lebih cocok daripada sysadmin.

sudo mkdir /etc/cas /var/log/cas
sudo chown user:user /etc/cas /var/log/cas
sudo chmod 700 /etc/cas

Penambahan ekstra keamanan sehingga hanya bisa diakses oleh pengguna yang menjalankan CAS.

Memasang Sertifikat SSL

Untuk sertifikat yang ditandatangani sendiri, silakan baca panduan yang sudah disediakan pada Daftar Bacaan. Serius, deh. Pelit sekali Anda untuk bahkan  tidak mau menyediakan waktu untuk membuat sertifikat SSL Let’s Encrypt dengan certbot.

Hal yang perlu dilakukan adalah mengonversi PEM menjadi PKCS12 yang siap untuk diimpor ke dalam format keystore Java.

Ubah format PEM ke format PKCS12. Buat sembarang sandi karena keytool Java (JKS) tidak bisa mengimpor kunci tanpa sandi.

openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -name sesukaakulah -CAfile server.crt -caname geotrust

Terakhir, ubah dari PKCS12 ke JKS. Lihat, berkas dan kunci masing-masing saya buat dengan sandi yang berbeda. Jangan lupa disesuaikan pada berkas konfigurasi.

keytool -importkeystore  -deststorepass 2tZ065jsXz866Jxm -destkeypass wQShfDLHWmK4Zt6E -destkeystore thekeystore -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass changeit -alias

Ubah perizinan berkas thekeystore dan pindahkan ke direktori /etc/cas.

chmod 0400 thekeystore
mv thekeystore /etc/cas

Selanjutnya memasang CAS.

Memasang Overlay CAS

CAS versi terbaru (5.1.x) memecah paket-paket modulnya dalam banyak modul. CAS menggunakan perkakas pembangun Java untuk membungkus dan memaket modul sesuai dengan kebutuh pengguna. Jenis pemaketan tersebut dinamakan overlays. Ada dua jenis yang didukung yakni Maven dan Gradle. Saya memilih Gradle karena Maven lebih gampang dipasang.

Mengunduh Overlay CAS

Unduh dan ekstraksi overlay untuk Gradle:

wget https://github.com/apereo/cas-gradle-overlay-template/archive/master.tar.gz
tar xvfz master.tar.gz && cd cas-gradle-overlay-template-master/

Mengonfigurasi Overlay CAS

Pada gradle.properties saya mengubah versi Spring Boot ke yang terbaru:

springboot.version=1.5.7.RELEASE

Pada etc/cas/config/application.yml tambahkan:

server:
  ssl:
    enabled: true
    keyStore: /etc/cas/thekeystore
    keyStorePassword: quoofah2AeL1Quu0
    keyPassword: Lah3ohmooreeng9e

Pada baris ke-5 etc/cas/config/log4j2.xml ubah direktori log ke standar FHS (/var/log):

            <Property name="baseDir">/var/log/cas</Property>

Pada cas/build.gradle ubah tomcat menjadi jetty:

    compile "org.apereo.cas:cas-server-webapp-jetty:${project.'cas.version'}@war"

Selanjutnya, jalankan perintah berikut untuk membangun paket yang dibutuhkan.

./gradlew build --parallel

Menjalankan CAS

Berkas yang dihasilkan dari hasil konfigurasi ada di cas/build/libs/cas.war. Berkas ini merupakan sebuah paket aplikasi Web Java yang bisa dijalankan oleh kontainer Servlet apa pun. Namun, untuk keperluan kali ini, jalankan perintah:

./gradlew bootRun

Kalau sukses akan muncul di port 8443. Gunakan login casuser dan sandi Mellon untuk masuk.

Berhubung hari sudah subuh, saya berhenti di sini. Nanti selanjutnya tutorial akan lanjut kepada konfigurasi CAS.

Bacaan Lebih Lanjut

Pasang Zabbix 3.2 di Debian Jessie

Pasang Zabbix 3.2 di Debian Jessie

 The twins looked at each other jubilantly but with some surprise. Although 70-534 answer analysis they 70-534 answer analysis considered themselves Scarlett’s favored suitors, they had never before gained tokens ADM-201 exam dumps of this favor so easily. Usually she made them beg and plead, while she put them off, CISSP exam topics refusing to give a 70-534 answer analysis Yes or No answer, laughing if they sulked, growing cool if they became angry. And here she had practically promised them 70-534 answer analysis the ADM-201 exam dumps whole of tomorrow—seats by her at 70-534 answer analysis the barbecue, all the waltzes (and they’d see to it that the dances were CISSP exam topics all waltzes!) and the supper intermission. This was worth getting expelled from the university.Filled ADM-201 exam dumps with new enthusiasm by their success, they CISSP exam topics lingered on, talking about the barbecue 70-534 answer analysis and the ball and Ashley Wilkes 300-208 study material CISSP exam topics and Melanie Hamilton, CISSP exam topics interrupting each other, making jokes and laughing at them, hinting broadly for invitations 300-208 study material to supper. ADM-201 exam dumps Some time had passed before they realized that Scarlett was having very little to say. The atmosphere had somehow changed. Just how, the twins did not know, but the fine glow had gone out of the afternoon. Scarlett seemed to ADM-201 exam dumps be paying little attention to 70-534 answer analysis what they 300-208 study material 70-534 answer analysis ADM-201 exam dumps said, although she made the correct answers. Sensing something they 300-208 study material could not understand, baffled and annoyed by it, the twins struggled along for a while, and then rose reluctantly, ADM-201 exam dumps looking at their 300-208 study material watches.The sun was low CISSP exam topics across the new-plowed fields and the tall woods across the river ADM-201 exam dumps were looming ADM-201 exam dumps blackly in silhouette. Chimney swallows were darting swiftly across the yard, and chickens, ducks and turkeys were waddling 70-534 answer analysis and strutting and straggling in from the fields.Stuart bellowed: “Jeems!” And after an interval a 70-534 answer analysis tall black boy of their own age ran breathlessly around CISSP exam topics the house and out toward the ADM-201 exam dumps tethered horses. Jeems was their 300-208 study material body servant and, like CISSP exam topics the dogs, accompanied them everywhere. He had been CISSP exam topics their childhood playmate and had been given to the twins for their own ADM-201 exam dumps on their tenth birthday. At the sight of him, CISSP exam topics CISSP exam topics the Tarleton hounds rose up out of the red dust and stood waiting expectantly for their masters. The 300-208 study material boys bowed, shook hands and 300-208 study material told CISSP exam topics Scarlett they’d be over 300-208 study material at the 300-208 study material Wilkeses’ early in the morning, waiting for her. Then CISSP exam topics they were ADM-201 exam dumps off down the 70-534 answer analysis walk CISSP exam topics at a rush, mounted their horses and, followed by ADM-201 exam dumps ADM-201 exam dumps Jeems, went down the avenue of cedars at a gallop, waving their hats and yelling back to her.When they had rounded the curve of the dusty road that hid them from Tara, Brent drew his horse to a ADM-201 exam dumps stop under a clump of dogwood. Stuart halted, 70-534 answer analysis too, and the darky boy pulled up a few paces behind 300-208 study material them. The horses, feeling slack reins, 300-208 study material stretched down their necks to crop the tender spring grass, and the patient hounds lay down again in the 300-208 study material CISSP exam topics soft red dust and looked up longingly at the chimney swallows circling in the gathering dusk. 300-208 study material Brent’s wide ingenuous face was puzzled and mildly indignant.“Look,” he said. “Don’t it look to you like she 70-534 answer analysis would of asked us to stay for supper?”  Nor did 70-534 answer analysis James and Andrew, who took him into their store in Savannah, regret his lack of education. His clear hand, his 300-208 study material accurate CISSP exam topics figures and his shrewd ADM-201 exam dumps ability in bargaining won their respect, where a knowledge 70-534 answer analysis of literature and a fine appreciation of music, had young 300-208 study material Gerald possessed them, would have moved them to snorts of contempt. America, in the early years of the century, had been kind to the Irish. James and Andrew, who had begun by hauling goods in covered wagons 70-534 answer analysis from Savannah to Georgia’s inland towns, had prospered into a store of their own, and Gerald prospered with them.

Pasang repositori resmi Zabbix 3.2 untuk Debian Jessie

wget http://repo.zabbix.com/zabbix/3.2/debian/pool/main/z/zabbix-release/zabbix-release_3.2-1+jessie_all.deb
sudo dpkg -i zabbix-release_3.2-1+jessie_all.deb
sudo apt update

Pasang peladen Zabbix dan antarmuka webnya:

sudo apt-get install zabbix-server-pgsql zabbix-frontend-php php5-pgsql

Peladen Zabbix

Buat basisdata PostgreSQL untuk digunakan Zabbix dengan sedikit sentuhan nama yang cukup kreatif (menurut saya, kayaknya).

sudo -u postgres createuser -DAP terjabiks
sudo -u postgres createdb -O terjabiks jabikdb

Buat skema Zabbix di basisdata yang sudah dibuat:

zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | psql -U terjabiks -h localhost jabikdb

Setelah itu, jangan lupa sesuaikan konfigurasi peladen Zabbix (/etc/zabbix/zabbix_server.conf) dengan login PostgreSQL yang sudah dibuat. Cari baris-baris yang berisi hal berikut dan ganti. Sandinya tentu saja ubah, ya, sesuai dengan sandi yang sudah dibuat sebelumnya. Saya menggunakan pwgen untuk membuat sandi.

DBHost=localhost
DBName=jabikdb
DBUser=terjabiks
DBPassword=P4S$WoRDYgDiBuatPak3PwG3nAja

Setelah itu, jalankan ulang peladen Zabbix agar menggunakan konfigurasi yang sudah diubah:

sudo systemctl restart zabbix-server

Peladen Antarmuka Web Zabbix

Ubah konfigurasi /etc/zabbix/apache.conf untuk menambahkan Timezone. Kebetulan saya di Asia/Jakarta (GMT+7).

sudo sed -i  -e"s/# php_value date.timezone.*$/php_value date.timezone Asia\/Jakarta/" /etc/zabbix/apache.conf

Jalankan ulang Apache2.

sudo systemctl restart apache2

Buka peladen dan arahkan ke http://<alamat.server.zabbix.anda>/zabbix

Konfigurasi Web Zabbix

Klik Next step terus sampai konfigurasi basisdata dan isi sesuai yang diset tadi.

Zabbix Web configuring database backend.

Lalu klik Next step. Masukkan nama Zabbix Anda kalau mau.

zabbix detail name

Zabbix detail name

Pencet terus Next step sampai Finish.

Selesai.

Admin awal loginnya: Admin dan sandinya zabbix bila ingin masuk.

 

 

Bacaan Lebih Lanjut

Repositori Suri untuk PHP 7.1+

Repositori Suri untuk PHP 7.1+

Plessis mengumumkan bahwa dia sudah tidak mau lagi mengelola pemaketan PHP terbaru di Dotdeb. Dia kemudian menyarankan untuk menggunakan repositori dari Sury, seorang pengelola resmi pemaketan PHP dari Debian.

Karena Sury menggunakan HTTPS, jangan lupa pasang dulu transportasi HTTPS untuk APT:

sudo apt install apt-transport-https

Cara menambahkan:

wget -O- https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ jessie main" | sudo tee -a /etc/apt/sources.list.d/php-sury.list
sudo apt update

Selesai. Secara baku, paket PHP yang dipilih adalah 7.1. Namun, Sury menyediakan juga untuk paket PHP 7.0.

Create A Database and Its Owner on PostgreSQL
PostgreSQL database

Create A Database and Its Owner on PostgreSQL

In MySQL, these are the chants:

sudo mysql --defaults-file=/etc/mysql/debian.cnf
create database mydb;
grant all privileges on mydb.* to myuser identified by 'p@s$W0rd';

On PostgreSQL, the chants are:

sudo -u postgres createuser -DAP myuser
sudo -u postgres createdb -O myuser mydb

Very simple actually and Debian by default listen at localhost. Users can connect to its database via port 5432.

Of course, these chants are useful for developing apps. In Production, you should supply a user that can only Read/Write/Update a database. In fact, several frameworks like Laravel could setup another user just to Read the database.

Memasang Laravel pada Debian Jessie

Memasang Laravel pada Debian Jessie

Laravel bisa dengan PHP 5.6, tetapi lebih baik gunakan versi 7 saja. Versi 7 ada di DotDeb.

Persiapan

Pemasangan repo DotDeb dengan membuat /etc/apt/sources.list.d/dotdeb.list

echo "deb http://packages.dotdeb.org jessie all" | sudo tee -a /etc/apt/sources.list.d/dotdeb.list
echo "deb-src http://packages.dotdeb.org jessie all" | sudo tee -a /etc/apt/sources.list.d/dotdeb.list

Daftarkan kunci  repositori DotDeb dan kemudian perbaharui daftar paket.

wget -O- https://www.dotdeb.org/dotdeb.gpg  | sudo apt-key add
sudo apt update

Pasang Perkakas

Pasang hal-hal remeh.

sudo apt install unzip git

Pasang PHP7.

sudo apt install php-cli php-pgsql php-mysql php-sqlite3 php-mbstring php-xml php-zip

Pasang Composer.

sudo wget https://getcomposer.org/download/1.4.2/composer.phar -O /usr/local/bin/composer && sudo chmod +x /usr/local/bin/composer

Tambahkan PATH untuk Composer.

echo "PATH=\$PATH\:\$HOME/.composer/vendor/bin"  >> ~/.bashrc

Tak perlu keluar:

source ~/.bashrc

Pasang Laravel.

composer global require "laravel/installer"

Selesai.

 The twins looked at each other jubilantly but with some surprise. Although 70-534 answer analysis they 70-534 answer analysis considered themselves Scarlett’s favored suitors, they had never before gained tokens ADM-201 exam dumps of this favor so easily. Usually she made them beg and plead, while she put them off, CISSP exam topics refusing to give a 70-534 answer analysis Yes or No answer, laughing if they sulked, growing cool if they became angry. And here she had practically promised them 70-534 answer analysis the ADM-201 exam dumps whole of tomorrow—seats by her at 70-534 answer analysis the barbecue, all the waltzes (and they’d see to it that the dances were CISSP exam topics all waltzes!) and the supper intermission. This was worth getting expelled from the university.Filled ADM-201 exam dumps with new enthusiasm by their success, they CISSP exam topics lingered on, talking about the barbecue 70-534 answer analysis and the ball and Ashley Wilkes 300-208 study material CISSP exam topics and Melanie Hamilton, CISSP exam topics interrupting each other, making jokes and laughing at them, hinting broadly for invitations 300-208 study material to supper. ADM-201 exam dumps Some time had passed before they realized that Scarlett was having very little to say. The atmosphere had somehow changed. Just how, the twins did not know, but the fine glow had gone out of the afternoon. Scarlett seemed to ADM-201 exam dumps be paying little attention to 70-534 answer analysis what they 300-208 study material 70-534 answer analysis ADM-201 exam dumps said, although she made the correct answers. Sensing something they 300-208 study material could not understand, baffled and annoyed by it, the twins struggled along for a while, and then rose reluctantly, ADM-201 exam dumps looking at their 300-208 study material watches.The sun was low CISSP exam topics across the new-plowed fields and the tall woods across the river ADM-201 exam dumps were looming ADM-201 exam dumps blackly in silhouette. Chimney swallows were darting swiftly across the yard, and chickens, ducks and turkeys were waddling 70-534 answer analysis and strutting and straggling in from the fields.Stuart bellowed: “Jeems!” And after an interval a 70-534 answer analysis tall black boy of their own age ran breathlessly around CISSP exam topics the house and out toward the ADM-201 exam dumps tethered horses. Jeems was their 300-208 study material body servant and, like CISSP exam topics the dogs, accompanied them everywhere. He had been CISSP exam topics their childhood playmate and had been given to the twins for their own ADM-201 exam dumps on their tenth birthday. At the sight of him, CISSP exam topics CISSP exam topics the Tarleton hounds rose up out of the red dust and stood waiting expectantly for their masters. The 300-208 study material boys bowed, shook hands and 300-208 study material told CISSP exam topics Scarlett they’d be over 300-208 study material at the 300-208 study material Wilkeses’ early in the morning, waiting for her. Then CISSP exam topics they were ADM-201 exam dumps off down the 70-534 answer analysis walk CISSP exam topics at a rush, mounted their horses and, followed by ADM-201 exam dumps ADM-201 exam dumps Jeems, went down the avenue of cedars at a gallop, waving their hats and yelling back to her.When they had rounded the curve of the dusty road that hid them from Tara, Brent drew his horse to a ADM-201 exam dumps stop under a clump of dogwood. Stuart halted, 70-534 answer analysis too, and the darky boy pulled up a few paces behind 300-208 study material them. The horses, feeling slack reins, 300-208 study material stretched down their necks to crop the tender spring grass, and the patient hounds lay down again in the 300-208 study material CISSP exam topics soft red dust and looked up longingly at the chimney swallows circling in the gathering dusk. 300-208 study material Brent’s wide ingenuous face was puzzled and mildly indignant.“Look,” he said. “Don’t it look to you like she 70-534 answer analysis would of asked us to stay for supper?”  Nor did 70-534 answer analysis James and Andrew, who took him into their store in Savannah, regret his lack of education. His clear hand, his 300-208 study material accurate CISSP exam topics figures and his shrewd ADM-201 exam dumps ability in bargaining won their respect, where a knowledge 70-534 answer analysis of literature and a fine appreciation of music, had young 300-208 study material Gerald possessed them, would have moved them to snorts of contempt. America, in the early years of the century, had been kind to the Irish. James and Andrew, who had begun by hauling goods in covered wagons 70-534 answer analysis from Savannah to Georgia’s inland towns, had prospered into a store of their own, and Gerald prospered with them.
Memasang Golang Terbaru

Memasang Golang Terbaru

Debian Jessie memiliki Go versi lawas di repositorinya. Hal ini membuat beberapa aplikasi Go seperti Hydra SSO tidak bisa berjalan. Untuk itu, harus dipasang Go versi manual.

Pertama-tama, pergi ke laman unduh di situs resmi Go. Saat penulisan versi Go yang terbaru adalah 1.8.3. Lalu, salin tautan unduhan untuk dipakai.

Unduh dan taruh Go ke direktori tertentu. Kalau saya, lebih suka di /opt

wget -O- https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz | sudo tar xvfz - -C /opt

Go memerlukan direktori Go untuk pengguna dan direktori Go sendiri untuk bisa dieksekusi. Maka, buatlah berkas /etc/profiles.d/golang.sh yang berisi:

export GOROOT=/opt/go
export GOPATH=$HOME/.go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Selesai.

Oh, iya, supaya tidak usah keluar, langsung saja eksekusi:

source /etc/profile.d/golang.sh

 

Galera dengan Galera Arbitrator (GARB)

Galera dengan Galera Arbitrator (GARB)

Galera with Galera Arbitrator for conflict resolution.

Pada implementasi terdahulu, digunakan tiga basisdata agar tercapai kuorum. Kuorum ditujukan agar tidak tercapai konflik penulisan (split brain). Namun, sebenarnya untuk dua basisdata saja sudah cukup. Pasang saja Galera Arbritator (GARB) pada kepala kluster dan matikan saja salah satu node supaya terjadi kuorum.

 The twins looked at each other jubilantly but with some surprise. Although 70-534 answer analysis they 70-534 answer analysis considered themselves Scarlett’s favored suitors, they had never before gained tokens ADM-201 exam dumps of this favor so easily. Usually she made them beg and plead, while she put them off, CISSP exam topics refusing to give a 70-534 answer analysis Yes or No answer, laughing if they sulked, growing cool if they became angry. And here she had practically promised them 70-534 answer analysis the ADM-201 exam dumps whole of tomorrow—seats by her at 70-534 answer analysis the barbecue, all the waltzes (and they’d see to it that the dances were CISSP exam topics all waltzes!) and the supper intermission. This was worth getting expelled from the university.Filled ADM-201 exam dumps with new enthusiasm by their success, they CISSP exam topics lingered on, talking about the barbecue 70-534 answer analysis and the ball and Ashley Wilkes 300-208 study material CISSP exam topics and Melanie Hamilton, CISSP exam topics interrupting each other, making jokes and laughing at them, hinting broadly for invitations 300-208 study material to supper. ADM-201 exam dumps Some time had passed before they realized that Scarlett was having very little to say. The atmosphere had somehow changed. Just how, the twins did not know, but the fine glow had gone out of the afternoon. Scarlett seemed to ADM-201 exam dumps be paying little attention to 70-534 answer analysis what they 300-208 study material 70-534 answer analysis ADM-201 exam dumps said, although she made the correct answers. Sensing something they 300-208 study material could not understand, baffled and annoyed by it, the twins struggled along for a while, and then rose reluctantly, ADM-201 exam dumps looking at their 300-208 study material watches.The sun was low CISSP exam topics across the new-plowed fields and the tall woods across the river ADM-201 exam dumps were looming ADM-201 exam dumps blackly in silhouette. Chimney swallows were darting swiftly across the yard, and chickens, ducks and turkeys were waddling 70-534 answer analysis and strutting and straggling in from the fields.Stuart bellowed: “Jeems!” And after an interval a 70-534 answer analysis tall black boy of their own age ran breathlessly around CISSP exam topics the house and out toward the ADM-201 exam dumps tethered horses. Jeems was their 300-208 study material body servant and, like CISSP exam topics the dogs, accompanied them everywhere. He had been CISSP exam topics their childhood playmate and had been given to the twins for their own ADM-201 exam dumps on their tenth birthday. At the sight of him, CISSP exam topics CISSP exam topics the Tarleton hounds rose up out of the red dust and stood waiting expectantly for their masters. The 300-208 study material boys bowed, shook hands and 300-208 study material told CISSP exam topics Scarlett they’d be over 300-208 study material at the 300-208 study material Wilkeses’ early in the morning, waiting for her. Then CISSP exam topics they were ADM-201 exam dumps off down the 70-534 answer analysis walk CISSP exam topics at a rush, mounted their horses and, followed by ADM-201 exam dumps ADM-201 exam dumps Jeems, went down the avenue of cedars at a gallop, waving their hats and yelling back to her.When they had rounded the curve of the dusty road that hid them from Tara, Brent drew his horse to a ADM-201 exam dumps stop under a clump of dogwood. Stuart halted, 70-534 answer analysis too, and the darky boy pulled up a few paces behind 300-208 study material them. The horses, feeling slack reins, 300-208 study material stretched down their necks to crop the tender spring grass, and the patient hounds lay down again in the 300-208 study material CISSP exam topics soft red dust and looked up longingly at the chimney swallows circling in the gathering dusk. 300-208 study material Brent’s wide ingenuous face was puzzled and mildly indignant.“Look,” he said. “Don’t it look to you like she 70-534 answer analysis would of asked us to stay for supper?”  Nor did 70-534 answer analysis James and Andrew, who took him into their store in Savannah, regret his lack of education. His clear hand, his 300-208 study material accurate CISSP exam topics figures and his shrewd ADM-201 exam dumps ability in bargaining won their respect, where a knowledge 70-534 answer analysis of literature and a fine appreciation of music, had young 300-208 study material Gerald possessed them, would have moved them to snorts of contempt. America, in the early years of the century, had been kind to the Irish. James and Andrew, who had begun by hauling goods in covered wagons 70-534 answer analysis from Savannah to Georgia’s inland towns, had prospered into a store of their own, and Gerald prospered with them.

GARB adalah sebuah layanan khusus untuk memilih (voting) di Galera. Dia tidak ada ada data di dalamnya.

Pasang GARB

Supaya sama, saya asumsikan kita memasang repositori resmi dari MariaDB.

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo apt-get update

Mari memasang GARB:

sudo apt-get install galera-arbitrator-3

Selesai.

Konfigurasi GARB

Ubah berkas /etc/default/garb sebelum memulai GARB.

# Copyright (C) 2012 Codership Oy
# This config file is to be sourced by garb service script.

# A comma-separated list of node addresses (address[:port]) in the cluster
GALERA_NODES="192.168.101.10:4567,192.168.101.11:4567"

# Galera cluster name, should be the same as on the rest of the nodes.
GALERA_GROUP="apakek_cluster"

# Optional Galera internal options string (e.g. SSL settings)
# see http://galeracluster.com/documentation-webpages/galeraparameters.html
# GALERA_OPTIONS=""

# Log file for garbd. Optional, by default logs to syslog
# LOG_FILE=""

Jangan lupa untuk menyertakan port! Ada galat dikonfigurasi GARB bila kita tidak secara spesifik menyebutkan port Galera.

Jalankan GARB

sudo /etc/init.d/garb start

Bila sudah benar, seharusnya saat menguji jumlah node dalam kluster tetap tiga.

$ sudo mysql --defaults-file=/etc/mysql/debian.cnf -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'
+--------------+
| cluster size |
+--------------+
| 3            |
+--------------+

Selesai.