launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31905
[Merge] ~lgp171188/launchpad:rocketfuel-setup-fixes-postgres-14 into launchpad:master
Guruprasad has proposed merging ~lgp171188/launchpad:rocketfuel-setup-fixes-postgres-14 into launchpad:master.
Commit message:
Implement the changes needed to run PostgreSQL 14 in the dev environment
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/477225
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:rocketfuel-setup-fixes-postgres-14 into launchpad:master.
diff --git a/utilities/launchpad-database-setup b/utilities/launchpad-database-setup
index b3cae18..e7f0266 100755
--- a/utilities/launchpad-database-setup
+++ b/utilities/launchpad-database-setup
@@ -24,7 +24,7 @@ pgversion=
# This loop contains multiple versions when we are in the process of
# migrating between PostgreSQL versions.
# shellcheck disable=SC2043
-for try_pgversion in 10 12
+for try_pgversion in 14 16
do
if sudo grep -qs "^auto" /etc/postgresql/$try_pgversion/main/start.conf; then
pgversion="$try_pgversion"
@@ -101,7 +101,7 @@ echo Waiting 10 seconds for postgresql to come up...
sleep 10
echo "Creating postgresql user $USER"
-sudo -u postgres /usr/lib/postgresql/$pgversion/bin/createuser -a -d "$USER"
+sudo -u postgres /usr/lib/postgresql/$pgversion/bin/createuser -s -d "$USER"
echo
echo Looks like everything went ok.
diff --git a/utilities/rocketfuel-setup b/utilities/rocketfuel-setup
index 8edae82..242286d 100755
--- a/utilities/rocketfuel-setup
+++ b/utilities/rocketfuel-setup
@@ -7,15 +7,10 @@
# workstation, from scratch. The script lives in the LP codebase itself,
# as utilities/rocketfuel-setup
-# load up Ubuntu release details so we know which repos to enable
-DISTRIB_CODENAME="$(sed -n 's/^DISTRIB_CODENAME=//p' /etc/lsb-release | tr -d '"')"
-if [ -z "$DISTRIB_CODENAME" ]; then
- echo "Cannot find DISTRIB_CODENAME in /etc/lsb-release" >&2
- exit 1
-fi
DO_WORKSPACE=1
+INSTALL_POSTGRES_14=0
INSTALL_OPTS=""
-getopt_output="$(getopt -o '' -l no-workspace,lpusername:,assume-yes -- "$@")" || exit 1
+getopt_output="$(getopt -o '' -l no-workspace,postgres14,lpusername:,assume-yes -- "$@")" || exit 1
eval set -- "$getopt_output"
while :; do
case $1 in
@@ -23,6 +18,10 @@ while :; do
DO_WORKSPACE=0
shift
;;
+ --postgres14)
+ INSTALL_POSTGRES_14=1
+ shift
+ ;;
--lpusername)
lpusername=$2
echo "Using username $lpusername for Launchpad"
@@ -90,43 +89,7 @@ for hostname in $hostnames; do
dev_host;
done
-# Enable relevant Ubuntu package repositories
-if ! grep -qE "^deb https?:.* ${DISTRIB_CODENAME} .*universe" /etc/apt/sources.list; then
- echo "Please enable the 'universe' component in /etc/apt/sources.list'"
- exit 1
-fi
-if ! grep -qE "^deb https?:.* ${DISTRIB_CODENAME} .*multiverse" /etc/apt/sources.list; then
- echo "Please enable the 'multiverse' component in /etc/apt/sources.list'"
- exit 1
-fi
-
-LPDEV_SOURCES="/etc/apt/sources.list.d/launchpad-dev.list"
-if [ ! -e $LPDEV_SOURCES ]; then
- sudo touch $LPDEV_SOURCES
-fi
-
-LP_PPA="deb http://ppa.launchpad.net/launchpad/ppa/ubuntu ${DISTRIB_CODENAME} main"
-if ! grep -q "^${LP_PPA}" $LPDEV_SOURCES; then
- echo "Adding ~launchpad PPA repository to package source list."
- echo "$LP_PPA" | sudo tee -a $LPDEV_SOURCES
-fi
-REQUIRED_PPA_KEYS="2AF499CB24AC5F65461405572D1FFB6C0A5174AF"
-
-# Get the key used to sign the launchpad-developer-dependencies in the PPA.
-for key in $REQUIRED_PPA_KEYS; do
- if ! sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 \
- apt-key adv --list-keys --with-colons --fingerprint | grep -qE "^fpr:+$key"; then
- echo "Retrieving key $key."
- if ! gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys "$key"; then
- echo "Could not retrieve key $key."
- exit 1
- fi
- if ! gpg --export -a "$key" | sudo apt-key add -; then
- echo "Could not install key $key."
- exit 1
- fi
- fi
-done
+sudo add-apt-repository ppa:launchpad/ppa
do_install() {
if ! dpkg -s "$pkg" | grep -q "^Status: install ok installed"; then
@@ -140,6 +103,10 @@ do_install() {
sudo apt update
REQUIRED_PACKAGES="launchpad-developer-dependencies apache2 libapache2-mod-wsgi-py3"
+if [ $INSTALL_POSTGRES_14 == 1 ]; then
+ sudo add-apt-repository ppa:launchpad/postgresql-ports
+ REQUIRED_PACKAGES="launchpad-database-dependencies-14 ${REQUIRED_PACKAGES}"
+fi
for pkg in $REQUIRED_PACKAGES; do
do_install;
done
@@ -237,7 +204,7 @@ cd "$LP_PROJECT_ROOT" || exit 1
echo "Configuring git..."
if [ "$(git ls-remote --get-url lp:launchpad)" = lp:launchpad ]; then
if [ "$(curl --fail --silent "https://launchpad.net/~$lpusername/+sshkeys")" ]; then
- git config --global url.git+ssh://git.launchpad.net/.insteadof lp:
+ git config --global "url.git+ssh://$lpusername@xxxxxxxxxxxxxxxxx/.insteadof" lp:
else
git config --global url.https://git.launchpad.net/.insteadof lp:
fi
@@ -260,7 +227,7 @@ if ! git status; then
fi
if [[ "$(git remote get-url origin)" != *"//git.launchpad.net/launchpad" ]]; then
echo "ERROR: Your clone in $LP_TRUNK_PATH has an incorrect pull location, correcting now..."
- if ! git remote set-url origin git+ssh://git.launchpad.net/launchpad; then
+ if ! git remote set-url origin "git+ssh://$lpusername@xxxxxxxxxxxxxxxxx/launchpad"; then
echo "ERROR: Unable to set trunk pull location to lp:launchpad"
exit 1
fi
Follow ups