Skip to content

Commit 87343f2

Browse files
authored
Merge pull request #27 from balinorLiang/feature/docker-cluster
cluster install & 4.6 release
2 parents 997d89c + 85b677f commit 87343f2

29 files changed

+1278
-10
lines changed

4/bookworm/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN mkdir /docker-entrypoint-initdb.d
2121

2222
# Set environment variables for IvorySQL
2323
ENV IVORY_MAJOR 4
24-
ENV IVORY_VERSION 4.5
24+
ENV IVORY_VERSION 4.6
2525
ARG USE_CHINA_MIRROR=false
2626

2727
# Use China mirror if specified
@@ -116,7 +116,7 @@ COPY --from=builder /var/local/ivorysql /var/local/ivorysql/
116116
COPY --from=builder /usr/local/bin/gosu /usr/local/bin/gosu
117117

118118
ENV IVORY_MAJOR 4
119-
ENV IVORY_VERSION 4.5
119+
ENV IVORY_VERSION 4.6
120120
ARG USE_CHINA_MIRROR=false
121121
RUN mkdir /docker-entrypoint-initdb.d
122122

4/trixie/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN mkdir /docker-entrypoint-initdb.d
2121

2222
# Set environment variables for IvorySQL
2323
ENV IVORY_MAJOR 4
24-
ENV IVORY_VERSION 4.5
24+
ENV IVORY_VERSION 4.6
2525
ARG USE_CHINA_MIRROR=false
2626

2727
# Use China mirror if specified
@@ -116,7 +116,7 @@ COPY --from=builder /var/local/ivorysql /var/local/ivorysql/
116116
COPY --from=builder /usr/local/bin/gosu /usr/local/bin/gosu
117117

118118
ENV IVORY_MAJOR 4
119-
ENV IVORY_VERSION 4.5
119+
ENV IVORY_VERSION 4.6
120120
ARG USE_CHINA_MIRROR=false
121121
RUN mkdir /docker-entrypoint-initdb.d
122122

4/ubi8/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN groupadd -g 1000 ivorysql; \
1919
RUN mkdir /docker-entrypoint-initdb.d
2020

2121
ENV IVORY_MAJOR 4
22-
ENV IVORY_VERSION 4.5
22+
ENV IVORY_VERSION 4.6
2323

2424
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo; \
2525
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
@@ -87,7 +87,7 @@ COPY --from=builder /var/local/ivorysql /var/local/ivorysql/
8787
COPY --from=builder /usr/local/bin/gosu /usr/local/bin/gosu
8888

8989
ENV IVORY_MAJOR 4
90-
ENV IVORY_VERSION 4.5
90+
ENV IVORY_VERSION 4.6
9191

9292
RUN mkdir /docker-entrypoint-initdb.d
9393

