2024年6月14日星期五

git show latest commited files list

cpath=$(pwd)
cd $git_project_path
# show latest commited files, name-only and oneline
git show --name-only --oneline HEAD > $cpath/head.log

cd $cpath


2024年6月8日星期六

postgres verup 13.4 to 14.11

Postgres  running in Docker container
--------------------------------------------

#shell
olddb=postgres1340
newdb=postgres-new-14.11

#backup old db data
docker exec -t $olddb pg_dumpall -c -U postgres > ./backup/all_db_backup.sql

#stop old db
docker stop $olddb 

#restore data to newdb
cat ./backup/all_db_backup.sql | docker exec -i $newdb psql -U postgres | tee  restore.log


Can't connect to new PostgresDB after verup
------------------------------------------------------

check /var/lib/postgresql/data/pg_hba.conf ,add :
# Allow all IPv4 connections
host all all 0.0.0.0/0 md5



2024年6月4日星期二

NGINX + OAuth2-proxy + gitlab provide Authentication for all web applications behind the NGINX

Prerequisites:

1. All Installed in an AWS EC2 docker host.

2. install the next tools

 2.1. docker, docker-comose
 2.2. nginx-docker-compose.yaml 

version: '3.8'
services:
  nginx:
    image: nginx:latest
    ports:
    - "80:80"     # for http
    - "443:443" # for https. create and update by letsencrypt.
    volumes:
    - ./nginx.conf:/etc/nginx/nginx.conf  # for update from host 
    - ./certs:/etc/nginx/certs                  # for update from host by letsencrypt.

 2.2. nginx-conf