Categories
Web Server

Integrating PHP in Apache

To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php

DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:

/usr/local/etc/php/7.4/
Categories
Data Analysis

Metricbeat beginners guide

Config Path

cat /usr/local/etc/metricbeat/metricbeat.yml
metricbeat setup -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["localhost:9200"]'
PUT .kibana/_settings
{
"index": {
"blocks": {
"read_only_allow_delete": "false"
}
}
}
Categories
Git

Build git server

For Debian,

sudo apt update && sudo apt install git

For centos,

sudo yum install git
sudo useradd -r -m -U -d /home/git -s /bin/bash git
sudo su - git
mkdir -p ~/.ssh && chmod 0700 ~/.ssh
touch ~/.ssh/authorized_keys && chmod 0600 ~/.ssh/authorized_keys
git init --bare ~/reponame.git

Git server is ready!

Pushing and Pulling from Local

On the LOCAL

cat ~/.ssh/id_rsa.pub

Add the above id_rsa.pub file content from LOCAL to below authorized_keys file ON THE SERVER

sudo nano /home/git/.ssh/authorized_keys

Create a LOCAL repo

cd /path/to/local/repo
git init .
git remote add origin git@SERVER_IP_ADDRESS:reponame.git
touch test_file
git add .
git commit -m "initial commit"
git push -u origin master
Categories
Containers

Setup Kubernetes on Mac

brew cask install virtualbox
brew install kubectl
brew install minikube
minikube start --vm-driver=virtualbox
😄  minikube v1.7.3 on Darwin 10.15.3
✨  Using the virtualbox driver based on user configuration
🔥  Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
🚀  Launching Kubernetes ... 
🌟  Enabling addons: default-storageclass, storage-provisioner
⌛  Waiting for cluster to come online ...
🏄  Done! kubectl is now configured to use "minikube"
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
kubectl expose deployment hello-minikube --type=NodePort --port=8080
kubectl get pod

The default login for Virtual Box minikube, username: “docker”, password: “tcuser”.

Categories
Database

Postgres backup restore command line

Backup

pg_dump -U DB_USER -W -F t DB_NAME > /path/to/file/dump_name.sql

Restore

Using psql

psql -U DB_USER DB_NAME < dump_name.sql

Using pg_restore

pg_restore -d DB_NAME /path/to/file/dump_name.sql -c -U DB_USER