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
Categories
Containers

Login to Docker daemon in Mac

screen /dev/ttys000
__  __

Welcome to LinuxKit

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""__/ ===
          {                       /  ===-
           _____ O           __/
                        __/
              _________/

docker-desktop:~# 
Categories
Command Line

Plesk basic commands

Create customer

/usr/local/psa/bin/customer --create USERNAME -passwd PASSWORD -name USERNAME

Create user

plesk bin user --create EMAIL -owner USERNAME -passwd PASSWORD -cname USERNAME -role ROLE

The role could be owner or webmaster or …

Create subscription

plesk bin subscription --create example.com -owner USERNAME -service-plan "Default Domain" -ip xx.xx.xx.xx -login USERNAME -passwd "PASSWORD"