docker-cluster/Dockerfile

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
FROM redhat/ubi8:latest as builder
2+
3+
# explicitly set user/group IDs
4+
RUN groupadd -g 1000 ivorysql; \
5+
useradd -u 1000 -g ivorysql -d /var/local/ivorysql -s /bin/sh ivorysql; \
6+
mkdir -p /var/local/ivorysql; \
7+
mkdir -p /usr/src/ivorysql; \
8+
mkdir -p /var/lib/ivorysql; \
9+
chown -R ivorysql:ivorysql /var/local/ivorysql; \
10+
chown -R ivorysql:ivorysql /usr/src/ivorysql; \
11+
chown -R ivorysql:ivorysql /var/lib/ivorysql
12+
13+
RUN mkdir /docker-entrypoint-initdb.d
14+
# install ivorysql 4.6
15+
ENV IVORY_MAJOR 4
16+
ENV IVORY_VERSION 4.6
17+
18+
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo; \
19+
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
20+
21+
RUN mkdir -p /usr/src/ivorysql; \
22+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm; \
23+
dnf install -y epel-release;\
24+
dnf install -y \
25+
make \
26+
readline-devel \
27+
zlib-devel \
28+
openssl-devel \
29+
flex \
30+
wget \
31+
dpkg; \
32+
dnf groupinstall -y "Development Tools";\
33+
dnf install -y \
34+
llvm-toolset llvm-devel lz4 lz4-devel lz4-libs clang-devel \
35+
krb5-devel libselinux-devel libxml2-devel cyrus-sasl-gssapi \
36+
libicu-devel e2fsprogs-devel selinux-policy systemd-devel \
37+
libxslt-devel openldap-devel openssl-devel pam-devel \
38+
libuuid-devel python3-devel readline-devel tcl-devel zlib-devel \
39+
perl perl-devel perl-ExtUtils-Embed;\
40+
dnf install -y --enablerepo=*ower*ools perl-IPC-Run perl-Time-HiRes perl-Test-Simple uuid-devel;\
41+
wget -O ivorysql.tar.gz "https://github.com/IvorySQL/IvorySQL/archive/refs/tags/IvorySQL_$IVORY_VERSION.tar.gz"; \
42+
tar \
43+
--extract \
44+
--file ivorysql.tar.gz \
45+
--directory /usr/src/ivorysql \
46+
--strip-components 1 \
47+
; \
48+
rm ivorysql.tar.gz; \
49+
cd /usr/src/ivorysql; \
50+
wget https://repo.almalinux.org/almalinux/8/PowerTools/$(arch)/os/Packages/bison-devel-3.0.4-10.el8.$(arch).rpm; \
51+
dnf install -y bison-devel-3.0.4-10.el8.$(arch).rpm; \
52+
wget https://repo.almalinux.org/almalinux/8/AppStream/$(arch)/os/Packages/bison-3.0.4-10.el8.$(arch).rpm; \
53+
dnf install -y bison-3.0.4-10.el8.$(arch).rpm; \
54+
./configure \
55+
--prefix=/var/local/ivorysql/ivorysql-$IVORY_MAJOR \
56+
--enable-cassert --enable-debug --enable-rpath --with-tcl \
57+
--with-python --with-gssapi --with-pam --with-ldap \
58+
--with-openssl --with-libedit-preferred --with-uuid=e2fs \
59+
--with-ossp-uuid --with-libxml --with-libxslt --with-perl \
60+
--with-icu \
61+
; \
62+
make && make install; \
63+
rm -rf \
64+
/usr/src/ivorysql \
65+
/usr/local/share/doc \
66+
/usr/local/share/man
67+
68+
FROM redhat/ubi8:latest
69+
70+
RUN useradd -u 1000 ivorysql
71+
72+
COPY --from=builder --chown=ivorysql:ivorysql /var/local/ivorysql /var/local/ivorysql/
73+
74+
ENV IVORY_MAJOR 4
75+
ENV IVORY_VERSION 4.6
76+
77+
RUN dnf install -y \
78+
lz4 lz4-devel lz4-libs krb5-devel libxslt-devel libicu-devel && dnf -y clean all
79+
80+
#install patroni 4.0.6
81+
env PATRONI_VER 4.0.6
82+
83+
RUN dnf -y install --nodocs \
84+
--setopt=skip_missing_names_on_install=False \
85+
python3-pip \
86+
python3-psutil \
87+
python3-psycopg2 \
88+
&& dnf -y clean all
89+
90+
RUN pip3 install --upgrade python-dateutil \
91+
&& pip3 install patroni[etcd]=="${PATRONI_VER}"
92+
93+
ENV PGDATA /var/local/ivorysql/ivorysql-$IVORY_MAJOR/data
94+
ENV PATRONICONF /var/local/ivorysql/ivorysql-$IVORY_MAJOR/patroni
95+
# this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
96+
RUN mkdir -p "$PGDATA" && chown -R ivorysql:ivorysql "$PGDATA" && chmod 750 "$PGDATA"
97+
RUN mkdir -p "$PATRONICONF" && chown -R ivorysql:ivorysql "$PATRONICONF" && chmod 1777 "$PATRONICONF"
98+
99+
COPY docker-entrypoint.sh /
100+
RUN chmod +x docker-entrypoint.sh
101+
102+
VOLUME $PGDATA $PATRONICONF
103+
104+
ENV PATH $PATH:/var/local/ivorysql/ivorysql-$IVORY_MAJOR/bin
105+
106+
EXPOSE 5432 5866 1521
107+
108+
USER ivorysql
109+
110+
ENTRYPOINT ["/bin/sh", "/docker-entrypoint.sh"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
etcd:
3+
image: quay.io/coreos/etcd:v3.5.8
4+
container_name: etcd
5+
environment:
6+
- ETCD_NAME=etcd1
7+
- ETCD_DATA_DIR=/etcd-data
8+
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://<cluster1_ip>:2380
9+
- ETCD_ADVERTISE_CLIENT_URLS=http://<cluster1_ip>:2379
10+
- ETCD_LISTEN_PEER_URLS=http://<cluster1_ip>:2380
11+
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
12+
- ETCD_INITIAL_CLUSTER=etcd1=http://<cluster1_ip>:2380,etcd2=http://<cluster2_ip>:2380,etcd3=http://<cluster3_ip>:2380
13+
- ETCD_INITIAL_CLUSTER_STATE=new
14+
- ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
15+
network_mode: host
16+
volumes:
17+
- /home/ivorysql/etcd:/etcd-data
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
etcd:
3+
image: quay.io/coreos/etcd:v3.5.8
4+
container_name: etcd
5+
environment:
6+
- ETCD_NAME=etcd2
7+
- ETCD_DATA_DIR=/etcd-data
8+
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://<cluster2_ip>:2380
9+
- ETCD_ADVERTISE_CLIENT_URLS=http://<cluster2_ip>:2379
10+
- ETCD_LISTEN_PEER_URLS=http://<cluster2_ip>:2380
11+
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
12+
- ETCD_INITIAL_CLUSTER=etcd1=http://<cluster1_ip>:2380,etcd2=http://<cluster2_ip>:2380,etcd3=http://<cluster3_ip>:2380
13+
- ETCD_INITIAL_CLUSTER_STATE=new
14+
- ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
15+
network_mode: host
16+
volumes:
17+
- /home/ivorysql/etcd:/etcd-data
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
etcd:
3+
image: quay.io/coreos/etcd:v3.5.8
4+
container_name: etcd
5+
environment:
6+
- ETCD_NAME=etcd3
7+
- ETCD_DATA_DIR=/etcd-data
8+
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://<cluster3_ip>:2380
9+
- ETCD_ADVERTISE_CLIENT_URLS=http://<cluster3_ip>:2379
10+
- ETCD_LISTEN_PEER_URLS=http://<cluster3_ip>:2380
11+
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
12+
- ETCD_INITIAL_CLUSTER=etcd1=http://<cluster1_ip>:2380,etcd2=http://<cluster2_ip>:2380,etcd3=http://<cluster3_ip>:2380
13+
- ETCD_INITIAL_CLUSTER_STATE=new
14+
- ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster
15+
network_mode: host
16+
volumes:
17+
- /home/ivorysql/etcd:/etcd-data
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
ivypatroni1:
3+
image: ivorysql/docker-compose-ha-cluster:4.6-4.0.6-ubi8
4+
restart: always
5+
container_name: ivyhac1
6+
user: "ivorysql"
7+
environment:
8+
PATRONI_SCOPE: ivory-cluster
9+
ETCD_HOSTS: <cluster1_ip>:2379,<cluster2_ip>:2379,<cluster3_ip>:2379
10+
IVORYSQL_PASSWORD: 123456
11+
IVORYSQL_HOST_AUTH_METHOD: md5
12+
PATRONI_SERVICE_NAME: ivypatroni1
13+
IVORYSQL_HOST: <cluster1_ip>
14+
network_mode: host
15+
volumes:
16+
- /home/ivorysql/patroni:/var/local/ivorysql/ivorysql-4/patroni/
17+
- /home/ivorysql/ivydata:/var/local/ivorysql/ivorysql-4/data/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
ivypatroni2:
3+
image: ivorysql/docker-compose-ha-cluster:4.6-4.0.6-ubi8
4+
restart: always
5+
container_name: ivyhac2
6+
user: "ivorysql"
7+
environment:
8+
PATRONI_SCOPE: ivory-cluster
9+
ETCD_HOSTS: <cluster1_ip>:2379,<cluster2_ip>:2379,<cluster3_ip>:2379
10+
IVORYSQL_PASSWORD: 123456
11+
IVORYSQL_HOST_AUTH_METHOD: md5
12+
PATRONI_SERVICE_NAME: ivypatroni2
13+
IVORYSQL_HOST: <cluster2_ip>
14+
network_mode: host
15+
volumes:
16+
- /home/ivorysql/patroni:/var/local/ivorysql/ivorysql-4/patroni/
17+
- /home/ivorysql/ivydata:/var/local/ivorysql/ivorysql-4/data/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
ivypatroni3:
3+
image: ivorysql/docker-compose-ha-cluster:4.6-4.0.6-ubi8
4+
restart: always
5+
container_name: ivyhac3
6+
user: "ivorysql"
7+
environment:
8+
PATRONI_SCOPE: ivory-cluster
9+
ETCD_HOSTS: <cluster1_ip>:2379,<cluster2_ip>:2379,<cluster3_ip>:2379
10+
IVORYSQL_PASSWORD: 123456
11+
IVORYSQL_HOST_AUTH_METHOD: md5
12+
PATRONI_SERVICE_NAME: ivypatroni3
13+
IVORYSQL_HOST: <cluster3_ip>
14+
network_mode: host
15+
volumes:
16+
- /home/ivorysql/patroni:/var/local/ivorysql/ivorysql-4/patroni/
17+
- /home/ivorysql/ivydata:/var/local/ivorysql/ivorysql-4/data/

0 commit comments

Comments
 (0)