-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update postgres #11
Open
jacobbmay
wants to merge
13
commits into
main
Choose a base branch
from
updatePostgres
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update postgres #11
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fbce1a2
Update to support ha postgres with NDB
jacobbmay 9c03b71
remove ctest from geos build
jacobbmay 9a60d17
ensure epel gpg key is imported
jacobbmay 2b7f1cc
Run entire postgres install as root
jacobbmay f911a3f
Remove timeout on postgres install script
jacobbmay 0c42e3d
Ensure /usr/local/bin is on path during build
jacobbmay 6c0ff20
missing dependencies
jacobbmay 139bee6
missing dependencies
jacobbmay 9bcec96
Update install steps
jacobbmay dd7020e
Updates for NDB
jacobbmay e47514c
Enable kernel watchdog service for patroni
jacobbmay 3d76e46
Add stuff to workaround SELinux issues with NDB
jacobbmay 9c79a10
Remove relabeling from packer build
jacobbmay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<service> | ||
<short>HAProxy-HTTP</short> | ||
<description>HAProxy load-balancer</description> | ||
<port protocol="tcp" port="80"/> | ||
</service> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<service> | ||
<short>HAProxy-HTTPS</short> | ||
<description>HAProxy load-balancer</description> | ||
<port protocol="tcp" port="443"/> | ||
</service> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Documentation=man:postgres(1) | ||
After=network-online.target | ||
Wants=network-online.target | ||
|
||
[Service] | ||
Type=notify | ||
User=postgres | ||
|
||
# Disable OOM kill | ||
OOMScoreAdjust=-1000 | ||
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj | ||
Environment=PG_OOM_ADJUST_VALUE=0 | ||
|
||
ExecStart=/usr/local/pgsql/bin/postgres -D /var/lib/pgsql/data | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
KillMode=mixed | ||
KillSignal=SIGINT | ||
TimeoutSec=infinity | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,77 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
wget https://apt.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL | ||
sudo rpm --import PGDG-RPM-GPG-KEY-RHEL | ||
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm | ||
sudo dnf -qy module disable postgresql | ||
sudo dnf install -y postgresql${POSTGRES_VERSION}-server | ||
sudo rpm --import http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8 | ||
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm | ||
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms | ||
sudo dnf install -y ${POSTGIS_VERSION} | ||
export PATH=$PATH:/usr/local/bin | ||
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms | ||
rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8 | ||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm | ||
dnf groupinstall -y "Development Tools" | ||
dnf install -y zlib-devel readline-devel libicu-devel systemd-devel cmake libxml2-devel proj-devel gdal-devel protobuf-devel protobuf-c-devel json-c-devel | ||
|
||
dnf -qy module disable postgresql | ||
|
||
wget https://ftp.postgresql.org/pub/source/v${POSTGRES_VERSION}/postgresql-${POSTGRES_VERSION}.tar.bz2 | ||
|
||
tar -xvf postgresql-${POSTGRES_VERSION}.tar.bz2 | ||
cd postgresql-${POSTGRES_VERSION}/ | ||
ls -l | ||
|
||
./configure --with-systemd | ||
make | ||
make install | ||
useradd postgres | ||
useradd etcd | ||
cd | ||
|
||
# Install postgis | ||
## Install GEOS from source | ||
wget https://download.osgeo.org/geos/geos-3.13.0.tar.bz2 | ||
# Unpack and setup build directory | ||
tar xvfj geos-3.13.0.tar.bz2 | ||
cd geos-3.13.0 | ||
mkdir _build | ||
cd _build | ||
# Set up the build | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/local \ | ||
.. | ||
# Run the build, test, install | ||
make | ||
make install | ||
cd | ||
|
||
## Install postgis from source | ||
wget https://postgis.net/stuff/postgis-${POSTGIS_VERSION}.tar.gz | ||
tar -xvzf postgis-${POSTGIS_VERSION}.tar.gz | ||
cd postgis-${POSTGIS_VERSION} | ||
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config | ||
make | ||
make install | ||
cd | ||
|
||
# Install HA postgres deps | ||
|
||
dnf install -y python3-devel python3-psycopg2 haproxy keepalived | ||
wget https://github.com/etcd-io/etcd/releases/download/v3.5.16/etcd-v3.5.16-linux-amd64.tar.gz | ||
tar xzvf etcd-v3.5.16-linux-amd64.tar.gz | ||
cp etcd-v3.5.16-linux-amd64/etcd* /usr/bin/. | ||
|
||
sudo pip3 install --force-reinstall -v "patroni[etcd]==3.2.2" | ||
|
||
# Move files | ||
|
||
# Copy the postgres systemd service into the correct location for NDB | ||
cp /tmp/files/postgres.service /etc/systemd/system/era_postgres.service | ||
cp /tmp/files/haproxy* /etc/firewalld/services/. | ||
cd /etc/firewalld/services | ||
restorecon haproxy-http.xml | ||
restorecon haproxy-https.xml | ||
chmod 640 haproxy* | ||
|
||
# Set up watchdog | ||
modprobe softdog | ||
chown postgres /dev/watchdog | ||
|
||
# Turn off pwquality enforcement. NDB can have issues creating new DBs from a profile caused by not being able to update the NDB user password | ||
echo "enforcing = 0" >> /etc/security/pwquality.conf | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a newline :D