update
continuous-integration/drone Build is passing
Details
continuous-integration/drone Build is passing
Details
commit
ccdfb85fb6
@ -0,0 +1,18 @@
|
|||||||
|
#https://github.com/tangyibo/greenplum_docker
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
os: linux
|
||||||
|
steps:
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker:19.03.8
|
||||||
|
environment:
|
||||||
|
PLUGIN_REGISTRY: 10.10.14.176:5000
|
||||||
|
PLUGIN_REPO: 10.10.14.176:5000/docker/greenplum
|
||||||
|
settings:
|
||||||
|
insecure: true
|
||||||
|
tags:
|
||||||
|
- 6.16.2
|
||||||
|
- ${DRONE_COMMIT_SHA:0:8}
|
@ -0,0 +1,3 @@
|
|||||||
|
.vscode
|
||||||
|
log
|
||||||
|
data
|
@ -0,0 +1,25 @@
|
|||||||
|
FROM centos:centos7
|
||||||
|
ENV GPDBVER=6.16.2 \
|
||||||
|
DATADIR=/data
|
||||||
|
|
||||||
|
COPY install.sh /tmp/install.sh
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
COPY open-source-greenplum-db-6.16.2-rhel7-x86_64.rpm /
|
||||||
|
|
||||||
|
RUN yum -y install passwd openssl openssh-server openssh-clients &&\
|
||||||
|
mkdir /var/run/sshd/ &&\
|
||||||
|
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' && \
|
||||||
|
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' && \
|
||||||
|
ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key && \
|
||||||
|
echo -e '#!/bin/bash\n/usr/sbin/sshd -D &' > /var/run/sshd/sshd_start.sh && \
|
||||||
|
chmod u+x /var/run/sshd/sshd_start.sh
|
||||||
|
|
||||||
|
RUN /var/run/sshd/sshd_start.sh && \
|
||||||
|
sleep 10s && cd /tmp && sh install.sh && \
|
||||||
|
rm -rf /tmp/install.sh && rm -rf /tmp/files
|
||||||
|
|
||||||
|
EXPOSE 5432 22
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
CMD [ "sh" , "/entrypoint.sh"]
|
@ -0,0 +1,2 @@
|
|||||||
|
docker build --progress=plain -t 76527413/greenplum:6.16.2 .
|
||||||
|
docker push 76527413/greenplum:6.16.2
|
@ -0,0 +1,9 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
dev:
|
||||||
|
image: 76527413/greenplum:6.16.2
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
/var/run/sshd/sshd_start.sh && sleep 5s
|
||||||
|
|
||||||
|
if [ "$(ls -A $DATADIR)" = "" ]; then
|
||||||
|
|
||||||
|
mkdir -p $DATADIR/master
|
||||||
|
mkdir -p $DATADIR/primary
|
||||||
|
chown -R gpadmin:gpadmin $DATADIR
|
||||||
|
|
||||||
|
su - gpadmin -l -c "echo -e 'source /usr/local/greenplum-db/greenplum_path.sh' >> ~/.bashrc"
|
||||||
|
su - gpadmin -l -c "echo -e 'export MASTER_DATA_DIRECTORY=$DATADIR/master/gpseg-1/' >> ~/.bashrc"
|
||||||
|
su - gpadmin -l -c "echo -e 'export PGPORT=5432' >> ~/.bashrc"
|
||||||
|
su - gpadmin -l -c "echo -e 'export PGUSER=gpadmin' >> ~/.bashrc"
|
||||||
|
su - gpadmin -l -c "echo -e 'export PGDATABASE=postgres' >> ~/.bashrc"
|
||||||
|
|
||||||
|
su - gpadmin -l -c "source ~/.bashrc;gpinitsystem -a --ignore-warnings -c /home/gpadmin/gpinitsystem_config_singlenode -h /home/gpadmin/gp_hosts_list"
|
||||||
|
su - gpadmin -l -c "source ~/.bashrc;psql -d postgres -U gpadmin -f /home/gpadmin/initdb_gpdb.sql"
|
||||||
|
su - gpadmin -l -c "source ~/.bashrc;gpconfig -c log_statement -v none"
|
||||||
|
su - gpadmin -l -c "source ~/.bashrc;gpconfig -c gp_enable_global_deadlock_detector -v on"
|
||||||
|
su - gpadmin -l -c "echo \"host all all 0.0.0.0/0 password\" >> $DATADIR/master/gpseg-1/pg_hba.conf"
|
||||||
|
su - gpadmin -l -c "source ~/.bashrc && sleep 5s && gpstop -u && tail -f gpAdminLogs/*.log"
|
||||||
|
else
|
||||||
|
su - gpadmin -l -c "source ~/.bashrc && gpstart -a && tail -f gpAdminLogs/*.log"
|
||||||
|
fi
|
@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#https://gitee.com/inrgihc/greenplum_docker/tree/main
|
||||||
|
|
||||||
|
PASSWORD=gpadmin
|
||||||
|
|
||||||
|
ERROR_MSG="[ERROR] "
|
||||||
|
INFO_MSG="[INFO] "
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
TIME=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
|
echo "$TIME $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function package_install() {
|
||||||
|
log "$INFO_MSG check command package : [ $1 ]"
|
||||||
|
if ! rpm -qa | grep -q "^$1"; then
|
||||||
|
yum install -y $1
|
||||||
|
package_check_ok
|
||||||
|
else
|
||||||
|
log "$INFO_MSG command [ $1 ] already installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function package_check_ok() {
|
||||||
|
ret=$?
|
||||||
|
if [ $ret != 0 ]; then
|
||||||
|
log "$ERROR_MSG Install failed, error code is $ret, Check the error log."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gpdb_install(){
|
||||||
|
log "$INFO_MSG Start to install greenplum for single node."
|
||||||
|
|
||||||
|
package=(epel-release wget)
|
||||||
|
for p in ${package[@]}; do
|
||||||
|
package_install $p
|
||||||
|
done
|
||||||
|
|
||||||
|
/usr/sbin/groupadd gpadmin
|
||||||
|
/usr/sbin/useradd gpadmin -g gpadmin
|
||||||
|
usermod -G gpadmin gpadmin
|
||||||
|
echo "${PASSWORD}" | passwd --stdin gpadmin
|
||||||
|
|
||||||
|
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||||
|
sed -i -r 's/^.*StrictHostKeyChecking\s+\w+/StrictHostKeyChecking no/' /etc/ssh/ssh_config
|
||||||
|
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
|
||||||
|
systemctl restart sshd
|
||||||
|
|
||||||
|
su gpadmin -l -c "ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -P \"\""
|
||||||
|
su gpadmin -l -c "cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys"
|
||||||
|
su gpadmin -l -c "chmod 600 ~/.ssh/authorized_keys" && \
|
||||||
|
su gpadmin -l -c "ssh-keyscan -H localhost 2>/dev/null | grep rsa | awk '{print \"localhost \" \$2 \" \" \$3 }' >> ~/.ssh/known_hosts"
|
||||||
|
|
||||||
|
#wget "https://github.com.cnpmjs.org/greenplum-db/gpdb/releases/download/$GPDBVER/open-source-greenplum-db-$GPDBVER-rhel7-x86_64.rpm"
|
||||||
|
yum install -y "/open-source-greenplum-db-$GPDBVER-rhel7-x86_64.rpm"
|
||||||
|
rm -rf "/open-source-greenplum-db-$GPDBVER-rhel7-x86_64.rpm"
|
||||||
|
|
||||||
|
rm -f /home/gpadmin/gpinitsystem_config_singlenode
|
||||||
|
cat > /home/gpadmin/gpinitsystem_config_singlenode << EOF
|
||||||
|
ARRAY_NAME="Greenplum Data Platform"
|
||||||
|
SEG_PREFIX=gpseg
|
||||||
|
PORT_BASE=6000
|
||||||
|
declare -a DATA_DIRECTORY=($DATADIR/primary $DATADIR/primary $DATADIR/primary $DATADIR/primary)
|
||||||
|
MASTER_HOSTNAME=localhost
|
||||||
|
MASTER_DIRECTORY=$DATADIR/master
|
||||||
|
MASTER_PORT=5432
|
||||||
|
TRUSTED_SHELL=ssh
|
||||||
|
CHECK_POINT_SEGMENTS=8
|
||||||
|
ENCODING=UNICODE
|
||||||
|
EOF
|
||||||
|
cat > /home/gpadmin/gp_hosts_list << EOF
|
||||||
|
localhost
|
||||||
|
EOF
|
||||||
|
cat > /home/gpadmin/initdb_gpdb.sql << EOF
|
||||||
|
ALTER ROLE "gpadmin" WITH PASSWORD '$PASSWORD';
|
||||||
|
EOF
|
||||||
|
chown -R gpadmin:gpadmin /home/gpadmin
|
||||||
|
|
||||||
|
log "$INFO_MSG Install single node Greenplum cluster success!"
|
||||||
|
}
|
||||||
|
|
||||||
|
gpdb_install
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
docker-compose build --no-cache && docker-compose up --remove-orphans --force-recreate -d
|
@ -0,0 +1 @@
|
|||||||
|
docker-compose down --remove-orphans
|
Loading…
Reference in new issue