mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Conda constructor wasn't providing enough use to justify its restrictions: 1. It doesn't work with most of conda-forge due to https://github.com/conda/constructor/issues/86#issuecomment-330863531. Almost all the packages we want to ship are in conda-forge. 2. There is no way to pass environment variables to the post-install script, which makes customization super hard. 3. Can't bundle pip packages, so we need internet access to install packages anyway. This negates the 'offline installable' aspect of conda constructor. 4. We need an installer script that users can curl into bash regardless. Downloading & installing miniconda straight up seems simple enough for now, and has a reasonable upgrade pathway. I think it'll work out ok!
43 lines
1.4 KiB
Bash
Executable File
43 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
set -exuo pipefail
|
|
|
|
# Set up defaults for configurable env vars
|
|
TLJH_INSTALL_PREFIX=${TLJH_INSTALL_PREFIX:-/opt/tljh}
|
|
TLJH_INSTALL_PIP_SPEC=${TLJH_INSTALL_SPEC:-git+https://github.com/yuvipanda/the-littlest-jupyterhub.git}
|
|
TLJH_INSTALL_PIP_FLAGS=${TLJH_PIP_FLAGS:---no-cache-dir}
|
|
|
|
|
|
function install_miniconda {
|
|
CONDA_DIR=${1}
|
|
CONDA_VERSION=4.5.4
|
|
URL="https://repo.continuum.io/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh"
|
|
INSTALLER_PATH=/tmp/miniconda-installer.sh
|
|
|
|
wget $URL -O ${INSTALLER_PATH}
|
|
chmod +x ${INSTALLER_PATH}
|
|
|
|
# Only MD5 checksums are available for miniconda
|
|
# Can be obtained from https://repo.continuum.io/miniconda/
|
|
MD5SUM="a946ea1d0c4a642ddf0c3a26a18bb16d"
|
|
|
|
if ! echo "${MD5SUM} ${INSTALLER_PATH}" | md5sum --quiet -c -; then
|
|
echo "md5sum mismatch for ${INSTALLER_PATH}, exiting!"
|
|
exit 1
|
|
fi
|
|
|
|
bash ${INSTALLER_PATH} -b -p ${CONDA_DIR}
|
|
|
|
# Allow easy direct installs from conda forge
|
|
${CONDA_DIR}/bin/conda config --system --add channels conda-forge
|
|
|
|
# Do not attempt to auto update conda or dependencies
|
|
${CONDA_DIR}/bin/conda config --system --set auto_update_conda false
|
|
${CONDA_DIR}/bin/conda config --system --set show_channel_urls true
|
|
}
|
|
|
|
HUB_CONDA_DIR=${TLJH_INSTALL_PREFIX}/hub
|
|
install_miniconda ${HUB_CONDA_DIR}
|
|
${HUB_CONDA_DIR}/bin/pip install ${TLJH_INSTALL_PIP_FLAGS} ${TLJH_INSTALL_PIP_SPEC}
|
|
|
|
${HUB_CONDA_DIR}/bin/python3 -m tljh.installer
|