annotate bin/install-k0s-web.sh @ 920:531a7200649f

echo command to run new k0s web
author Jeff Hammel <k0scist@gmail.com>
date Sun, 02 Jun 2024 15:18:51 -0700
parents cc3b78bc4c21
children 02b31a76e2c4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
918
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env bash
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 set -exuo pipefail
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 PYTHON_VERSION="3.7"
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 # TODO: take this from "$1"
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 DEST="${HOME}/web3"
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 rm -rf "${DEST}"
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10
919
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
11 # Make a directory for k0s.org web
918
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 mkdir -p "${DEST}"
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 cd "${DEST}"
919
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
14
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
15 # Install the proper version of Python with pyenv
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
16 # See https://github.com/pyenv/pyenv/wiki#suggested-build-environment
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
17 pyenv install --skip-existing "${PYTHON_VERSION}"
918
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 pyenv local "${PYTHON_VERSION}"
9d89288e3b4c add script for k0s.org web install
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19 python --version
919
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
20
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
21 # Create a virtual environment
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
22 python -m venv .
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
23
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
24 # Activate the virtual environment
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
25 . bin/activate
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
26
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
27 # Install the required packages
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
28 bin/pip install --upgrade pip
cc3b78bc4c21 install k0s.org requirements
Jeff Hammel <k0scist@gmail.com>
parents: 918
diff changeset
29 bin/pip install -r "${HOME}"/web/requirements.txt
920
531a7200649f echo command to run new k0s web
Jeff Hammel <k0scist@gmail.com>
parents: 919
diff changeset
30
531a7200649f echo command to run new k0s web
Jeff Hammel <k0scist@gmail.com>
parents: 919
diff changeset
31 # echo command to run the server
531a7200649f echo command to run new k0s web
Jeff Hammel <k0scist@gmail.com>
parents: 919
diff changeset
32 command="sudo ${DEST}/bin/paster serve /home/jhammel/web/paster-wsgintegrate.ini"
531a7200649f echo command to run new k0s web
Jeff Hammel <k0scist@gmail.com>
parents: 919
diff changeset
33 echo "Run with:"
531a7200649f echo command to run new k0s web
Jeff Hammel <k0scist@gmail.com>
parents: 919
diff changeset
34 echo "${command}"