2018年10月17日 星期三

using s3 as backend storage for docker registry

setenforce 0
systemctl stop firewalld

docker run -d -p 5000:5000 --restart=always --name registry -v /root/config.yml:/etc/docker/registry/config.yml -v /etc/hosts:/etc/hosts registry:2

docker exec -it 0ba1bdfc1491 cat /etc/docker/registry/config.yml

docker pull ubuntu:16.04
docker tag ubuntu:16.04 localhost:5000/my-ubuntu
docker push localhost:5000/my-ubuntu
docker image remove ubuntu:16.04
docker image remove localhost:5000/my-ubuntu
docker pull localhost:5000/my-ubuntu
docker container stop registry && docker container rm -v registry

config.yml

version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  s3:
    accesskey: GWHHQI5NSYBV1A756W32
    secretkey: TzDlHsn66miM9TddT85DoLqUuBBmJSzxbtTxW6sO
    region: default
    regionendpoint: http://docker.qct.io
    bucket: registry
    secure: false
    v4auth: true
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 30s
    threshold: 1

2018年10月5日 星期五

software raid on RHEL7.5

review disk layout
parted /dev/sdx u s p

raid creation process
1: create 2x type code 0xfd partitions

2: set raid flag to all partitions
parted /dev/sdx set 1 raid on

3: set boot flag to partition which serves for grub configuration files
parted /dev/sdx set 1 boot on

4: zero out superblock
mdadm --zero-superblock /dev/sdx[1-9]

5: create raid
mdadm --create /dev/md0 --name=root -n2 -l1 /dev/sda1 /dev/sdb1
mdadm --create /dev/md0 --name=root -n2 -l1 /dev/sda2 /dev/sdb2

6: delete raid
mdadm --delete /dev/md0
mdadm --zero-superblock /dev/sdx[1-9]
mdadm --stop /dev/md0

6: repair raid
mdadm --add /dev/md0 /dev/sda1

7:scan available md
mdadm --examine --scan
mdadm --examine /dev/sdx[1-9]

8: raid uuid - this information need to be included in /etc/default/grub
mdadm --detail /dev/md0|grep UUID
rd.md.uuid=xxxx

9: activate software raid
mdadm -A -R /dev/md0 /dev/sda1 /dev/sdb1

others:
don't forget to creating new initramfs
dracut -f --mdadmconf

to install grub2 on a drive. mdadm package needs to be installed first and grub needs to be installed to whole disk drive instead of partition. grub needs to be installed on both drives
grub2-install --no-floppy --boot-directory=/boot /dev/sda