vespene-io/_old_vespene

Support Debian Stretch in install

rafahdzdev opened this issue · 13 comments

Consider change the way to check the operating system debian during installation

Debian is independent of Ubuntu even though the same package manager is used. (APT)

Issues during install on debian 9.5 (dist-upgrade):

1_prepare.sh
sudo apt-add-repository universe
Error: 'universe' invalid

2_database.sh
elif [[ "$DISTRO" == "ubuntu" ]]; then
sudo apt install -y postgresql postgresql-contrib
CONFIG="/etc/postgresql/10/main/pg_hba.conf"

The base repository in debian installs postgres9.6 then not exist /etc/postgresl/10/... and CONFIG fail.

tee: /etc/postgresql/10/main/pg_hba.conf: ----> No such file or directory

Is it necessary to install postgresql10 version ? if is yes should use "PostgreSQL Apt Repository"
https://www.postgresql.org/download/linux/debian/

Hi @rafadevdb

I'm quite open to support for ALL Linux distros, I just had a bit limited time getting started. Debian was my first home distro and I'd love to have it in there.

Do you think you might want to have a go at modifying the setup scripts to simultaneously support Debian and Ubuntu?

Offhand, I see no reason to require PostgreSQL 10, that's just what was there in Bionic. At some point two LTS'es will have different versions and the install scripts may have to get smarter there too.

What do you think?

Hi @mpdehann,
Sure debian should be a must. I will modify the script to make it compatible with debian, if pass the test can create a PR ASAP. Do you agree?

That would be great, thanks!

muki commented

I would like to report that I successfully installed Vespene on Debian Stretch (9).

Git diff says I actually only changed the database password. So I think this works. :)

Excellent! I'll likely get this merged in Monday, thank you!

BTW, I don't want to put you to up it if you don't want to, but any interest in making this work for debian unstable also?

Possibly just different postgres paths, I imagine.

muki commented

Sorry I was a bit unclear in my comment. I was successful with the current master branch. No PR necessary as far as I can tell ...

@muki
Do you haven't problem about the postgresql path?
Stretch has supported database version: postgresql (9.6+181+deb9u2)
https://packages.debian.org/stretch/postgresql

elif [[ "$DISTRO" == "ubuntu" ]]; then
sudo apt install -y postgresql postgresql-contrib
CONFIG="/etc/postgresql/10/main/pg_hba.conf" ---> wrong path ?

muki commented

@rafadevdb no, nothing like this ever happened. however I did install postgresql on my own as root before starting any of this. I wasn't expecting such nice install scripts so as I read the dependencies and went ahead and ran (again, as root) the following:

$ apt install postgresql postgresql-contrib libpq-dev

But maybe I just didn't see the error. Not sure TBH.

Edit: I reran the 2_databases.sh script and yes, it errors, but it doesn't break things. I can see this in between the rest of the logging output which looks OK:

configuring security at /etc/postgresql/10/main/pg_hba.conf ...
tee: /etc/postgresql/10/main/pg_hba.conf: No such file or directory
chown: cannot access '/etc/postgresql/10/main/pg_hba.conf': No such file or directory

If I change the 10 to 9.6 it doesn't error at all and works fine.

@muki If someone has a stable version (debian 9.x) and previously did'n install postgresql so from 2_database.sh script should install 9.6 and not 10.
I think the best option is not to confuse on code.
I've updated the scripts adding the following lines
script 0_common.sh

elif [ -f /usr/bin/apt ]; then
      OS=$(lsb_release -si)
      if [ "$OS" == "Debian" ]; then
         echo "detected Debian"
         DISTRO="debian"
         PYTHON="/usr/bin/python3"
         PIP="/usr/bin/pip3"
      elif [ "$OS" == "Ubuntu" ]; then
         echo "detected Ubuntu"
         DISTRO="ubuntu"
         PYTHON="/usr/bin/python3"
         PIP="/usr/bin/pip3"

1_prepare.sh

elif [ "$DISTRO" == "debian" ]; then
    sudo apt-get update
    sudo apt-get install -y gcc libssl-dev postgresql-client python3 python3-pip python3-setuptools supervisor

2_database.sh

elif [[ "$DISTRO" == "debian" ]]; then
   sudo apt install -y postgresql postgresql-contrib
   CONFIG="/etc/postgresql/9.6/main/pg_hba.conf"

and it works ok I also need to check it in ubuntu

Sounds good, looks like you may need to push those commits to this branch yet?

Per #66 needs to at least install expect, but I'd appreciate more testing to find out if anything else is missing.

I assume 'timeout' is there as part of coreutils?

ok so I see this is not a pull request, if you want to send me one that would be great, notice the setup scripts have changed since you have last seen them probably (recently pushed)

We require at least PostgreSQL 9.4 for Django so be sure it doesn't pull in an old one - I am happy to support Stretch as long as it works easily enough but if it starts to lag a lot behind something a component like Django needs we may need to pick unstable instead.

I have got all the scripts running for stretch. There where a couple of packages missing for a really naked stretch.

Stretch has postgres 9.6 so this should not be a problem. I will do a bit more playing around and then reset my test machine to 0 and give it one more spin up.