Skip to content

Commit

Permalink
update default configuration templates and document
Browse files Browse the repository at this point in the history
  • Loading branch information
Vonng committed May 19, 2021
1 parent 468c1e1 commit cc86621
Show file tree
Hide file tree
Showing 10 changed files with 1,741 additions and 66 deletions.
41 changes: 23 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ c: configure
conf:
./configure --ip ${IP} --mode ${MODE} --download

# use default demo (1 node) config template
demo:
./configure --ip 10.10.10.10 --mode demo

# use full demo (4 node) config template
demo4:
./configure --ip 10.10.10.10 --mode demo4

###############################################################


Expand Down Expand Up @@ -325,7 +317,7 @@ pg-db:
# (1). make deps (once) Install MacOS deps with homebrew
# (2). make dns (once) Write static DNS
# (3). make start (once) Pull-up vm nodes and setup ssh access
# (4). make meta Boot meta node same as Quick-Start
# (4). make demo Boot meta node same as Quick-Start
#=============================================================#

#------------------------------#
Expand Down Expand Up @@ -354,19 +346,21 @@ ssh: # add node ssh config to your ~/.ssh/config
bin/ssh

#------------------------------#
# meta
# demo
#------------------------------#
# tips: (make fetch & make upload will accelerate next vm bootstrap)

# ssh meta and run standard install procedure same as Quick-Start
meta:
demo:
ssh meta '/home/vagrant/pigsty/configure --ip 10.10.10.10 -m demo --non-interactive --download'
ssh meta 'cd /home/vagrant/pigsty; make install'
ssh meta 'cd ~/pigsty; make install'

# 4-node version
meta4:
demo4:
ssh meta '/home/vagrant/pigsty/configure --ip 10.10.10.10 -m demo4 --non-interactive --download'
ssh meta 'cd /home/vagrant/pigsty; make install'
ssh meta 'cd ~/pigsty; make install'
ssh meta 'cd ~/pigsty; ./pgsql.yml -l pg-test'


#==============================================================#
# VM Management #
Expand Down Expand Up @@ -407,7 +401,7 @@ dw4:
cd vagrant && vagrant halt
del4:
cd vagrant && vagrant destroy -f
new4: del up
new4: del4 up4
s4: # sync time
echo meta node-1 node-2 node-3 | xargs -n1 -P4 -I{} ssh {} 'sudo ntpdate -u pool.ntp.org'; true

Expand Down Expand Up @@ -576,6 +570,17 @@ publish-beta:
svg:
bin/play_svg

# make cache from meta node and put into release dir
release-pkg:
mkdir -p files/release/v${VERSION}/
ssh meta '~/pigsty/bin/cache'
scp meta:/tmp/pkg.tgz files/release/v${VERSION}/pkg.tgz

# make pkg cache from meta node
cache-pkg:
ssh meta '~/pigsty/bin/cache'
scp meta:/tmp/pkg.tgz files/pkg.tgz

###############################################################


Expand All @@ -595,13 +600,13 @@ svg:
pgsql-business pgsql-monitor pgsql-service pgsql-promtail \
node-remove dcs-remove pgsql-remove \
pg-user pg-db \
deps dns start start4 ssh fetch upload \
deps dns start start4 ssh \
up dw del new s up-test dw-test del-test new-test s-test \
up4 dw4 del4 new4 s4 \
st status suspend resume \
rl ri rw ro rw2 ro2 r1 r2 r3 \
copy copy-all copy-src copy-pro copy-pkg copy-ui copy-fui copy-cf \
fetch upload copy copy-all copy-src copy-pro copy-pkg copy-ui copy-fui copy-cf \
r release p publish pb publish-beta \
svg
svg release-pkg cache-pkg

###############################################################
40 changes: 13 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,27 @@ Check [**OFFICIAL SITE**](https://pigsty.cc/en/ ) for more information:[**htt
>
> The final 1.0 GA version will be released near June~July 2021


## Quick Start

Prepare a CentOS 7.x meta node with root or sudo access.
Run on a fresh CentOS 7 node to install pigsty (user must have nopass sudo privilege)

```bash
curl -fsSL https://pigsty.cc/pigsty.tgz | gzip -d | tar -xC ~; cd ~/pigsty # DOWNLOAD
./configure # CONFIGURE (interactive wizard)
make config # CONFIGURE (interactive wizard)
make install # INSTALL infrasturcture on meta node
```

And you will have everything ready. Check documentation for more information.
Run on your **Mac** to get CentOS 7.8 nodes on your laptop (Pigsty Demo Env),

```bash
make deps # Install MacOS deps with homebrew
make dns # Write static DNS
make start # Pull-up vm nodes and setup ssh access (start4 for 4-node demo)
make demo # install pigsty on 'meta' as above (demo4 for 4-node demo)
```


## Highlights

Expand All @@ -38,30 +48,6 @@ And you will have everything ready. Check documentation for more information.



## Get Node

Consider running pigsty sandbox demo with virtualbox & vagrant.

<details>
<summary>Run pigsty on your laptop</summary>

> The easiest way to get a node is using cloud-services. But if you wish to run pigsty on your laptop. You can either create CentOS 7.8 vm nodes with software such as vmware, parallel desktop, virtualbox manually. Or just leave it to [vagrant](https://github.com/Vonng/pigsty/blob/master/vagrant/Vagrantfile). For MacOS users, these makefile shortcuts will setup a vm node (ip: 10.10.10.10) on your Mac host using [virtualbox](https://www.virtualbox.org/wiki/Downloads). After that everything is same as [Quick Start](#quick-start).
>
> ```bash
> cd /tmp && git clone [email protected]:Vonng/pigsty.git && cd pigsty
> make deps # Install MacOS deps with homebrew: vagrant virtualbox ansible
> make download # Download packages to files/release/v*.*/{pkg,pigsty}.tgz
> make start # launch vagrant vm nodes based on vagrant/Vagrantfile
> make dns # write static DNS record to your host (sudo required)
> make copy # copy pigsty resource to vagrant meta vm node
> ```
>
> Verified Environment:: MacOS 11, Vagrant 2.2.14, Virtualbox 6.1.16
</details>
## Features

### Monitoring
Expand Down
6 changes: 3 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function can_nopass_ssh(){
local current_user=$(whoami)
local user=${1-${current_user}}
local ipaddr=${2-'127.0.0.1'}
if ssh -o "StrictHostKeyChecking no" ${user}@${ipaddr} 'ls' 1>/dev/null 2>/dev/null; then
if ssh -oBatchMode=yes -o "StrictHostKeyChecking no" ${user}@${ipaddr} 'ls' 1>/dev/null 2>/dev/null; then
return 0
else
return 1
Expand Down Expand Up @@ -234,13 +234,13 @@ function check_ipaddr(){
fi

local ipCount=$(get_ip_count)
if ((ipCount<=1)); then
if ((ipCount<1)); then
log_error "primary_ip = probe failed"
exit 8
fi
if ((ipCount==1)); then
log_info "primary_ip = $(hostname --all-ip-addresses) (from probe)"
PRIMARY_IP=$(hostname --all-ip-addresses)
PRIMARY_IP=$(hostname --all-ip-addresses | egrep -o '(([0-9]|[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])')
return 0
fi

Expand Down
8 changes: 4 additions & 4 deletions templates/config/pigsty-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ all: # top-level namespace

- name: grafana
description: Grafana
enabled: no
enabled: yes
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm # tuna mirror
- https://packages.grafana.com/oss/rpm # official

- name: grafana-beta
description: Grafana Beta
enabled: yes
enabled: no
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm-beta/ # tuna mirror
Expand Down Expand Up @@ -237,8 +237,8 @@ all: # top-level namespace
enabled: no
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # tuna
- https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-$releasever-$basearch # official
- https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # tuna
- https://download.postgresql.org/pub/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # official

- name: centos-sclo
description: CentOS-$releasever - SCLo
Expand Down
8 changes: 4 additions & 4 deletions templates/config/pigsty-demo4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ all: # top-level namespace

- name: grafana
description: Grafana
enabled: no
enabled: yes
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm # tuna mirror
- https://packages.grafana.com/oss/rpm # official

- name: grafana-beta
description: Grafana Beta
enabled: yes
enabled: no
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm-beta/ # tuna mirror
Expand Down Expand Up @@ -298,8 +298,8 @@ all: # top-level namespace
enabled: no
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # tuna
- https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-$releasever-$basearch # official
- https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # tuna
- https://download.postgresql.org/pub/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # official

- name: centos-sclo
description: CentOS-$releasever - SCLo
Expand Down
6 changes: 3 additions & 3 deletions templates/config/pigsty-oltp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ all: # top-level namespace

- name: grafana
description: Grafana
enabled: no
enabled: yes
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm # tuna mirror
- https://packages.grafana.com/oss/rpm # official

- name: grafana-beta
description: Grafana Beta
enabled: yes
enabled: no
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm-beta/ # tuna mirror
Expand Down Expand Up @@ -205,7 +205,7 @@ all: # top-level namespace
gpgcheck: no
baseurl:
- https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # tuna
- https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-$releasever-$basearch # official
- https://download.postgresql.org/pub/repos/yum/testing/14/redhat/rhel-$releasever-$basearch # official

- name: centos-sclo
description: CentOS-$releasever - SCLo
Expand Down
Loading

0 comments on commit cc86621

Please sign in to comment.